主权项 |
1. A method of selectively applying a data encryption function, comprising:
performing, by a Constrained Application Protocol (CoAP) client and a CoAP server, a datagram transport layer security (DTLS) handshake process; generating, by the CoAP client, a CoAP message when the DTLS handshake process has been completed, and then indicating, by the CoAP client, that encryption does not need to be applied to the CoAP message; generating, by the CoAP client, only an authentication value of the CoAP message via a DTLS record layer protocol; setting, by the CoAP client, a value of a specific field of a DTLS record layer protocol header to a specific value via the DTLS record layer protocol; and sending, by the CoAP client, the CoAP message and the authentication value to the CoAP server, wherein the specific field of the DTLS record layer protocol header comprises an epoch field, and wherein the setting the value of the specific field of the DTLS record layer protocol header to the specific value comprises setting a left highest 1 bit of the epoch field to 0. |