Communication method, device, equipment and medium
By using keys of different security levels to encrypt messages in the communication between the PLC gateway and the smart device, and verifying them with serial numbers and random numbers, the communication security problem in the prior art is solved, and higher communication security and reliability are achieved.
Patent Information
- Application Number
- CN202311277367.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-03-28
AI Technical Summary
In the communication between existing PLC gateways and smart devices, there are security problems such as device forgery, network monitoring, and playback attacks, which cannot effectively ensure communication security.
Communication messages are encrypted by using two different security levels of keys (first key and second key) between gateway devices and sub-devices, and the encryption type is indicated by fields in the messages, and packet verification is performed in combination with sequence numbers and random numbers to identify and discard potential attack messages.
It effectively improves the communication security between gateway devices and sub-devices, prevents device forgery, network monitoring and replay attacks, and ensures the security and reliability of the communication process.
Smart Images

Figure CN119728133A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of power line carrier communications, and in particular to a communication method, device, equipment and medium. Background Art
[0002] PLC, or Power Line Communication, is a carrier communication method that uses power lines (low, medium voltage or DC) as a medium to transmit data and information. It achieves high-speed, reliable, real-time, and long-distance data transmission on power lines. Its outstanding feature is that the network follows the power, and it can access the network without the need to deploy additional special communication lines. Power line carrier communication technology is currently widely used in the smart meter reading market, as well as smart homes, smart energy, smart street lights, smart transportation and other fields. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides a communication method, apparatus, device and medium.
[0004] According to a first aspect of an embodiment of the present disclosure, a communication method is provided, which is applied to a first device. The communication method includes:
[0005] Obtain a first key and a second key; the security level corresponding to the first key is higher than the security level corresponding to the second key;
[0006] Generate a first message, the first message includes a first field, the first field indicates first information or second information, the first information indicates that the first message is encrypted by the first key, and the second information indicates that the first message is encrypted by the second key;
[0007] Send the first message to the second device.
[0008] In some exemplary embodiments of the present disclosure, the method further includes:
[0009] The first field indicates third information, and the third information indicates that the first message is not encrypted.
[0010] In some exemplary embodiments of the present disclosure, the first message includes a second field, and a value of the second field is accumulated in response to sending of the message;
[0011] The method further comprises:
[0012] receiving a second message sent by the second device, and recording a value of a second field in the second message;
[0013] A third message sent by the second device is received, and according to a value of a second field in the third message and a recorded value of the second field in the second message, whether the third message is an attack message is determined.
[0014] In some exemplary embodiments of the present disclosure, the method further includes:
[0015] If the value of the second field in the third message is less than or equal to the value of the second field in the second message, determine that the third message is an attack message, and discard the third message;
[0016] If the value of the second field in the third message is greater than the value of the second field in the second message, it is determined that the third message is not an attack message, the third message is released, and the value of the second field in the third message is recorded.
[0017] In some exemplary embodiments of the present disclosure, the first message includes a third field, and the third field is generated based on encryption of the first message;
[0018] The method further comprises:
[0019] Receive a second message sent by the second device, and determine whether the second message is modified according to a value of a third field in the second message and a random number, wherein the random number is composed of address information of the first device and a second field of the second message.
[0020] In some exemplary embodiments of the present disclosure, the method further includes:
[0021] If the value of the third field in the second message verifies that the random number is wrong, it is determined that the second message is modified, and the second message is discarded;
[0022] If the value of the third field in the second message verifies that the random number is correct, it is determined that the second message has not been modified, and the second message is released.
[0023] In some exemplary embodiments of the present disclosure, the first device is a gateway device;
[0024] The obtaining of the first key comprises:
[0025] Receiving a first key sent by a server;
[0026] The obtaining of the second key comprises:
[0027] The second key is generated according to a key generation algorithm or randomly.
[0028] In some exemplary embodiments of the present disclosure, the first device is a sub-device connected to a gateway device;
[0029] The obtaining of the first key comprises:
[0030] Obtaining a first key from a server through a signature verification process;
[0031] The obtaining of the second key comprises:
[0032] Receive the second key sent by the gateway device.
[0033] According to a second aspect of an embodiment of the present disclosure, a communication apparatus is provided, which is applied to a first device, and the communication apparatus includes:
[0034] An acquisition module, used to acquire a first key and a second key; the security level corresponding to the first key is higher than the security level corresponding to the second key;
[0035] an encryption module, configured to generate a first message, wherein the first message includes a first field, the first field indicates first information or second information, the first information indicates that the first message is encrypted by the first key, and the second information indicates that the first message is encrypted by the second key;
[0036] A sending module is used to send the first message to the second device.
[0037] According to a third aspect of an embodiment of the present disclosure, a device is provided, the device comprising:
[0038] processor;
[0039] a memory for storing processor-executable instructions;
[0040] The processor is configured to execute executable instructions in the memory to implement the communication method provided in the first aspect of the present disclosure.
[0041] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, on which executable instructions are stored. When the executable instructions are executed by a processor, the communication method provided by the first aspect of the present disclosure is implemented.
[0042] The above method disclosed in the present invention has the following beneficial effects: the first device obtains the first key and the second key, and uses the first key or the second key to encrypt the first message sent to the second device, the first field in the message indicates the encryption type of the message, and the first key and the second key correspond to different security levels, which can effectively ensure the communication security between the gateway device and the sub-device in different business scenarios.
[0043] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0045] Figure 1 The figure is a flow chart of a communication method according to an exemplary embodiment.
[0046] Figure 2 The figure is an application scenario diagram of a communication method according to an exemplary embodiment.
[0047] Figure 3 The figure is a flow chart of a communication method according to an exemplary embodiment.
[0048] Figure 4 The figure is a flow chart of a communication method according to an exemplary embodiment.
[0049] Figure 5 It is a schematic diagram of a message according to an exemplary embodiment.
[0050] Figure 6 It is a block diagram of a communication device according to an exemplary embodiment.
[0051] Figure 7 is a block diagram of a device according to an exemplary embodiment. DETAILED DESCRIPTION
[0052] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0053] A PLC gateway is a device that connects different types of PLC (Programmable Logic Controller) systems. As an intermediate node, the PLC gateway enables them to share information and realize functions such as data collection, monitoring, and control. Figure 2As shown in the figure, in the smart home scenario, the smart devices 1 include downlights, curtains, spotlights, etc. The smart devices are connected to the PLC gateway 2 in the strong power box through the home power supply line. The smart devices 1 and the PLC gateway 2 complete the power carrier communication through the PLC link. The PLC gateway is connected to the Ethernet port in the weak power box through the network cable to access the external network Internet. Various smart devices 1 are added to the home through authentication with the cloud 4. Users can remotely control the smart devices 1 through terminal devices 3 such as smart phones, smart watches, and speakers. Among them, the communication process between the PLC gateway and the smart devices is as follows: the PLC gateway 2 receives the message sent by the cloud 4 (i.e., the server), encapsulates the data information such as the source address, destination address, length, encryption method, and crc check code in the message, and the PLC gateway 2 sends the encapsulated message to the CCO (Concentrator, master node) through the serial port or spi, and the COO of the PLC gateway 2 forwards it to each smart device 1 through the PLC link.
[0054] The PLC gateway 2, the terminal device 3 and the cloud 4 communicate through the TLS or HTTPS secure channel of the Internet to ensure the security of communication. However, since the smart device 1 and the PLC gateway 2 communicate through the PLC power carrier, security cannot be guaranteed. In the prior art, for the communication process between the PLC gateway and the smart device, key communication is mostly used to establish a secure channel, that is, only focusing on encrypted communication, without paying attention to the security and legality of key generation, and unable to completely solve security issues such as device counterfeiting, network monitoring, and replay attacks.
[0055] In order to solve the above problems, the present disclosure provides a communication method, which is applied to a gateway device and a sub-device connected to the gateway device. The first device obtains a first key and a second key, and uses the first key or the second key to encrypt a first message sent to the second device. The first field in the message indicates the encryption type of the message. The first key and the second key correspond to different security levels, which can effectively ensure the communication security between the gateway device and the sub-device in different business scenarios.
[0056] The exemplary embodiment of the present disclosure provides a communication method, which is applied to a gateway device and a sub-device connected to the gateway device. The sub-device connected to the gateway device may be a smart furniture device such as a smart light, a smart switch, and a roller shutter motor that can be connected to the gateway device. Figure 1 As shown, the communication method shown in the present disclosure includes:
[0057] S101, obtaining a first key and a second key;
[0058] S102, generating a first message, where the first message includes a first field, where the first field indicates first information or second information, where the first information indicates that the first message is encrypted by a first key, and the second information indicates that the first message is encrypted by a second key;
[0059] S103: Send a first message to the second device.
[0060] In step S101, the first device obtains a first key and a second key, wherein the first key is a device key and the second key is a network key. The first key and the second key correspond to different security levels. The first device can choose to use the first key or the second key to encrypt the message according to the business scenario of the message transmission.
[0061] In some embodiments, the first device is a gateway device;
[0062] Obtaining a first key includes: receiving a first key sent by a server;
[0063] Obtaining the second key includes: generating the second key according to a key generation algorithm or randomly.
[0064] In some embodiments, the first device is a sub-device connected to the gateway device;
[0065] Obtaining the first key includes: obtaining the first key from the server through a signature verification process;
[0066] Acquiring the second key includes: receiving the second key sent by the gateway device.
[0067] The device key is generated by the server. The gateway device receives the device key sent by the server through the TLS network and uses it as the first key. The sub-device obtains the device key from the server through the ECDH key negotiation algorithm and signature verification process and uses it as the first key. Since the sub-device and the server negotiate the key through the ECDH key negotiation algorithm and generate a shared key, the use of the shared key for communication between the sub-device and the server can prevent attacks from other devices. At the same time, the signature verification process can ensure the legitimacy of the other end.
[0068] The network key can be generated by the gateway device through a key generation algorithm, such as using the DES algorithm or the AES algorithm. It can also be generated by the gateway device through a random number generation method. The better the randomness, the better the effect of encryption using the second key. The gateway device sends the network key to the sub-device, and the sub-device receives the network key sent by the gateway device and uses it as the second key.
[0069] Since the device key is no longer transmitted between any two devices, but is obtained from the server, there is no interaction between the gateway device and the sub-device regarding the device key, while the network key is generated by the gateway device and sent to the sub-device by the gateway device, that is, the network key is transmitted between the two devices, so the security level corresponding to the device key is higher than the security level corresponding to the network key, that is, the security level corresponding to the first key is higher than the security level corresponding to the second key. For business scenarios with high security levels, the first key can be used to encrypt the message to improve the security of the communication process.
[0070] In addition, in order to improve the security level of the key, a high-security-level key can be used to synchronously modify a low-security-level key. For example, the encrypted channel of the first key is used to update the second key, that is, the gateway device can directly send the second key to the sub-device, or use the first key to update the second key and then send it to the sub-device.
[0071] In step S102, a message is a data unit exchanged and transmitted in the network. The message contains the complete data information to be sent. The length of the message is unlimited and variable. In order to ensure the security of data information transmission and prevent data information leakage, it is necessary to convert the plaintext into ciphertext through an encryption algorithm. Figure 5 As shown, in addition to the encrypted ciphertext, the message also includes fields such as DMAC (Destination Mac, destination MAC address), SMAC (Source Mac, source MAC address). In order to determine what kind of encrypted communication is performed between the first device and the second device, the first message includes a first field for indicating which key is used to encrypt the first message, that is, the first field is a flag bit, the first field occupies one byte, and the value of the first field corresponds to an encryption method. For example, 1 indicates that the message is encrypted using the first key, and 2 indicates that the message is encrypted using the second key, that is, the first information indicates that the first message is encrypted by the first key, and the second information indicates that the first message is encrypted by the second key.
[0072] Since the security level corresponding to the first key is higher than the security level corresponding to the second key, the key type corresponding to the security level can be determined to encrypt the message according to different business scenarios. For example, when configuring groups, scenarios, and key information, the first key with a high security level can be used for encryption, and the first field indicates the first information; when obtaining information and group control, the second key with a low security level can be used for encryption, and the first field indicates the second information.
[0073] In some embodiments, the first field indicates third information, and the third information indicates that the first message is not encrypted.
[0074] In some business scenarios, the message sent by the first device does not need to be encrypted, and only needs to use a digital signature to allow the second device to authenticate the authenticity of the message. For messages that do not need to be encrypted, they can also be displayed in the first field of the message. If the first field indicates the third information, it means that the first message is not encrypted. For example, when the first field is 0, the third information is indicated, indicating that the message is not encrypted.
[0075] In step S103, the first device sends the encrypted message to the second device, the second device decrypts the encrypted message to obtain data information in the message, and the second device responds according to the data information to complete the communication between the first device and the second device.
[0076] In the present disclosure, the first device obtains the first key and the second key, and uses the first key or the second key to encrypt the first message sent to the second device. Since the first key and the second key correspond to different security levels, the communication security between the gateway device and the sub-device in different business scenarios can be effectively guaranteed.
[0077] According to an exemplary embodiment, Figure 3 As shown, the communication method in this embodiment includes:
[0078] S301, obtaining a first key and a second key;
[0079] S302, generating a first message, the first message including a first field, the first field indicating first information or second information, the first information indicating that the first message is encrypted by a first key, and the second information indicating that the first message is encrypted by a second key;
[0080] S303, sending a first message to the second device;
[0081] S304. Receive a second message sent by a second device, and record a value of a second field in the second message;
[0082] S305, receiving a third message sent by the second device, and determining whether the third message is an attack message according to the value of the second field in the third message and the value of the second field in the recorded second message, if the third message is an attack message, executing step S306; if the third message is not an attack message, executing step S307;
[0083] S306: If the value of the second field in the third message is less than or equal to the value of the second field in the second message, it is determined that the third message is an attack message, and the third message is discarded;
[0084] S307: The value of the second field in the third message is greater than the value of the second field in the second message, and it is determined that the third message is not an attack message. The third message is released, and the value of the second field in the third message is recorded.
[0085] Among them, steps S301, S302, and S303 are the same as those in the above embodiment and will not be repeated here.
[0086] The message includes a second field, which occupies four bits. The value corresponding to the second field is the sequence number seq. During the communication process between the first device and the second device, the sequence number is accumulated in response to the sending of the message, and the step of accumulation can be 1, 2, 3, etc. For example, the step of each accumulation of the sequence number in response to the sending of the message is 1, and in response to the sending of the first message, the value of the second field in the first message changes from 0 to 1. For the received message, the message needs to be verified to determine whether the message comes from the real sender, not a fake one. Therefore, the first device and the second device can determine whether the message is sent by the other party through the value of the second field in the message sent by the other party.
[0087] In step S304, the first device receives the second message sent by the second device, and records the value of the second field in the second message. In step S305, the first device receives the third message sent by the second device, and compares the value of the second field in the third message with the value of the second field in the second message. Since the value of the second field in the message is accumulated in response to the sending of the message, it is possible to determine whether the message is a message of a replay attack by comparing the value of the second field in the currently received message with the value of the second field in the previously received message. If the value of the second field in the third message is less than or equal to the value of the second field in the second message, that is, the third message is a message of a replay attack, then step S306 is executed to discard the third message. If the value of the second field in the third message is greater than the value of the second field in the second message, that is, the third message is not a message of a replay attack, then step S307 is executed, and the first device decrypts and responds to the message, and records the value of the second field in the third message. When the first device sends a message to the second device later, the value of the second field in the message will be accumulated based on the value of the second field in the third message.
[0088] In the present disclosure, since the value of the second field in the message will be accumulated in response to the sending of the message, the value of the second field in the message can be used to determine whether the received message is a replay attack message. The device will discard the message that belongs to the replay attack to prevent malicious eavesdroppers from sending the message multiple times in the network after receiving the message, so as to solve the problem of replay attacks and improve the correctness of identity authentication.
[0089] According to an exemplary embodiment, Figure 4 As shown, the communication method in this embodiment includes:
[0090] S401, obtaining a first key and a second key;
[0091] S402: Generate a first message, where the first message includes a first field, where the first field indicates first information or second information, where the first information indicates that the first message is encrypted by a first key, and the second information indicates that the first message is encrypted by a second key;
[0092] S403, sending a first message to the second device;
[0093] S404, receiving a second message sent by a second device;
[0094] S405, determining whether the second message is modified according to the value of the third field in the second message and the random number, if the second message is modified, executing step S206; if the second message is not modified, executing step S407;
[0095] S406: The random number check value of the third field in the second message is wrong, and it is determined that the second message is modified, and the second message is discarded;
[0096] S407: Check that the random number of the value of the third field in the second message is correct, determine that the second message has not been modified, and release the second message.
[0097] Among them, steps S401, S402, S403, and S404 are the same as those in the above embodiment and will not be repeated here.
[0098] During the communication process between the first device and the second device, the AES symmetric encryption algorithm can be used to encrypt and decrypt the message. The keys used in the encryption and decryption processes are exactly the same. The encryption and decryption processes are symmetrical, and the encryption and decryption of a 512-byte message can be completed within 1ms, which can effectively improve the efficiency of the communication process. For example, AES-CCM is used to encrypt the message, and the efficiency and security of the AES-CCM algorithm have high standards.
[0099] For the received message, it is also necessary to determine whether the content of the message has been changed to ensure the security of communication. The first message includes a third field, which is the verification code mic. The third field is generated based on the encryption of the first message, occupies four bytes, and is used to verify the random number in the message. The random number in the message is defined to be composed of the address information of the target device and the value of the second field in the message, that is, nonce=DMAC+seq. The random tampering of the DMAC in the message will cause other devices to respond to the message, and the random tampering of the seq in the message will cause communication abnormalities. Therefore, in step S405, the random number nonce is verified using the third field mic when decrypting the message to determine whether the content of the message has been modified. If the value of the third field in the second message verifies the random number incorrectly, it is determined that the second message has been modified, then step S406 is executed to discard the second message. If the value of the third field in the second message verifies the random number correctly, it is determined that the second message has not been modified, then step S407 is executed to release the second message, allowing the first device to respond to the second message.
[0100] In the present disclosure, the third field is used to check the message to determine whether the message has been modified. The modified message is directly discarded, which can prevent the message from being maliciously tampered with and attacking the network, and at the same time prevent other devices in the network from monitoring the message to ensure the validity of the message.
[0101] The exemplary embodiment of the present disclosure provides a communication device, which is applied to a gateway device and a sub-device connected to the gateway device. Figure 6 As shown, a block diagram of a communication device shown in the present disclosure.
[0102] The block diagram includes: an acquisition module 61, an encryption module 62, and a sending module 63. The acquisition module 61 is used to acquire a first key and a second key; the security level corresponding to the first key is higher than the security level corresponding to the second key; the encryption module 62 is used to generate a first message, the first message includes a first field, the first field indicates first information or second information, the first information indicates that the first message is encrypted by the first key, and the second information indicates that the first message is encrypted by the second key; the sending module 63 is used to send the first message to the second device.
[0103] In an exemplary embodiment of the present disclosure, the first field indicates third information, and the third information indicates that the first message is not encrypted.
[0104] In an exemplary embodiment of the present disclosure, the first message includes a second field, and the value of the second field is accumulated in response to the sending of the message; the encryption module 62 is also used to: receive a second message sent by a second device, and record the value of the second field in the second message; receive a third message sent by the second device, and determine whether the third message is an attack message based on the value of the second field in the third message and the value of the second field in the recorded second message.
[0105] In an exemplary embodiment of the present disclosure, the encryption module 62 is also used to: if the value of the second field in the third message is less than or equal to the value of the second field in the second message, determine that the third message is an attack message and discard the third message; if the value of the second field in the third message is greater than the value of the second field in the second message, determine that the third message is not an attack message, release the third message, and record the value of the second field in the third message.
[0106] In an exemplary embodiment of the present disclosure, the first message includes a third field, and the third field is generated based on the encryption of the first message; the encryption module 62 is also used to: receive a second message sent by a second device, and determine whether the second message is modified based on the value of the third field in the second message and a random number, wherein the random number is composed of the address information of the first device and the second field of the second message.
[0107] In an exemplary embodiment of the present disclosure, the encryption module 62 is also used for: if the random number verification value of the third field in the second message is wrong, it is determined that the second message has been modified and the second message is discarded; if the random number verification value of the third field in the second message is correct, it is determined that the second message has not been modified and the second message is released.
[0108] In an exemplary embodiment of the present disclosure, the first device is a gateway device; the acquisition module 61 is further used to:
[0109] Obtaining a first key includes: receiving a first key sent by a server;
[0110] Obtaining the second key includes: generating the second key according to a key generation algorithm or randomly.
[0111] In an exemplary embodiment of the present disclosure, the first device is a sub-device connected to the gateway device; the acquisition module 61 is further used to:
[0112] Obtaining the first key includes: obtaining the first key from the server through a signature verification process;
[0113] Acquiring the second key includes: receiving the second key sent by the gateway device.
[0114] Regarding the communication device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0115] Figure 7 700 is a block diagram of a device 700 according to an exemplary embodiment. For example, the device 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0116] Reference Figure 7 , device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .
[0117] The processing component 702 generally controls the overall operation of the device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0118] The memory 704 is configured to store various types of data to support operations on the device 700. Examples of such data include instructions for any application or method operating on the device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0119] The power supply component 706 provides power to the various components of the device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 700.
[0120] The multimedia component 708 includes a screen that provides an output interface between the device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0121] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the device 700 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0122] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0123] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the device 700. For example, the sensor assembly 714 can detect the open / closed state of the device 700, the relative positioning of components, such as the display and keypad of the device 700, and the sensor assembly 714 can also detect the position change of the device 700 or a component of the device 700, the presence or absence of user contact with the device 700, the orientation or acceleration / deceleration of the device 700, and the temperature change of the device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0124] The communication component 716 is configured to facilitate wired or wireless communication between the device 700 and other devices. The device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0125] In an exemplary embodiment, the device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0126] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by the processor 720 of the device 700 to perform the above communication method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0127] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables a processing device of the electronic device to execute a communication method provided by an exemplary embodiment of the present disclosure.
[0128] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0129] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A communication method, characterized in that: Applied to a first device, the communication method includes: Obtain a first key and a second key; the security level corresponding to the first key is higher than the security level corresponding to the second key; Generate a first message, the first message includes a first field, the first field indicates first information or second information, the first information indicates that the first message is encrypted by the first key, and the second information indicates that the first message is encrypted by the second key; Send the first message to the second device.
2. The communication method according to claim 1, characterized in that: The method further comprises: The first field indicates third information, and the third information indicates that the first message is not encrypted.
3. The communication method according to claim 1, characterized in that: The first message includes a second field, a value of the second field being accumulated in response to the sending of the message; The method further comprises: receiving a second message sent by the second device, and recording a value of a second field in the second message; A third message sent by the second device is received, and according to a value of a second field in the third message and a recorded value of the second field in the second message, whether the third message is an attack message is determined.
4. The communication method according to claim 3, characterized in that: The method further comprises: If the value of the second field in the third message is less than or equal to the value of the second field in the second message, determine that the third message is an attack message, and discard the third message; If the value of the second field in the third message is greater than the value of the second field in the second message, it is determined that the third message is not an attack message, the third message is released, and the value of the second field in the third message is recorded.
5. The communication method according to claim 1, characterized in that: The first message includes a third field, and the third field is generated based on encryption of the first message; The method further comprises: Receive a second message sent by the second device, and determine whether the second message is modified according to a value of a third field in the second message and a random number, wherein the random number is composed of address information of the first device and a second field of the second message.
6. The communication method according to claim 5, characterized in that: The method further comprises: If the value of the third field in the second message verifies that the random number is wrong, it is determined that the second message is modified, and the second message is discarded; If the value of the third field in the second message verifies that the random number is correct, it is determined that the second message has not been modified, and the second message is released.
7. The communication method according to claim 1, characterized in that: The first device is a gateway device; The obtaining of the first key comprises: Receiving a first key sent by a server; The obtaining of the second key comprises: The second key is generated according to a key generation algorithm or randomly.
8. The communication method according to claim 1, characterized in that: The first device is a sub-device connected to the gateway device; The obtaining of the first key comprises: Obtaining a first key from a server through a signature verification process; The obtaining of the second key comprises: Receive the second key sent by the gateway device.
9. A communication device, characterized in that: Applied to a first device, the communication device comprises: An acquisition module, used to acquire a first key and a second key; the security level corresponding to the first key is higher than the security level corresponding to the second key; an encryption module, configured to generate a first message, wherein the first message includes a first field, the first field indicates first information or second information, the first information indicates that the first message is encrypted by the first key, and the second information indicates that the first message is encrypted by the second key; A sending module is used to send the first message to the second device.
10. A device, characterized in that: The device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to execute executable instructions in the memory to implement the communication method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium having executable instructions stored thereon, characterized in that: When the executable instructions are executed by a processor, the communication method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Achieving method and device for preventing replay attack
CN103856489A
Data transmission method and device and storage medium
CN110266480A
Communication method for bus dispatching system and bus dispatching system
CN113114621A
Method and device for preventing replay attack on SRv6 HMAC verification
CN113395247A
System, method, and device of authenticated encryption of messages
US10454674B1