Key processing method and device of internet of things equipment, electronic equipment and storage medium

By building a data and secure transmission channel in IoT devices, performing two-way authentication and key negotiation, and generating session keys, the security and efficiency issues between the main control chip and the communication module are resolved, thereby improving communication security and efficiency.

CN121012633BActive Publication Date: 2026-02-10GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511534960.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-02-10
Estimated Expiration
2045-10-27

AI Technical Summary

Technical Problem

The communication between the main control chip and the communication module in IoT devices suffers from low security, heavy system load, and low communication efficiency. In particular, the risk of key leakage and the inability to achieve dynamic updates make it difficult to meet the application requirements of high security levels.

Method used

By constructing a data transmission channel and a secure transmission channel between the main control chip and the communication module, an intermediate key is generated after two-way authentication. The key fragment is then sent through the secure transmission channel, and the intermediate key is transmitted in conjunction with the data transmission channel to realize the combination operation of the session key, thus constructing a hierarchical security protection system.

Benefits of technology

It raises the attack threshold, enhances key security, ensures secure data transmission between the main control chip and the communication module, enables multi-stage parameter transmission and combination, and improves communication efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121012633B_ABST
    Figure CN121012633B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a key processing method and device of an Internet of Things equipment, an electronic device and a storage medium, and relate to the technical field of smart home communication, the method comprising: after bidirectional identity verification between a master control chip and a communication module is passed, exchanging key materials, then the two generate corresponding intermediate keys according to a first random challenge value, a second random challenge value and an equipment identifier, the master control chip generates a key segment for the communication module, sends the key segment to the communication module through a secure transmission channel, and finally the master control chip and the communication module respectively perform combination operation according to the intermediate keys and the key segment to obtain a session key for secure communication between the master control chip and the communication module, thereby realizing data isolation, constructing a hierarchical security protection system, effectively improving the attack threshold, improving the security of the key, and effectively guaranteeing the security of data transmission between the master control chip and the communication module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart home communication technology, and in particular to a key processing method for Internet of Things (IoT) devices, a key processing device for IoT devices, an electronic device, and a readable storage medium. Background Technology

[0002] In IoT devices, the security of communication between the main control chip and the communication module is crucial. However, during communication between the main control chip and the communication module, there is a risk of key leakage, and dynamic updates are not possible, making it difficult to meet the requirements of high-security applications. Furthermore, introducing complex encryption algorithms can easily increase the system load due to the limited resources of the main control chip, affecting communication efficiency. Summary of the Invention

[0003] This invention provides a key processing method, apparatus, electronic device, and readable storage medium for Internet of Things (IoT) devices, to solve or partially solve the problems of low security, heavy system burden, and low communication efficiency in the communication between the main control chip and the communication module in IoT devices.

[0004] This invention discloses a key processing method for an Internet of Things (IoT) device. The IoT device includes at least a main control chip and a communication module. A data transmission channel and a secure transmission channel are established between the main control chip and the communication module. The method includes:

[0005] The main control chip and the communication module perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains the first random challenge value generated by the main control chip and the device identifier of the IoT device, and the main control chip obtains the second random challenge value generated by the communication module.

[0006] The main control chip and the communication module generate corresponding intermediate keys based on the first random challenge value, the second random challenge value, and the device identifier, respectively.

[0007] The main control chip generates a key fragment for the communication module and sends the key fragment to the communication module through the secure transmission channel;

[0008] The main control chip and the communication module perform combination operations based on the intermediate key and the key fragment respectively to obtain a session key for secure communication between the main control chip and the communication module.

[0009] Among some feasible implementation methods are:

[0010] The main control chip generates a target random number for the session key and transmits the target random number to the communication module through the data transmission channel.

[0011] The main control chip and the communication module respectively verify the consistency of the session key using the target random number and the intermediate key. If the session key verification is successful, the main control chip and the communication module communicate encrypted using the session key.

[0012] In some feasible implementations, the main control chip and the communication module respectively verify the consistency of the session key using the target random number and the intermediate key. If the session key verification passes, the main control chip and the communication module perform encrypted communication using the session key, including:

[0013] The main control chip performs a hash operation on the intermediate key and the target random number to generate a first key verification value for the session key, and sends the first key verification value to the communication module.

[0014] The communication module performs a hash operation between the intermediate key and the target random number to generate a second key verification value for the session key.

[0015] If the first key verification value is the same as the second key verification value, the communication module returns the corresponding verification success information to the main control chip;

[0016] In response to receiving the verification success information, the main control chip establishes an encrypted communication channel with the communication module corresponding to the session key.

[0017] In some feasible implementations, the main control chip and the communication module perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains a first random challenge value generated by the main control chip and the device identifier of the IoT device. The main control chip obtains a second random challenge value generated by the communication module, including:

[0018] The main control chip generates a first random challenge value and obtains the device identifier of the IoT device;

[0019] The main control chip sends the first random challenge value and the device identifier to the communication module through the data transmission channel;

[0020] The communication module generates a second random challenge value, and concatenates the first random challenge value, the second random challenge value, and the device identifier to obtain a corresponding first data block;

[0021] The communication module uses a pre-shared key corresponding to the main control chip to perform a hash operation on the first data block to obtain the authentication signature corresponding to the first data block.

[0022] The main control chip concatenates the first random challenge value, the second random challenge value, and the device identifier to obtain a corresponding second data block, and performs a hash operation on the second data block using the pre-shared key to obtain a corresponding first hash value;

[0023] If the first hash value matches the authentication signature, then the two-way authentication between the main control chip and the communication module is successful.

[0024] In some feasible implementations, generating the corresponding intermediate key based on the first random challenge value, the second random challenge value, and the device identifier includes:

[0025] The first random challenge value, the second random challenge value, and the device identifier are concatenated to obtain the corresponding target data block;

[0026] The target data block is hashed using the pre-shared key between the main control chip and the communication module to obtain the corresponding second hash value;

[0027] Obtain the truncation information transmitted between the main control chip and the communication module through the data transmission channel, and truncate the second hash value according to the truncation information to obtain the intermediate key between the main control chip and the communication module.

[0028] In some feasible implementations, sending the key fragment to the communication module through the secure transmission channel includes:

[0029] The main control chip acquires the initial baud rate and synchronization header for the key segment, and sends the initial baud rate and synchronization header to the communication module through the data transmission channel;

[0030] The main control chip encodes the key fragment to obtain the corresponding bit stream, and transmits the bit stream to the communication module in the secure transmission channel according to the initial baud rate and the synchronization header;

[0031] In response to receiving the synchronization header, the communication module establishes bit synchronization with the main control chip, receives the bit stream, decodes the bit stream, and obtains the key fragment.

[0032] Among some feasible implementation methods are:

[0033] If there is a bit error rate during the transmission of the bit stream, a baud rate adjustment instruction is generated for the bit stream, and the initial baud rate is adjusted to the target baud rate according to the baud rate adjustment instruction.

[0034] Among some feasible implementation methods are:

[0035] If the two-way authentication is successful, the main control chip obtains the key negotiation parameters for the communication module and synchronizes the key negotiation parameters to the communication module through the data transmission channel;

[0036] The key negotiation parameters include at least one of the following: encryption algorithm type, key lifespan, challenge value length, and transmission baud rate.

[0037] Among some feasible implementation methods are:

[0038] If the session key is used for a period of time that reaches the key lifecycle, or if the amount of data transmitted between the main control chip and the communication module reaches a preset threshold, then the main control chip and the communication module will renegotiate the session key.

[0039] This invention also discloses a key processing device for an Internet of Things (IoT) device. The IoT device includes at least a main control chip and a communication module. A data transmission channel and a secure transmission channel are established between the main control chip and the communication module. The device includes:

[0040] The authentication modules located in the main control chip and the communication module are used to perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains the first random challenge value generated by the main control chip and the device identifier of the IoT device, and the main control chip obtains the second random challenge value generated by the communication module.

[0041] The key generation modules located in the main control chip and the communication module are respectively used to generate corresponding intermediate keys based on the first random challenge value, the second random challenge value and the device identifier;

[0042] The key fragment generation module located in the main control chip is used to generate key fragments for the communication module and send the key fragments to the communication module through the secure transmission channel;

[0043] The key combination modules located in the main control chip and the communication module are used to perform combination operations based on the intermediate key and the key fragment to obtain the session key for secure communication between the main control chip and the communication module.

[0044] Among some feasible implementation methods are:

[0045] The random number generation module located in the main control chip is used to generate a target random number for the session key and transmit the target random number to the communication module through the data transmission channel;

[0046] The key verification modules located in the main control chip and the communication module are used to verify the consistency of the session key using the target random number and the intermediate key. If the session key verification is successful, the main control chip and the communication module communicate encrypted using the session key.

[0047] In some feasible implementations, the key verification module includes:

[0048] The first verification value generation submodule located in the main control chip is used to perform a hash operation on the intermediate key and the target random number to generate a first key verification value for the session key, and send the first key verification value to the communication module.

[0049] The second verification value generation submodule located in the communication module is used to perform a hash operation on the intermediate key and the target random number to generate a second key verification value for the session key;

[0050] The information return submodule located in the communication module is used to return the corresponding verification success information to the main control chip if the first key verification value is the same as the second key verification value;

[0051] The channel establishment module located in the main control chip is used to establish an encrypted communication channel with the communication module corresponding to the session key in response to receiving the verification success information.

[0052] In some feasible implementations, the authentication module includes:

[0053] The information acquisition submodule located in the main control chip is used to generate a first random challenge value and acquire the device identifier of the Internet of Things device;

[0054] The information transmission submodule located in the main control chip is used to send the first random challenge value and the device identifier to the communication module through the data transmission channel;

[0055] The splicing submodule located in the communication module is used to generate a second random challenge value, and splice the first random challenge value, the second random challenge value and the device identifier to obtain a corresponding first data block;

[0056] The computing module located in the communication module is used to perform a hash operation on the first data block using a pre-shared key corresponding to the main control chip to obtain the authentication signature corresponding to the first data block.

[0057] The computing module located in the main control chip is used to concatenate the first random challenge value, the second random challenge value and the device identifier to obtain the corresponding second data block, and to perform a hash operation on the second data block using the pre-shared key to obtain the corresponding first hash value;

[0058] The verification module is used to verify that if the first hash value matches the authentication signature, the two-way authentication between the main control chip and the communication module is successful.

[0059] In some feasible implementations, the key generation module is specifically used for:

[0060] The first random challenge value, the second random challenge value, and the device identifier are concatenated to obtain the corresponding target data block;

[0061] The target data block is hashed using the pre-shared key between the main control chip and the communication module to obtain the corresponding second hash value;

[0062] Obtain the truncation information transmitted between the main control chip and the communication module through the data transmission channel, and truncate the second hash value according to the truncation information to obtain the intermediate key between the main control chip and the communication module.

[0063] In some feasible implementations, the key fragment generation module includes:

[0064] The transmission parameter acquisition submodule located in the main control chip is used to acquire the initial baud rate and synchronization header for the key segment, and send the initial baud rate and synchronization header to the communication module through the data transmission channel;

[0065] The encoding submodule located in the main control chip is used to encode the key fragment to obtain the corresponding bit stream, and transmit the bit stream to the communication module in the secure transmission channel according to the initial baud rate and the synchronization header;

[0066] The decoding submodule located in the communication module is used to establish bit synchronization with the main control chip in response to receiving the synchronization header, and to receive the bit stream, decode the bit stream, and obtain the key fragment.

[0067] Among some feasible implementation methods are:

[0068] The baud rate adjustment module is used to generate a baud rate adjustment instruction for the bit stream if there is a bit error rate during the transmission of the bit stream, and adjust the initial baud rate to the target baud rate according to the baud rate adjustment instruction.

[0069] Among some feasible implementation methods are:

[0070] The parameter transmission module is used to, if the two-way authentication is successful, have the main control chip obtain the key negotiation parameters for the communication module and synchronize the key negotiation parameters to the communication module through the data transmission channel;

[0071] The key negotiation parameters include at least one of the following: encryption algorithm type, key lifespan, challenge value length, and transmission baud rate.

[0072] Among some feasible implementation methods are:

[0073] The key update module is used to renegotiate the session key between the main control chip and the communication module if the usage time of the session key reaches the key life cycle, or if the amount of data transmitted between the main control chip and the communication module reaches a preset threshold.

[0074] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0075] The memory is used to store computer programs;

[0076] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.

[0077] This invention also discloses a readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the method described in this invention.

[0078] The embodiments of the present invention have the following advantages:

[0079] In this embodiment of the invention, the IoT device includes at least a main control chip and a communication module. A data transmission channel and a secure transmission channel can be established between the main control chip and the communication module. During data communication between the main control chip and the communication module, key negotiation can be performed first to enable encrypted communication based on the negotiated key. During key negotiation, the main control chip and the communication module first perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains a first random challenge value generated by the main control chip and the device identifier of the IoT device. The main control chip obtains a second random challenge value generated by the communication module, thus completing not only authentication but also the first exchange of key materials. Next, the main control chip and the communication module generate corresponding intermediate keys based on the first random challenge value, the second random challenge value, and the device identifier, respectively. Then, the main control chip generates a key fragment for the communication module and sends the key fragment to the communication module through a secure transmission channel. Finally, the main control chip and the communication module perform combination operations based on the intermediate key and the key fragment to obtain the session key for secure communication between the main control chip and the communication module. This enables bidirectional transmission of materials for constructing the session key, achieving data isolation and multi-stage parameter transmission and combination, thus building a hierarchical security protection system. This effectively raises the attack threshold, enhances key security, and effectively ensures the security of data transmission between the main control chip and the communication module. Attached Figure Description

[0080] Figure 1 This is a flowchart of the steps of a key processing method for an Internet of Things (IoT) device provided in an embodiment of the present invention;

[0081] Figure 2 This is a schematic diagram of the key negotiation process provided in an embodiment of the present invention. Detailed Implementation

[0082] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0083] As an example, in IoT devices, the communication security between the main control chip and the WiFi module is crucial. They typically communicate via a UART (Universal Asynchronous Receiver / Transmitter) interface. However, since UART itself lacks encryption capabilities, the communication process is vulnerable to security threats such as man-in-the-middle attacks and data theft. To address this, related technologies often employ pre-set fixed keys for data encryption to improve security. However, this method carries the risk of key leakage and cannot be dynamically updated, making it difficult to meet the requirements of high-security applications. Furthermore, some solutions attempt to introduce complex encryption algorithms, but due to the limited resources of the main control chip, this increases the system load and affects communication efficiency.

[0084] To address at least one of the aforementioned technical problems, this invention includes at least a main control chip and a communication module in the IoT device. Furthermore, a data transmission channel and a secure transmission channel can be established between the main control chip and the communication module. During data communication between the main control chip and the communication module, key negotiation can be performed first to enable encrypted communication based on the negotiated key. During key negotiation, the main control chip and the communication module first perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains a first random challenge value generated by the main control chip and the device identifier of the IoT device. The main control chip obtains a second random challenge value generated by the communication module, thus completing not only authentication but also the first exchange of key materials. Next, the main control chip and the communication module generate corresponding intermediate keys based on the first random challenge value, the second random challenge value, and the device identifier, respectively. Then, the main control chip generates a key fragment for the communication module and sends the key fragment to the communication module through a secure transmission channel. Finally, the main control chip and the communication module perform combination operations based on the intermediate key and the key fragment to obtain the session key for secure communication between the main control chip and the communication module. This enables bidirectional transmission of materials for constructing the session key, achieving data isolation and multi-stage parameter transmission and combination, thus building a hierarchical security protection system. This effectively raises the attack threshold, enhances key security, and effectively ensures the security of data transmission between the main control chip and the communication module.

[0085] Reference Figure 1 This diagram illustrates a flowchart of a key processing method for an IoT device according to an embodiment of the present invention. The IoT device includes at least a main control chip and a communication module. A data transmission channel and a secure transmission channel are established between the main control chip and the communication module. Specifically, the method may include the following steps:

[0086] Step 101: The main control chip and the communication module perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains the first random challenge value generated by the main control chip and the device identifier of the IoT device, and the main control chip obtains the second random challenge value generated by the communication module.

[0087] For IoT devices, they can be configured with corresponding main control chips and communication modules. The main control chip can be the core microcontroller in an embedded system, responsible for the device's local logic control (such as sensor data acquisition and actuator driving), as well as communication coordination with external modules. The communication module can be a communication module integrating wireless networking capabilities, connected to the main control chip via a UART interface, providing wireless data transmission capabilities. The relationship between the main control chip and the communication module can be "control core + communication extension." The main control chip sends commands or data to the communication module via UART, and the communication module uploads local data from the main control chip to the cloud or receives commands from the cloud and sends them back to the main control chip.

[0088] Optionally, the communication module can be a WiFi module, Bluetooth module, 4G module, 5G module, etc., and IoT devices can communicate with data through the corresponding communication module according to actual needs. Furthermore, the data transmission channel can be a transmission channel built on a UART interface, while the secure transmission channel can be a transmission channel built on a GPIO (General-Purpose Input / Output) interface. The UART interface can be used to handle the transmission of control commands and the interaction of initial negotiation information, enabling bidirectional communication between the main control chip and the WiFi module, such as sending key negotiation requests, transmitting device identifiers (DID), and challenge values ​​(C1), etc., which are low-sensitivity control information. The GPIO interface, on the other hand, serves as a physically isolated secure channel, specifically used for transmitting highly sensitive key fragments. Through hardware-level isolation design (a different physical line from UART), key information is prevented from being eavesdropped on and leaked by the UART link. Thus, UART handles the regular transmission of "control signaling," while GPIO handles the secure transmission of "key data," together forming a dual-channel collaborative mechanism to improve overall communication security.

[0089] For example, in a smart home scenario, the temperature and humidity sensor node's main control chip can periodically collect environmental data and send encrypted data requests to the WiFi module via the UART interface. The WiFi module then encrypts the data and uploads it to the cloud via a wireless network, enabling remote monitoring and other functions.

[0090] During the data communication process between the main control chip and the communication module, a corresponding encrypted channel can be constructed to ensure the security of data transmission. In the process of constructing the encrypted channel, the main control chip and the communication module can perform corresponding key negotiation to build a hierarchical security protection system, which effectively raises the attack threshold and improves the security of the key.

[0091] Key negotiation can be implemented in multiple stages, including at least two-way authentication, multi-channel transmission of key information, key combination, and secondary authentication. In the two-way authentication process, the identity of the other party is verified, and preliminary key material exchange is achieved. Specifically, the main control chip and the communication module perform two-way authentication through a data transmission channel. If the two-way authentication is successful, the communication module receives the first random challenge value generated by the main control chip and the device identifier of the IoT device, while the main control chip receives the second random challenge value generated by the communication module. This completes not only authentication but also the first exchange of key materials.

[0092] In some feasible implementations, for the two-way authentication process, the main control chip can first generate a first random challenge value and obtain the device identifier of the IoT device. Then, it sends the first random challenge value and the device identifier to the communication module through the data transmission channel. Correspondingly, the communication module generates a second random challenge value. Then, it combines the first random challenge value and the device identifier sent by the main control chip to obtain a corresponding first data block. Using the pre-shared key between the main control chip and the communication module, it performs a hash operation on the first data block to obtain the authentication signature corresponding to the first data block. Then, it sends the authentication signature and the second random challenge value to the main control chip. The main control chip can then combine the first random challenge value, the second random challenge value, and the device identifier to obtain a corresponding second data block. It also performs a hash operation on the second data block using the pre-shared key to obtain a corresponding first hash value. Then, it compares the first hash value with the authentication signature. If the first hash value matches the authentication signature, the two-way authentication between the main control chip and the communication module is successful. This not only completes the authentication between the main control chip and the communication module but also realizes the first key material exchange.

[0093] Among them, the main control chip and the communication module can agree on a corresponding random algorithm in advance so as to generate a corresponding random challenge value through the random algorithm. In addition, the pre-shared key can be the key built into the IoT device when it leaves the factory.

[0094] In one example, taking key negotiation between the main control chip and the WiFi module as an example, the two-way authentication process can be based on a lightweight encryption algorithm. Specifically, the main control chip first sends a key negotiation request to the WiFi module via UART. This request may include a random challenge value (C1) generated by the main control chip and a unique device identifier (DID). Upon receiving the request, the WiFi module generates its own random challenge value (C2) and performs an HMAC-SHA256 hash operation on "C1||DID||C2" using a pre-shared key. After generating an authentication signature, it returns it to the main control chip via UART, along with the corresponding random challenge value (C2). Upon receiving the authentication signature, the main control chip recalculates the HMAC-SHA256 hash value locally using the same pre-shared key and the concatenated data (i.e., "C1||DID||C2"). If the hash matches the received signature, authentication is successful, completing the initial identity verification. This process, through the dynamically generated challenge values ​​(C1, C2) and the hash verification of the pre-shared key, ensures the legitimacy of the devices participating in the communication and prevents impersonation by unauthorized devices.

[0095] Furthermore, after successful two-way authentication, the main control chip obtains the key negotiation parameters for the communication module and synchronizes the key negotiation parameters to the communication module through the data transmission channel. Thus, after both parties have confirmed each other's identities, they can agree on a unified and secure set of rules for subsequent encrypted communication to guide subsequent secure communication.

[0096] The key negotiation parameters include at least one of the following: encryption algorithm type, key lifespan, challenge value length, and transmission baud rate. The encryption algorithm type can be a symmetric encryption algorithm used in subsequent communication, such as AES-128 (Advanced Encryption Standard (128-bit)), AES-256 (Advanced Encryption Standard (256-bit)), or SM4 (Shang Mi 4 / Commercial Cryptography Standard). 4. The key lifecycle can be defined as the effective time or data volume of the generated session key, such as 10 minutes or after every 1MB of data transmitted; the challenge length can be defined as the byte length of the random challenge (Nonce) used in subsequent key negotiation or rotation, such as 10 bytes; the transmission baud rate can be the data transmission rate range used when transmitting key fragments through the GPIO secure channel, such as 50-115200bps. By agreeing on the corresponding key negotiation parameters between the main control chip and the communication module, the security foundation of encrypted communication is effectively defined, forward security is achieved, the randomness of the session is guaranteed, and it is adapted to the corresponding physical channel to ensure the reliability of key negotiation.

[0097] Step 102: The main control chip and the communication module generate corresponding intermediate keys based on the first random challenge value, the second random challenge value, and the device identifier, respectively.

[0098] During multi-channel key transmission, the key materials required to generate session keys can be transmitted through different transmission channels to avoid eavesdropping on the complete key information through the transmission channels.

[0099] After completing two-way authentication, the main control chip and the communication module can generate corresponding intermediate keys based on the first random challenge value, the second random challenge value, and the corresponding device identifier, and use the intermediate key as the key material for generating the session key.

[0100] In some feasible implementations, both the main control chip and the communication module can concatenate the first random challenge value, the second random challenge value, and the device identifier to obtain the corresponding target data block. Then, a hash operation is performed on the target data block using the pre-shared key between the main control chip and the communication module to obtain the corresponding second hash value. Next, the truncation information transmitted between the main control chip and the communication module through the data transmission channel is obtained, and the second hash value is truncated according to the truncation information to obtain the intermediate key between the main control chip and the communication module. For the main control chip, after generating the intermediate key, it can transmit the intermediate key to the communication module through the data transmission channel; for the communication module, after generating the intermediate key, it can transmit the intermediate key to the main control chip. To distinguish them, the intermediate key generated by the main control chip can be defined as the first intermediate key, and the intermediate key generated by the communication module can be defined as the second intermediate key. Other keys can also be defined, and this invention does not limit this.

[0101] It should be noted that when the first random challenge value, the second random challenge value, and the device identifier are the same, the second hash value generated by the main control chip and the communication module is consistent. In order to avoid data leakage caused by different intermediate keys, secondary authentication can be performed in the subsequent process of combining session keys to verify the consistency of the keys.

[0102] In some examples, the intermediate key K1 can be a key extracted from the temporary key generated during the initial key negotiation phase. It can be a truncated or derived version of the negotiation key generated by the main control chip and the WiFi module using the HMAC-SHA256 (Hash-based Message Authentication Code - SHA256) algorithm. In specific implementations, after concatenating the challenge values ​​(C1, C2) and device ID (DID) during the UART phase, the main control chip and the WiFi module can use the pre-shared key to calculate a 256-bit initial negotiation key K_initial (i.e., the negotiation key). Subsequently, both parties extract the first 128 bits (or truncate according to agreed rules) from K_initial as the intermediate key K1, used for dynamic challenge responses in subsequent authentication phases. It is understandable that the intermediate key K1 is not the initial final key, but a subset of the initial negotiation key. Its purpose is to provide an independent key source for the authentication phase, avoiding the direct use of the final session key for intermediate verification and reducing the risk of key leakage.

[0103] Step 103: The main control chip generates a key fragment for the communication module and sends the key fragment to the communication module through the secure transmission channel;

[0104] After generating the corresponding intermediate key, the main control chip can also generate a key fragment for the communication module and transmit the key fragment to the communication module through a secure transmission channel. Thus, during the key negotiation process, the main control chip and the communication module can transmit the intermediate key through the data transmission channel and the key fragment through the secure transmission channel, achieving physical isolation of the key materials, effectively raising the attack threshold, improving key security, and effectively ensuring the security of data transmission between the main control chip and the communication module.

[0105] In some feasible implementations, the key fragment can be randomly generated content by the main control chip. For this key fragment, the main control chip can obtain the initial baud rate and synchronization header, and send them to the communication module via a data transmission channel. The initial baud rate can be the transmission rate of the key fragment, and the synchronization header can be used to instruct the communication module to perform a bitstream synchronization process. Then, the main control chip can encode the key fragment to obtain the corresponding bitstream, and transmit the bitstream to the communication module via a secure transmission channel according to the initial baud rate and synchronization header. Correspondingly, the communication module, upon receiving the synchronization header, establishes bit synchronization with the main control chip, receives the bitstream, decodes the bitstream, and obtains the key fragment. Thus, during key negotiation, the main control chip and the communication module can transmit the intermediate key via the data transmission channel and the key fragment via the secure transmission channel, achieving physical isolation of the key materials, effectively raising the attack threshold, improving key security, and effectively ensuring the security of data transmission between the main control chip and the communication module.

[0106] Furthermore, if a bit error rate occurs during transmission, a baud rate adjustment command is generated for the bit stream, and the initial baud rate is adjusted to the target baud rate according to the command. This allows key segments to be transmitted based on the adjusted target baud rate, thereby improving the stability of key segment transmission.

[0107] In some examples, taking key negotiation between the main control chip and the WiFi module as an example, during the transmission of key segments by the main control chip through the GPIO interface, firstly, the main control chip can configure multiple GPIO pins used for data transmission (e.g., 8 pins, forming a parallel data bus) to open-drain output mode; simultaneously, it will configure 1 to 2 additional GPIO pins as dedicated control signal lines. Next, the main control chip sends a preparation command to the WiFi module through the UART interface, through which both parties negotiate and determine the initial parameters for GPIO transmission, mainly including the initial baud rate (e.g., 9600bps) and a specific bit pattern—a synchronization header—used to mark the start of data transmission. Then, the main control chip reads a small key segment (e.g., 8 bytes) from memory and processes this segment using differential Manchester encoding. This encoding method converts each bit into a defined level transition, thus providing excellent clock synchronization and anti-interference capabilities.

[0108] After encoding, the main control chip drives the encoded bit stream bit by bit through the GPIO data pins according to the current baud rate timing. In open-drain output mode, the main control chip can only actively pull the pin low to output "0", while the implementation of "1" relies on an external pull-up resistor to put the pin high. During transmission, the main control chip and the WiFi module work together to monitor the channel quality in real time, for example by detecting the error rate of the synchronization bit or CRC check failure. Once the error rate is found to be too high, the dynamic adjustment mechanism is activated: the main control chip will pause GPIO transmission and send a command such as "reduce baud rate" to the WiFi module through UART; both parties will then switch to a more robust rate according to the preset baud rate list (such as 115200 -> 9600 -> 1000), resynchronize at the new baud rate, and continue transmitting the remaining key fragments from the breakpoint.

[0109] Finally, in the final stage of transmission, the main control chip will continuously execute the data transmission process until all key fragments have been sent, and the transmission will end with a preset terminator. To ensure data integrity, a corresponding verification process can be performed after all transmissions are completed: the WiFi module sends the CRC-16 checksum of its reconstructed data back to the main control chip via UART. The main control chip compares and verifies the data locally. If they match, the GPIO transmission is considered successful; otherwise, the failed fragments may need to be retransmitted. After the transmission is completely finished, the main control chip will release the GPIO pin resources or reconfigure them to other modes for use by other system functions.

[0110] Accordingly, for the WiFi module, during the process of receiving key fragments through the GPIO interface, the WiFi module first configures its corresponding GPIO data pins to input mode and enables internal pull-up resistors to ensure that when the main control chip is in open-drain output mode and does not actively pull low, the pins can be stabilized at a high level through the pull-up resistors; at the same time, its control signal lines are also configured to input mode accordingly. After completing the hardware configuration, the WiFi module continuously listens to the GPIO data lines, waiting for the synchronization header signal sent by the main control chip; once the correct synchronization header mode is successfully detected, the WiFi module establishes bit synchronization with the main control chip and enters the state of preparing to receive valid data.

[0111] Subsequently, the process enters the core data decoding and adaptive adjustment stage. Based on the negotiated baud rate, the WiFi module precisely samples the GPIO data lines at the midpoint of each data bit. Utilizing the clock information inherent in differential Manchester encoding, it dynamically fine-tunes its sampling clock using the level transition at the beginning of each bit to compensate for any minor deviations that may exist between the crystal oscillators, thus ensuring the accuracy of the sampling timing. During decoding, the WiFi module compares the level of each sampled bit with the level of the previous bit, strictly adhering to the rules of differential Manchester encoding: if a level transition occurs at the beginning of the bit, it is decoded as bit "0"; if no transition is observed, it is decoded as bit "1". This mechanism, by focusing on relative level changes rather than absolute level values, effectively suppresses level drift during transmission, significantly enhancing the system's anti-interference capability. The decoded bitstream is then reassembled into bytes in groups of 8 bits (or a preset bit width) and sequentially stored in the receive buffer, gradually forming the key segment being received. If synchronization bit errors or CRC check failures are detected continuously during the decoding process, the WiFi module will actively send an error alarm to the main control chip via UART or respond to the adjustment command of the main control chip. Both parties will then pause GPIO transmission, coordinate to switch to a lower preset baud rate via UART, and after the WiFi module adjusts its own sampling frequency, it will resynchronize and continue to receive data at the new baud rate.

[0112] Finally, during the reassembly and final verification phase, when the WiFi module detects the terminator sent by the main control chip, it indicates that all key fragments have been transmitted. The module concatenates all received key fragments in transmission order or combines them according to a preset algorithm (such as XOR merging) to reconstruct the complete key information. To verify the integrity of the data, the WiFi module calculates the CRC-16 (16-bit Cyclic Redundancy Check) checksum of the reassembled complete key information and sends it to the main control chip via UART for final verification. If the main control chip replies with confirmation, it signifies that the GPIO receiving process has successfully ended, and the recovered key information is sent to the subsequent session key synthesis operation, laying the foundation for secure communication.

[0113] Step 104: The main control chip and the communication module perform combination operations based on the intermediate key and the key fragment respectively to obtain a session key for secure communication between the main control chip and the communication module.

[0114] After the main control chip and the communication module transmit their generated intermediate keys to each other via data transmission channels, and the main control chip transmits key fragments to the communication module via a secure transmission channel, both the main control chip and the communication module possess all the key materials used to compose the session key. They can then perform combination calculations based on the intermediate key and key fragments to obtain the session key for secure communication between them. This allows for bidirectional transmission of the materials used to construct the session key, achieving data isolation and multi-stage parameter transmission and combination. This constructs a hierarchical security protection system, effectively raising the attack threshold, enhancing key security, and ensuring the security of data transmission between the main control chip and the communication module.

[0115] Furthermore, the consistency of the session key generated by the main control chip and the communication module needs to be further verified. Optionally, the main control chip can generate a target random number for the session key and transmit the target random number to the communication module through the data transmission channel. Then, the main control chip and the communication module respectively verify the consistency of the session key using the target random number and the intermediate key. If the session key verification is successful, the main control chip and the communication module can perform encrypted communication using the session key.

[0116] In the specific implementation, for the consistency verification process of the session key, the main control chip uses an intermediate key and a target random number to perform a hash operation to generate a first key verification value for the session key, and sends the first key verification value to the communication module. Correspondingly, the communication module uses the intermediate key and the target random number to perform a hash operation to generate a second key verification value for the session key. Then, the main control chip can transmit the first key verification value to the communication module so that the communication module can compare its own generated second key verification value with the first key verification value generated by the other party. If the first key verification value and the second key verification value are the same, the communication module returns the corresponding verification success information to the main control chip. In response to receiving the verification success information, an encrypted communication channel corresponding to the session key is established between the main control chip and the communication module, thereby verifying the consistency of the key.

[0117] In some examples, during the session key verification process (which could also be a two-factor authentication process), the main control chip generates a random number N and sends it to the WiFi module via UART. Upon receiving the random number N, the WiFi module uses the intermediate key K1 as the key for the HMAC-SHA256 algorithm to hash the random number N, generating a hash value H_wifi = HMAC-SHA256(K1, N). Simultaneously, the main control chip also calculates the hash value H_main = HMAC-SHA256(K1, N) locally using the same intermediate key K1 and the random number N. The main control chip sends H_main to the WiFi module, which compares H_wifi with the received H_main. If they match, it returns "verification successful"; otherwise, it returns "verification failed." Conversely, the WiFi module can also generate a new random number M and send it to the main control chip. The main control chip calculates H_main = HMAC-SHA256(K1, M) and sends it back. The WiFi module then verifies consistency by locally calculating H_wifi = HMAC-SHA256(K1, M). This process ensures that only legitimate devices holding the same intermediate key K1 can generate consistent hash values ​​by leveraging the one-way nature of the HMAC algorithm and the confidentiality of the intermediate key K1, thereby verifying the consistency of the key.

[0118] Furthermore, during encrypted communication, if the session key reaches its lifespan, or if the amount of data transmitted between the main control chip and the communication module reaches a preset threshold, the main control chip and the communication module will renegotiate the session key. By setting a corresponding key generation cycle, the key update process can reuse the original negotiation mechanism, requiring only the generation of a new random challenge value and recalculation of the key. The old key automatically becomes invalid and is cleared from memory, preventing security risks arising from prolonged use.

[0119] It should be noted that the embodiments of the present invention include, but are not limited to, the examples described above. It is understood that those skilled in the art can make further settings according to actual needs under the guidance of the ideas in the embodiments of the present invention, and the present invention does not limit such settings.

[0120] In this embodiment of the invention, the IoT device includes at least a main control chip and a communication module. A data transmission channel and a secure transmission channel can be established between the main control chip and the communication module. During data communication between the main control chip and the communication module, key negotiation can be performed first to enable encrypted communication based on the negotiated key. During key negotiation, the main control chip and the communication module first perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains a first random challenge value generated by the main control chip and the device identifier of the IoT device. The main control chip obtains a second random challenge value generated by the communication module, thus completing not only authentication but also the first exchange of key materials. Next, the main control chip and the communication module generate corresponding intermediate keys based on the first random challenge value, the second random challenge value, and the device identifier, respectively. Then, the main control chip generates a key fragment for the communication module and sends the key fragment to the communication module through a secure transmission channel. Finally, the main control chip and the communication module perform combination operations based on the intermediate key and the key fragment to obtain the session key for secure communication between the main control chip and the communication module. This enables bidirectional transmission of materials for constructing the session key, achieving data isolation and multi-stage parameter transmission and combination, thus building a hierarchical security protection system. This effectively raises the attack threshold, enhances key security, and effectively ensures the security of data transmission between the main control chip and the communication module.

[0121] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are provided for illustrative purposes:

[0122] As an example, refer to Figure 2This diagram illustrates a key negotiation process provided in an embodiment of the present invention. Taking the key negotiation between the main control chip of an IoT device and a WiFi module as an example, in the first stage, the main control chip sends a key negotiation request to the WiFi module via UART. The request includes a random challenge value (C1) generated by the main control chip and a unique device identifier (DID). After receiving the request, the WiFi module generates its own random challenge value (C2) and performs an HMAC-SHA256 hash operation on "C1||DID||C2" using a pre-shared key. After generating an authentication signature, it returns it to the main control chip via UART. After receiving the signature, the main control chip recalculates the HMAC-SHA256 hash value locally using the same pre-shared key and concatenated data. If it matches the received signature, the authentication is successful, and the initial authentication is completed. This process ensures the legitimacy of the devices participating in the communication through the hash verification of the dynamically generated challenge values ​​(C1, C2) and the pre-shared key, preventing unauthorized devices from impersonating the device.

[0123] Furthermore, in the first phase, the key parameters exchanged between the main control chip and the WiFi module via the UART interface mainly include the encryption algorithm type (such as AES-128, AES-256), key length (such as 128 bits or 256 bits), initialization vector (IV) generation rules (such as dynamic generation logic based on timestamps or device unique identifiers), dynamic random number (Nonce) (used for one-time session key derivation), and protocol version number (such as TLS 1.2 or a custom security protocol version). These parameters are transmitted via UART in plaintext or lightweight encryption to negotiate the encryption rules and key derivation logic for subsequent communication, ensuring consensus on security policies between the two parties. Simultaneously, after successful two-way authentication, the main control chip and the WiFi module can each generate corresponding intermediate keys based on their respective key materials.

[0124] In the second phase, the main control chip sends the remaining key parameters through the GPIO interface. This interface serves as a physical isolation channel to prevent the complete key information from being eavesdropped on via UART. In the specific implementation, the key parameters transmitted by the main control chip through the GPIO interface mainly consist of key fragmentation (breaking the complete key into multiple segments, such as 8-byte segments) and dynamically supplemented parameters (such as challenge values ​​and random numbers required for session key derivation). GPIO, acting as a physical isolation channel, transmits these parameters using differential Manchester encoding or a custom timing protocol to prevent key leakage due to UART link eavesdropping. For example, the main control chip transmits key fragments alternately with high and low levels through GPIO pins. The WiFi module receives these fragments, reassembles the key, and combines them with the dynamic random numbers to complete the final generation of the session key.

[0125] During the transmission of key segments, the main control chip can not only encode the key segments using differential Manchester, but also dynamically adjust the baud rate to adapt to channel interference. Specifically, the dynamic baud rate adjustment process is based on real-time monitoring of channel quality. The implementation is as follows: Before transmitting key segments via GPIO, the main control chip and the WiFi module pre-agree on a set of selectable baud rates (e.g., 50bps, 1000bps, 9600bps, 115200bps). At the start of transmission, an intermediate value (e.g., 9600bps) is used by default. During transmission, both parties assess the suitability of the current baud rate by detecting the level transition error rate of the GPIO pins (e.g., the bit error rate exceeding a threshold). If a high bit error rate is detected (e.g., multiple consecutive level synchronization failures), a baud rate adjustment command is actively generated (e.g., sending "reduce baud rate" or "increase baud rate" control characters via UART). After confirmation by the receiver, the system switches to the next candidate baud rate (e.g., decreasing from 115200bps to 9600bps, or increasing from 9600bps to 19200bps). After adjustment, the clock is resynchronized, and the remaining key segments are transmitted. This process balances transmission efficiency and reliability by adapting to channel quality in real time.

[0126] Furthermore, during transmission, the main control chip and the communication module can synchronize the clock through GPIO level changes to ensure data alignment. After the key parameters are transmitted in fragments, the WiFi module can verify data integrity using CRC-16 to prevent transmission errors or tampering.

[0127] In the third stage, both parties can combine the key parameters received from UART and GPIO to generate the final session key and complete the key negotiation. Specifically, the key parameters are combined by sequentially concatenating or hashing the intermediate key parameters received from the UART interface (such as partial key fragments or auxiliary parameters transmitted through regular control commands) with the key fragments transmitted from the GPIO interface to generate the final session key used for encrypted communication. For example, if the parameters transmitted by UART are K_uart (such as metadata like encryption algorithm identifier and key length) and a partial key fragment F_uart, and the key fragments transmitted by GPIO are F_gpio1, F_gpio2…F_gpioom, then the combination process can be as follows: First, concatenate F_uart with all F_gpio in a fixed order to form a total fragment F_total (e.g., F_uart||F_gpio1||F_gpio2…), then perform an HMAC-SHA256 hash operation on F_total (using a pre-shared key or intermediate key K1), and the generated hash value is the final session key K_session; or directly use F_total as the session key (if the length meets the encryption algorithm requirements). The combination method needs to be agreed upon in advance during the negotiation phase (e.g., through device ID or fixed rules) to ensure that both parties generate the final key according to the same logic.

[0128] For the generated session key, the main control chip and the WiFi module can also perform authentication. Both parties combine the intermediate key K1 received from the UART with the key fragment transmitted via GPIO, and generate the final session key using the HMAC-SHA256 algorithm. The main control chip generates a random number N, calculates its hash value, and sends it to the WiFi module. The WiFi module returns the same calculation result to verify key consistency.

[0129] The intermediate key K1 is a temporary key generated during the initial key negotiation phase. It originates from a truncated or derived portion of the negotiation key generated by the main control chip and the WiFi module using the HMAC-SHA256 algorithm. Specifically, after concatenating the challenge values ​​(C1, C2) and device ID (DID) during the UART phase, the main control chip and the WiFi module use a pre-shared key to calculate a 256-bit initial negotiation key K_initial (i.e., the negotiation key mentioned in Q2). Subsequently, both parties extract the first 128 bits (or truncate them according to agreed rules) from K_initial as the intermediate key K1, which is used for dynamic challenge responses in subsequent authentication phases. The intermediate key K1 is not the initial final key, but a subset of the initial negotiation key. Its purpose is to provide an independent key source for the authentication phase, avoiding the direct use of the final session key for intermediate verification and reducing the risk of key leakage.

[0130] During the authentication phase, the main control chip generates a random number N and sends it to the WiFi module via UART. Upon receiving the random number N, the WiFi module uses the intermediate key K1 as the key for the HMAC-SHA256 algorithm to hash the random number N, generating a hash value H_wifi = HMAC-SHA256(K1, N). Simultaneously, the main control chip also calculates a hash value H_main = HMAC-SHA256(K1, N) locally using the same intermediate key K1 and the random number N. The main control chip sends H_main to the WiFi module, which compares H_wifi with the received H_main. If they match, the module returns "verification successful"; otherwise, it returns "verification failed." Conversely, the WiFi module can also generate a new random number M and send it to the main control chip. The main control chip calculates H_main = HMAC-SHA256(K1, M) and sends it back. The WiFi module then verifies consistency by locally calculating H_wifi = HMAC-SHA256(K1, M). This process ensures that only legitimate devices holding the same intermediate key K1 can generate consistent hash values ​​by leveraging the one-way nature of the HMAC algorithm and the confidentiality of the intermediate key K1, thereby verifying the consistency of the key.

[0131] Finally, if the verification is successful, a corresponding temporary encrypted channel can be established between the main control chip and the WiFi module; if it fails, the communication between the two parties will be terminated to prevent unauthorized access.

[0132] Furthermore, a key lifecycle can be set, such as triggering a key update process every 10 minutes or after every 1MB of data transmission. The update process reuses the original negotiation mechanism, requiring only the regeneration of the Challenge and recalculation of the key. Additionally, the old key automatically becomes invalid and is cleared from memory, preventing security risks caused by long-term use.

[0133] Through the above process, all keys are dynamically generated, independent of preset keys, thus avoiding the risk of key leakage. Simultaneously, the entire process supports dual-channel communication via UART and GPIO, and introduces a dynamic key rotation mechanism, making it suitable for various low-cost embedded devices and offering excellent security and scalability.

[0134] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0135] This invention also provides a key processing device for an Internet of Things (IoT) device. The IoT device includes at least a main control chip and a communication module. A data transmission channel and a secure transmission channel are established between the main control chip and the communication module. Specifically, the device may include the following modules:

[0136] The authentication modules located in the main control chip and the communication module are used to perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains the first random challenge value generated by the main control chip and the device identifier of the IoT device, and the main control chip obtains the second random challenge value generated by the communication module.

[0137] The key generation modules located in the main control chip and the communication module are respectively used to generate corresponding intermediate keys based on the first random challenge value, the second random challenge value and the device identifier;

[0138] The key fragment generation module located in the main control chip is used to generate key fragments for the communication module and send the key fragments to the communication module through the secure transmission channel;

[0139] The key combination modules located in the main control chip and the communication module are used to perform combination operations based on the intermediate key and the key fragment to obtain the session key for secure communication between the main control chip and the communication module.

[0140] Among some feasible implementation methods are:

[0141] The random number generation module located in the main control chip is used to generate a target random number for the session key and transmit the target random number to the communication module through the data transmission channel;

[0142] The key verification modules located in the main control chip and the communication module are used to verify the consistency of the session key using the target random number and the intermediate key. If the session key verification is successful, the main control chip and the communication module communicate encrypted using the session key.

[0143] In some feasible implementations, the key verification module includes:

[0144] The first verification value generation submodule located in the main control chip is used to perform a hash operation on the intermediate key and the target random number to generate a first key verification value for the session key, and send the first key verification value to the communication module.

[0145] The second verification value generation submodule located in the communication module is used to perform a hash operation on the intermediate key and the target random number to generate a second key verification value for the session key;

[0146] The information return submodule located in the communication module is used to return the corresponding verification success information to the main control chip if the first key verification value is the same as the second key verification value;

[0147] The channel establishment module located in the main control chip is used to establish an encrypted communication channel with the communication module corresponding to the session key in response to receiving the verification success information.

[0148] In some feasible implementations, the authentication module includes:

[0149] The information acquisition submodule located in the main control chip is used to generate a first random challenge value and acquire the device identifier of the Internet of Things device;

[0150] The information transmission submodule located in the main control chip is used to send the first random challenge value and the device identifier to the communication module through the data transmission channel;

[0151] The splicing submodule located in the communication module is used to generate a second random challenge value, and splice the first random challenge value, the second random challenge value and the device identifier to obtain a corresponding first data block;

[0152] The computing module located in the communication module is used to perform a hash operation on the first data block using a pre-shared key corresponding to the main control chip to obtain the authentication signature corresponding to the first data block.

[0153] The computing module located in the main control chip is used to concatenate the first random challenge value, the second random challenge value and the device identifier to obtain the corresponding second data block, and to perform a hash operation on the second data block using the pre-shared key to obtain the corresponding first hash value;

[0154] The verification module is used to verify that if the first hash value matches the authentication signature, the two-way authentication between the main control chip and the communication module is successful.

[0155] In some feasible implementations, the key generation module is specifically used for:

[0156] The first random challenge value, the second random challenge value, and the device identifier are concatenated to obtain the corresponding target data block;

[0157] The target data block is hashed using the pre-shared key between the main control chip and the communication module to obtain the corresponding second hash value;

[0158] Obtain the truncation information transmitted between the main control chip and the communication module through the data transmission channel, and truncate the second hash value according to the truncation information to obtain the intermediate key between the main control chip and the communication module.

[0159] In some feasible implementations, the key fragment generation module includes:

[0160] The transmission parameter acquisition submodule located in the main control chip is used to acquire the initial baud rate and synchronization header for the key segment, and send the initial baud rate and synchronization header to the communication module through the data transmission channel;

[0161] The encoding submodule located in the main control chip is used to encode the key fragment to obtain the corresponding bit stream, and transmit the bit stream to the communication module in the secure transmission channel according to the initial baud rate and the synchronization header;

[0162] The decoding submodule located in the communication module is used to establish bit synchronization with the main control chip in response to receiving the synchronization header, and to receive the bit stream, decode the bit stream, and obtain the key fragment.

[0163] Among some feasible implementation methods are:

[0164] The baud rate adjustment module is used to generate a baud rate adjustment instruction for the bit stream if there is a bit error rate during the transmission of the bit stream, and adjust the initial baud rate to the target baud rate according to the baud rate adjustment instruction.

[0165] Among some feasible implementation methods are:

[0166] The parameter transmission module is used to, if the two-way authentication is successful, have the main control chip obtain the key negotiation parameters for the communication module and synchronize the key negotiation parameters to the communication module through the data transmission channel;

[0167] The key negotiation parameters include at least one of the following: encryption algorithm type, key lifespan, challenge value length, and transmission baud rate.

[0168] Among some feasible implementation methods are:

[0169] The key update module is used to renegotiate the session key between the main control chip and the communication module if the usage time of the session key reaches the key life cycle, or if the amount of data transmitted between the main control chip and the communication module reaches a preset threshold.

[0170] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0171] In addition, this invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described key processing method embodiments for IoT devices and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0172] This invention also provides a readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the key processing method embodiments of the above-described Internet of Things (IoT) devices, achieving the same technical effects. To avoid repetition, it will not be described again here. The readable storage medium may be, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0173] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0174] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, EEPROM, Flash, and eMMC, etc.) containing computer-usable program code.

[0175] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0176] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0177] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0178] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0179] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0180] The present invention has provided a detailed description of a key processing method and a key processing device for an Internet of Things (IoT) device. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A key processing method for an Internet of Things (IoT) device, characterized in that, The IoT device includes at least a main control chip and a communication module, wherein a data transmission channel and a secure transmission channel are established between the main control chip and the communication module, and the method includes: The main control chip and the communication module perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains the first random challenge value generated by the main control chip and the device identifier of the IoT device, and the main control chip obtains the second random challenge value generated by the communication module. The main control chip and the communication module generate corresponding intermediate keys based on the first random challenge value, the second random challenge value, and the device identifier, respectively. The main control chip generates a key fragment for the communication module and sends the key fragment to the communication module through the secure transmission channel; The main control chip and the communication module perform combination operations based on the intermediate key and the key fragment respectively to obtain a session key for secure communication between the main control chip and the communication module.

2. The method according to claim 1, characterized in that, Also includes: The main control chip generates a target random number for the session key and transmits the target random number to the communication module through the data transmission channel. The main control chip and the communication module respectively verify the consistency of the session key using the target random number and the intermediate key. If the session key verification is successful, the main control chip and the communication module communicate encrypted using the session key.

3. The method according to claim 2, characterized in that, The main control chip and the communication module respectively verify the consistency of the session key using the target random number and the intermediate key. If the session key verification passes, the main control chip and the communication module perform encrypted communication using the session key, including: The main control chip performs a hash operation on the intermediate key and the target random number to generate a first key verification value for the session key, and sends the first key verification value to the communication module. The communication module performs a hash operation between the intermediate key and the target random number to generate a second key verification value for the session key. If the first key verification value is the same as the second key verification value, the communication module returns the corresponding verification success information to the main control chip; In response to receiving the verification success information, the main control chip establishes an encrypted communication channel with the communication module corresponding to the session key.

4. The method according to any one of claims 1 to 3, characterized in that, The main control chip and the communication module perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains a first random challenge value generated by the main control chip and the device identifier of the IoT device. The main control chip obtains a second random challenge value generated by the communication module, including: The main control chip generates a first random challenge value and obtains the device identifier of the IoT device; The main control chip sends the first random challenge value and the device identifier to the communication module through the data transmission channel; The communication module generates a second random challenge value, and concatenates the first random challenge value, the second random challenge value, and the device identifier to obtain a corresponding first data block; The communication module uses a pre-shared key corresponding to the main control chip to perform a hash operation on the first data block to obtain the authentication signature corresponding to the first data block. The main control chip concatenates the first random challenge value, the second random challenge value, and the device identifier to obtain a corresponding second data block, and performs a hash operation on the second data block using the pre-shared key to obtain a corresponding first hash value; If the first hash value matches the authentication signature, then the two-way authentication between the main control chip and the communication module is successful.

5. The method according to any one of claims 1 to 3, characterized in that, The step of generating a corresponding intermediate key based on the first random challenge value, the second random challenge value, and the device identifier includes: The first random challenge value, the second random challenge value, and the device identifier are concatenated to obtain the corresponding target data block; The target data block is hashed using the pre-shared key between the main control chip and the communication module to obtain the corresponding second hash value; Obtain the truncation information transmitted between the main control chip and the communication module through the data transmission channel, and truncate the second hash value according to the truncation information to obtain the intermediate key between the main control chip and the communication module.

6. The method according to any one of claims 1 to 3, characterized in that, Sending the key fragment to the communication module through the secure transmission channel includes: The main control chip acquires the initial baud rate and synchronization header for the key segment, and sends the initial baud rate and synchronization header to the communication module through the data transmission channel; The main control chip encodes the key fragment to obtain the corresponding bit stream, and transmits the bit stream to the communication module in the secure transmission channel according to the initial baud rate and the synchronization header; In response to receiving the synchronization header, the communication module establishes bit synchronization with the main control chip, receives the bit stream, decodes the bit stream, and obtains the key fragment.

7. The method according to claim 6, characterized in that, Also includes: If there is a bit error rate during the transmission of the bit stream, a baud rate adjustment instruction is generated for the bit stream, and the initial baud rate is adjusted to the target baud rate according to the baud rate adjustment instruction.

8. The method according to claim 1, characterized in that, Also includes: If the two-way authentication is successful, the main control chip obtains the key negotiation parameters for the communication module and synchronizes the key negotiation parameters to the communication module through the data transmission channel; The key negotiation parameters include at least one of the following: encryption algorithm type, key lifespan, challenge value length, and transmission baud rate.

9. The method according to claim 1, characterized in that, Also includes: If the session key is used for a period of time that reaches the key lifecycle, or if the amount of data transmitted between the main control chip and the communication module reaches a preset threshold, then the main control chip and the communication module will renegotiate the session key.

10. A key processing device for an Internet of Things (IoT) device, characterized in that, The IoT device includes at least a main control chip and a communication module. A data transmission channel and a secure transmission channel are established between the main control chip and the communication module. The device includes: The authentication modules located in the main control chip and the communication module are used to perform two-way authentication through the data transmission channel. If the two-way authentication is successful, the communication module obtains the first random challenge value generated by the main control chip and the device identifier of the IoT device, and the main control chip obtains the second random challenge value generated by the communication module. The key generation modules located in the main control chip and the communication module are respectively used to generate corresponding intermediate keys based on the first random challenge value, the second random challenge value and the device identifier; The key fragment generation module located in the main control chip is used to generate key fragments for the communication module and send the key fragments to the communication module through the secure transmission channel; The key combination modules located in the main control chip and the communication module are used to perform combination operations based on the intermediate key and the key fragment to obtain the session key for secure communication between the main control chip and the communication module.

11. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-9.

12. A readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Sensor network node authentication method, node, system, medium and equipment

    CN116208329A

  • OBD tamper-proof two-way verification method

    CN120811620A