Key negotiation method and device of Internet of Things equipment, equipment and medium

The method of generating and encrypting numerical values and server decrypting identity verification through IoT devices solves the security risks in the transmission of IoT devices' keys and realizes high security and low overhead key negotiation.

CN120474796APending Publication Date: 2025-08-12AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510716186.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

There is a risk of key leakage during the key transmission process of IoT devices, resulting in security issues such as counterfeiting or eavesdropping of devices.

Method used

The Internet of Things device generates a first numerical value and a second asymmetric key pair, encrypts the first numerical value through the first public key and sends it to the server. The server decrypts and generates the second numerical value using the pre-stored first private key. Both parties verify the identity through the public key encryption to determine the device key.

Benefits of technology

Improve the security of the key negotiation process, prevent keys from being stolen by third parties, ensure the legitimacy of device authentication and the randomness and security of keys, and reduce communication and storage overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120474796A_ABST
    Figure CN120474796A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a key negotiation method and device for Internet of Things equipment, equipment and a medium, and relates to the technical field of key negotiation. The method is executed by Internet of Things equipment, and comprises the following steps: generating a first numerical value, a second private key and a second public key; encrypting the first numerical value through a first public key to obtain first encrypted data; sending the first encrypted data and the second public key to a server, so that the server decrypts the first encrypted data through a pre-stored first private key to obtain the first numerical value, and the server encrypts the second numerical value and the first numerical value verification code through the second public key to obtain second encrypted data, the data is sent to the Internet of Things equipment; and if it is determined that the server decrypts the first numerical value according to a decryption result of the second encrypted data by a second private key, determining an equipment key according to the first numerical value and the second numerical value. According to the technical scheme, the security of the key in the key negotiation process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of key negotiation, and in particular to a key negotiation method, apparatus, device, and medium for an Internet of Things device. Background Art

[0002] IoT devices are ubiquitous in our daily lives. They use various sensors to sense environmental data and aggregate it on IoT platforms, providing them to clients. To prevent malicious devices from connecting to the platform and conducting destructive activities, IoT platforms typically need to receive cryptographic keys from IoT devices and verify their identities based on the key contents.

[0003] This approach requires the IoT platform to distribute a factory key and pre-install the same key on IoT devices when they leave the factory to verify the identity of the IoT devices. However, if the key is stolen during transmission, it could lead to a series of risks, such as device counterfeiting or eavesdropping. Summary of the Invention

[0004] The present invention provides a key negotiation method, apparatus, device, and medium for an IoT device, which can negotiate a key between an IoT device and an IoT platform, reduce the possibility of key leakage to a third party, and ensure the security of the key negotiation process.

[0005] According to one aspect of the present invention, a key negotiation method for an IoT device is provided, which is performed by the IoT device. The method includes:

[0006] Generate a first value, a second private key, and a second public key, wherein the second private key and the second public key are an asymmetric key pair;

[0007] Encrypting the first value using a first public key to obtain first encrypted data;

[0008] Sending the first encrypted data and the second public key as key agreement data to a server, so that the server decrypts the first encrypted data using a pre-stored first private key to obtain the first value, and encrypts the second value and the first value verification code using the second public key to obtain second encrypted data, and sends the data to the IoT device; the second value is generated by the server;

[0009] If it is determined that the server has decrypted the first value according to the decryption result of the second encrypted data using the second private key, the device key is determined according to the first value and the second value.

[0010] According to another aspect of the present invention, a key negotiation method for an IoT device is provided, which is executed by a server. The method includes:

[0011] If key agreement data sent by the IoT device is received, decrypting first encrypted data in the key agreement data using a pre-stored first private key to obtain a first value; the key agreement data includes the first encrypted data and a second public key; the second public key is generated by the IoT device; and the first encrypted data is obtained by encrypting the first value by the IoT device using the first public key;

[0012] Generate a second numerical value, and encrypt the second numerical value and the first numerical verification code using the second public key to obtain second encrypted data;

[0013] Sending the second encrypted data to the IoT device, so that the IoT device determines whether the server has decrypted the first value based on a decryption result of the second encrypted data using the second private key, and feedbacks to the server whether the second encrypted data is successfully decrypted;

[0014] If a message is received indicating that the IoT device has successfully decrypted the second encrypted data, the device key is determined based on the first value and the second value.

[0015] According to another aspect of the present invention, a key agreement device for an Internet of Things device is provided, which is configured in the Internet of Things device, and includes:

[0016] A data generation module, configured to generate a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair;

[0017] A first encrypted data determination module, configured to encrypt the first value using a first public key to obtain first encrypted data;

[0018] a key agreement data sending module, configured to send the first encrypted data and the second public key as key agreement data to a server, so that the server decrypts the first encrypted data using a pre-stored first private key to obtain the first value, and encrypts the second value and the first value verification code using the second public key to obtain second encrypted data, and sends the second encrypted data to the IoT device; the second value is generated by the server;

[0019] The first device key determination module is configured to determine a device key based on the first value and the second value if it is determined that the server has decrypted the first value based on the decryption result of the second encrypted data with the second private key.

[0020] According to another aspect of the present invention, a key agreement device for an Internet of Things device is provided, which is configured in a server and includes:

[0021] a first encrypted data decryption module, configured to, upon receiving key agreement data sent by an IoT device, decrypt first encrypted data in the key agreement data using a pre-stored first private key to obtain a first value; the key agreement data includes the first encrypted data and a second public key; the second public key is generated by the IoT device; and the first encrypted data is obtained by encrypting the first value by the IoT device using the first public key;

[0022] A second encrypted data determination module is configured to generate a second numerical value, and encrypt the second numerical value and the first numerical verification code using the second public key to obtain second encrypted data;

[0023] a second encrypted data sending module, configured to send the second encrypted data to the IoT device, so that the IoT device determines whether the server has decrypted the first value based on a decryption result of the second encrypted data using the second private key, and feeds back to the server whether the decryption of the second encrypted data is successful;

[0024] The second device key determination module is configured to determine the device key according to the first value and the second value upon receiving a message indicating that the IoT device has successfully decrypted the second encrypted data.

[0025] According to another aspect of the present invention, an electronic device is provided, comprising:

[0026] at least one processor; and,

[0027] a memory communicatively connected to the at least one processor; wherein,

[0028] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the key agreement method for an Internet of Things device described in any embodiment of the present invention.

[0029] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the key negotiation method for an Internet of Things device according to any embodiment of the present invention when executed.

[0030] The technical solution of the embodiment of the present application is executed by an IoT device, and includes: generating a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair; encrypting the first value using the first public key to obtain first encrypted data; sending the first encrypted data and the second public key as key agreement data to a server, so that the server decrypts the first encrypted data using a pre-stored first private key to obtain the first value; and encrypting the second value and the first value verification code using the second public key to obtain second encrypted data, which is sent to the IoT device; the second value is generated by the server; if the server is determined to have decrypted the first value based on the decryption result of the second encrypted data using the second private key, then determining the device key based on the first and second values. This technical solution stores the first private key in the server, so that the key agreement data is decrypted by the server and is not known to a third party, thereby preventing an attacker from eavesdropping on the key agreement message. Furthermore, since the third party does not have the first private key, it cannot decrypt the first value encrypted using the first public key and cannot impersonate the server (IoT platform). Therefore, the IoT device can determine the legitimacy of the IoT platform based on the first value verification code. The first and second values used to generate the device key in this technical solution are generated by the IoT device and the server respectively, rather than being unilaterally specified, which can better ensure the randomness and security of the key.

[0031] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 This is a flowchart of a key negotiation method for an IoT device performed by an IoT device according to the first embodiment of the present application;

[0034] Figure 2 This is a flowchart of a key negotiation method for an IoT device performed by an IoT device according to the second embodiment of the present application;

[0035] Figure 3This is a structural block diagram of an Internet of Things identity management system provided according to Example 2 of the present application;

[0036] Figure 4 This is a flowchart of a key negotiation method for an IoT device performed by a server according to the third embodiment of the present application;

[0037] Figure 5 This is a structural diagram of a key agreement device configured on an IoT device according to the fourth embodiment of the present application;

[0038] Figure 6 This is a structural diagram of a key agreement device for an Internet of Things device configured on a server according to the fifth embodiment of the present application;

[0039] Figure 7 This is a structural diagram of an electronic device that implements a key negotiation method for an Internet of Things device according to an embodiment of the present application. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0041] It should be noted that the terms "first", "second", "target", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0042] Example 1

[0043] Figure 1A flowchart of a key negotiation method for an IoT device is provided for the first embodiment of the present application. The embodiment of the present application is applicable to the case where a key is negotiated between an IoT device and an IoT platform. The method can be executed by a key negotiation device of the IoT device. The key negotiation device of the IoT device can be implemented in the form of hardware and / or software. The key negotiation device of the IoT device can be configured in the IoT device. Figure 1 As shown, the method is executed by an IoT device, and the method includes:

[0044] S110 , generate a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair.

[0045] The technical solution of the embodiments of the present application is applicable to situations where a device key is negotiated between an IoT device and an IoT platform located on a server. The device key is used for identity authentication between the IoT platform and the IoT device before data transmission. The IoT device and the server can communicate via a wireless network.

[0046] The first value can be a number generated by the IoT device and used for mutual identity verification between the IoT device and the server. The first value is also used together with the second value to generate a device key. The first value can be a random number, that is, the first value is a first random number. The second private key and the second public key are an asymmetric key pair generated by the IoT device. The second public key is used to encrypt data, and the second private key is used to decrypt data encrypted with the second public key.

[0047] Specifically, when the IoT device leaves the factory, it is necessary to determine the device key for verifying the identity between the IoT device and the server (the IoT platform is set up on the server). In this case, the IoT device can first generate a first value, specifically by generating a random number; it is also necessary to generate an asymmetric key pair, namely a second private key and a second public key.

[0048] S120: Encrypt the first value using a first public key to obtain first encrypted data.

[0049] In an embodiment of the present application, a first public key is pre-stored in the IoT device, and a first private key is pre-stored in the server. The first public key and the first private key form an asymmetric key pair.

[0050] Specifically, after obtaining the first numerical value, the first numerical value is encrypted using the first public key to obtain first encrypted data. In this case, the first encrypted data can only be decrypted by the server that has the first private key.

[0051] S130, sending the first encrypted data and the second public key as key agreement data to the server, so that the server decrypts the first encrypted data through the pre-stored first private key to obtain the first value, and enables the server to encrypt the second value and the first value verification code through the second public key respectively to obtain the second encrypted data, and send it to the Internet of Things device.

[0052] The second value is generated by the server and is used to generate a device key together with the first value. The second value may be a random number, that is, the second value is a second random number.

[0053] Specifically, after obtaining the first encrypted data, the first encrypted data and the second public key are packaged into key negotiation data, and the key negotiation data is sent to the server; in this case, after receiving the key negotiation data, since the first key is stored on it, the server can decrypt the first encrypted data in the key negotiation data through the first private key to obtain the first numerical value. After obtaining the first numerical value, the server processes the first numerical value to obtain a first numerical verification code, and then the server generates a second numerical value. Specifically, the second numerical value can be generated by generating a random number. The server then encrypts the second numerical value through the second public key. The server also encrypts the first numerical verification code through the second public key to obtain second encrypted data, which includes the encrypted second numerical value and the encrypted first numerical verification code; the server sends the second encrypted data to the Internet of Things device.

[0054] S140: If it is determined that the server has decrypted the first value according to the decryption result of the second encrypted data using the second private key, a device key is determined according to the first value and the second value.

[0055] Specifically, if the second encrypted data sent by the server is received, the second encrypted data is decrypted using the second private key to obtain a first numerical verification code and a second numerical value; it is determined whether the first numerical verification code matches the first numerical value. If they match, it is determined that the server has successfully decrypted the first encrypted data, and it can be determined that the server is a matching and trustworthy server; and then the device key is determined based on the first numerical value and the second numerical value, so as to perform identity authentication based on the device key before subsequent communication with the server.

[0056] The technical solution of the embodiment of the present application is executed by an IoT device, and includes: generating a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair; encrypting the first value using the first public key to obtain first encrypted data; sending the first encrypted data and the second public key as key agreement data to a server, so that the server decrypts the first encrypted data using a pre-stored first private key to obtain the first value; and encrypting the second value and the first value verification code using the second public key to obtain second encrypted data, which is sent to the IoT device; the second value is generated by the server; if the server is determined to have decrypted the first value based on the decryption result of the second encrypted data using the second private key, then determining the device key based on the first and second values. This technical solution stores the first private key in the server, so that the key agreement data is decrypted by the server and is not known to a third party, thereby preventing an attacker from eavesdropping on the key agreement message. Furthermore, since the third party does not have the first private key, it cannot decrypt the first value encrypted using the first public key and cannot impersonate the server (IoT platform). Therefore, the IoT device can determine the legitimacy of the IoT platform based on the first value verification code. The first and second values used to generate the device key in this technical solution are generated by the IoT device and the server respectively, rather than being unilaterally specified, which can better ensure the randomness and security of the key.

[0057] Example 2

[0058] Figure 2 This is a flowchart of a key negotiation method for an IoT device provided in Example 2 of the present application. This embodiment of the present application is optimized based on the above embodiment.

[0059] like Figure 2 As shown, the method is executed by an IoT device. The method of the embodiment of the present application specifically includes the following steps:

[0060] S210: Generate a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair.

[0061] S220: Encrypt the first value using a first public key to obtain first encrypted data.

[0062] S230, sending the first encrypted data and the second public key as key agreement data to the server, so that the server decrypts the first encrypted data through the pre-stored first private key to obtain the first value, and enables the server to encrypt the second value and the first value verification code through the second public key respectively to obtain the second encrypted data, and send it to the Internet of Things device.

[0063] The second value is generated by the server, and the first private key only exists in the server.

[0064] S240: Decrypt the second encrypted data sent by the server using the second private key to obtain a second numerical value and a first numerical value verification code.

[0065] Specifically, after receiving the second encrypted data sent by the server, since the second private key has been generated in step A210, the second encrypted data sent by the server can be decrypted using the second private key to obtain the second value and the first value verification code.

[0066] This solution is configured such that, since the second private key only exists in the IoT device, only the IoT device can decrypt the second encrypted data, thereby preventing the second encrypted data from being obtained and decrypted by a third party.

[0067] S250: If it is determined that the first numerical verification code matches the first numerical value, a message indicating that the second encrypted data has been successfully decrypted is sent to the server, so that the server determines the device key according to the first numerical value and the second numerical value.

[0068] Specifically, a determination is made as to whether the first numerical verification code matches the first numerical value. If so, the server is confirmed to be a server configured on the IoT platform and not a third party. This is because the first private key exists only on the server. If the first numerical verification code matches the first numerical value, the server has successfully decrypted the first numerical value, ensuring the server's identity.

[0069] Furthermore, if it is determined that the first numerical verification code matches the first numerical value, a message is sent to the server indicating that the second encrypted data has been successfully decrypted. In this case, both the server and the IoT device already know the first and second numerical values. Both parties can determine their device keys based on the first and second numerical values without having to send the device key. This greatly improves the security of the device key.

[0070] In an embodiment of the present application, optionally, the first numerical verification code is obtained by the server processing the first numerical value based on a hash function; accordingly, if it is determined that the first numerical verification code matches the first numerical value, a message is sent to the server that the second encrypted data has been successfully decrypted, so that the server determines the device key based on the first numerical value and the second numerical value, including: processing the first numerical value through a hash function to obtain a processing result; if the processing result is the same as the first numerical verification code, a message is sent to the server that the second encrypted data has been successfully decrypted.

[0071] Specifically, when determining whether the first numerical verification code matches the first numerical value, the first numerical value can be processed using a hash function to obtain a processing result; if the processing result is the same as the first numerical verification code, then the first numerical verification code is determined to match the first numerical value. This solution allows the IoT device to verify whether the server has decrypted the first numerical value, and the verification method is based on a hash function. Even if the server sends the first numerical verification code to the IoT device and it is intercepted by a third party, the third party cannot obtain the first numerical value, greatly improving the security of the key negotiation process.

[0072] S260: If a notification is received from the server that the device key has been updated, the device key is determined based on the first value and the second value; the server determines the device key based on the first value and the second value in the same way as the IoT device determines the device key.

[0073] Specifically, the server determines the device key based on the first value and the second value in the same way as the IoT device determines the device key based on the first value and the second value, so that both parties can obtain consistent device keys.

[0074] The technical solution of the embodiment of the present application encrypts the first value through the first public key, so that only the server can decrypt and obtain the first value. Similarly, the second value is encrypted by the server through the second public key, and only the IoT device can decrypt it through the second private key. Therefore, the first value and the second value are only known to the IoT device and the server. Compared with the method of unilaterally sending a random number and generating a key based on the random number, since the unilaterally sent random number is only controlled by one party, the unilateral random number generator can control the specific value of the generated device key. If the unilateral random number generator is attacked or there is a problem with the random number generator, the negotiated device key will not be controlled by the other party, and the other party can only passively accept it, so the security of the device key is relatively low. Therefore, the technical solution of the embodiment of the present application greatly improves the security of the device key determined based on the first value and the second value.

[0075] In addition, since the embodiment of the present application only transmits random numbers and public key encrypted data during the key negotiation process, the amount of data transmitted is less than the amount of data required to be transmitted based on the certificate authentication mechanism, which greatly reduces communication and storage overhead.

[0076] In a specific example, an IoT platform, an identity authentication module, a data management module, and a key negotiation module are configured on the server; the IoT identity management system is composed of the identity authentication module, the data management module, and the key negotiation module. The structural block diagram of the IoT identity management system can be seen in Figure 3In this specific example, the identity authentication module is used to provide external identity authentication services, receive the identity authentication request sent by the IoT device, make a request to the data management module to query the IoT device information, receive the device information returned by the data management module after passing the inspection, and use the device information to verify the identity authentication data. After the authentication is passed, the IoT device is allowed to access the IoT platform.

[0077] The data management module is used to store and update the legitimate IoT device data, receive requests from the identity authentication module to query IoT device data, and query the IoT device data, and the query returns the IoT device data to the backward identity authentication module; receive requests from the key negotiation module to update the device key, and update the IoT device data, and the update returns success information to the backward key negotiation module.

[0078] The key negotiation module is used to provide key negotiation services to the outside world, assist IoT devices in completing device key negotiation, and after the negotiation is completed, submit a request to the data management module to update the device key. After the data management module successfully updates the key, it notifies the IoT device of the key negotiation result and notifies the IoT platform to disconnect from the IoT device.

[0079] Regarding the identity authentication process, the steps are as follows:

[0080] S31. The IoT device uses the device identifier, timestamp, and device key to generate a first authentication code through a hash algorithm, assembles the device identifier, timestamp, and first authentication code to generate an identity authentication request, and sends the request to the IoT platform for identity authentication.

[0081] S32. After the IoT platform receives the identity authentication request from the IoT device, the identity authentication module verifies the identity authentication data to check whether the identity authentication data is complete, whether the timestamp is expired, and whether the device is repeatedly authenticated. After the verification is passed, a request for querying device information is made to the data management module.

[0082] S33. The data management module queries whether the IoT device in the legal IoT devices stored on the local end exists, and returns the device identifier and device key of the legal IoT device stored on the local end after the query is successful.

[0083] S34. Use the device identification and device key of the queried IoT device, as well as the received timestamp, to generate an authentication code corresponding to the legitimate IoT device using a hash algorithm, and return a successful verification result to the IoT platform if the authentication code calculated and generated by the identity authentication module is consistent with the first authentication code.

[0084] S33. After successful verification, the IoT platform allows the IoT device to establish a connection with it.

[0085] The device key negotiation process is as follows:

[0086] S41. The IoT device generates a first random number, a second private key, and a second public key.

[0087] S42. The IoT device initiates a key negotiation request to the IoT platform, where the key negotiation data includes the second public key and the first random number encrypted by the first public key.

[0088] S43. The key negotiation module processes the key negotiation request received by the Internet of Things platform, decrypts the key negotiation data using the first private key, and records the first random number after successful decryption.

[0089] S44. The key agreement module uses a hash function to calculate a hash value for the first random number as a first random number verification code, and generates a second random number, and sends the first random number verification code and the second random number encrypted by the second public key to the IoT device.

[0090] S45. After receiving the first random number verification code and the second random number encrypted by the second public key, the IoT device uses the second private key to decrypt the first random number verification code and the second random number, verifies the first random number verification code using the first random number, and notifies the IoT platform of successful decryption after verification.

[0091] S46. After the IoT platform receives the decryption success request, the key agreement module uses the first random number and the second random number to calculate a new device key using a preset update method, and applies to the data management module for updating the device key.

[0092] S47. The data management module receives the request for updating the device key, updates the device key of the IoT device in the legal IoT devices stored on the local end, and returns an update success result.

[0093] S48. After receiving the update success result, the key negotiation module sends a negotiation result confirmation notification to the IoT device.

[0094] S49. After receiving the negotiation result confirmation notification, the IoT device uses the first random number and the second random number to update the current device key of the IoT device using a preset update method to obtain a new device key.

[0095] Before the device key negotiation process, the key negotiation module generates and stores a public asymmetric key pair, where the public asymmetric key pair includes a first private key and a first public key.

[0096] During the key negotiation process, this technical solution requires that the first random number sent by the IoT device be encrypted using the first public key. The first private key is stored only within the IoT security authentication system and is not accessible to external third parties. This prevents attackers from eavesdropping on key negotiation messages and obtaining the negotiated device key. Furthermore, because attackers cannot decrypt the first random number encrypted with the first public key, the IoT device can verify the legitimacy of the IoT platform by verifying the first verification code, thus preventing man-in-the-middle attacks. Because the first and second random numbers used in key negotiation are generated by the device and the key negotiation module, respectively, rather than unilaterally specified, the randomness and security of the key are better guaranteed. Furthermore, the proposed key negotiation method only involves conventional asymmetric encryption algorithms, digest algorithms, and random number generation algorithms, placing low demands on the computing power of the IoT device. For example, if authentication is based on a certificate authentication mechanism, the certificate used is approximately 1-1.5 KB, resulting in excessive communication and storage overhead. However, the key negotiation method described herein transmits ciphertext of approximately 150 bytes (using the asymmetric encryption algorithm SM2 as an example, with a random number length of 64 bytes), significantly reducing communication and storage overhead. In summary, the key negotiation method in the embodiment of the present application comprehensively considers security and lightweight computing, ensuring the efficiency and security of the key negotiation method.

[0097] Example 3

[0098] Figure 4 A flowchart of a key negotiation method for an IoT device is provided for the third embodiment of the present application. The embodiment of the present application is applicable to the case of negotiating a key between an IoT device and an IoT platform. The method can be executed by a key negotiation device of the IoT device. The key negotiation device of the IoT device can be implemented in the form of hardware and / or software. The key negotiation device of the IoT device can be configured in a server. Figure 4 As shown, the method is executed by the server, and the method includes:

[0099] S310: If key negotiation data is received from an IoT device, the first encrypted data in the key negotiation data is decrypted using a pre-stored first private key to obtain a first value; the key negotiation data includes the first encrypted data and a second public key; the second public key is generated by the IoT device; the first encrypted data is obtained by encrypting the first value by the IoT device using the first public key.

[0100] Exemplarily, the first value is a first random number generated by the IoT device.

[0101] Exemplarily, during the key negotiation process, if key negotiation data sent by an IoT device is received, the first encrypted data in the key negotiation data is decrypted using a pre-stored first private key to obtain a first value, and the second public key in the key negotiation data is extracted.

[0102] S320: Generate a second numerical value, and encrypt the second numerical value and the first numerical verification code using the second public key to obtain second encrypted data.

[0103] Specifically, after obtaining the second value and the first value verification code, the second value and the first value verification code are encrypted using the second public key to obtain the second encrypted data.

[0104] In an embodiment of the present application, optionally, the process of determining the first numerical verification code includes: processing the first numerical value based on a hash function to obtain the first numerical verification code.

[0105] Exemplarily, a hash function is used to process the first numerical value to obtain a hash value, which is used as the first numerical verification code. This arrangement of the solution reduces the data size of the first numerical verification code, thereby reducing the overhead of data transmission and storage.

[0106] S330: Send the second encrypted data to the IoT device, so that the IoT device determines whether the server has decrypted the first value based on the decryption result of the second encrypted data using the second private key, and feeds back to the server whether the second encrypted data is decrypted successfully.

[0107] Specifically, the second encrypted data is sent to the IoT device, so that after the IoT device receives the second encrypted data sent by the server, the IoT device decrypts the second encrypted data through the second private key to obtain a first numerical verification code and a second numerical value; the IoT device determines whether the first numerical verification code matches the first numerical value. If so, it is determined that the server has successfully decrypted the first encrypted data, and it can be determined that the server is a match and a trustworthy server; the IoT device feeds back a message to the server whether the second encrypted data is successfully decrypted. If it is a message that it has been successfully decrypted, the step of determining the device key is entered.

[0108] S340: If a message is received indicating that the IoT device has successfully decrypted the second encrypted data, a device key is determined based on the first value and the second value.

[0109] Specifically, if a message is received that the IoT device has successfully decrypted the second encrypted data, it is determined that there is no problem with the identity of the IoT device, and the device key is determined based on the first value and the second value. At this point, the device key is updated on the server side.

[0110] In an embodiment of the present application, optionally, after determining the device key based on the first value and the second value, the method further includes: sending a notification to the Internet of Things device that the device key has been updated, so that the Internet of Things device determines the device key based on the first value and the second value; the server determines the device key based on the first value and the second value in the same manner as the Internet of Things device determines the device key.

[0111] The way in which the server determines the device key based on the first value and the second value is the same as the way in which the IoT device determines the device key, both of which are based on a preset update method, and the first random number and the second random number are processed to obtain the device key.

[0112] The technical solution of the embodiment of the present application is executed by a server, and the method includes: upon receiving key agreement data sent by an IoT device, decrypting first encrypted data in the key agreement data using a pre-stored first private key to obtain a first value; the key agreement data includes the first encrypted data and a second public key; the second public key is generated by the IoT device; the first encrypted data is obtained by the IoT device encrypting the first value using the first public key; generating a second value, and encrypting the second value and the first value verification code using the second public key to obtain second encrypted data; sending the second encrypted data to the IoT device, so that the IoT device determines whether the server has decrypted the first value based on the decryption result of the second encrypted data using the second private key, and feedbacks to the server whether the second encrypted data is successfully decrypted; upon receiving a message indicating that the IoT device has successfully decrypted the second encrypted data, determining the device key based on the first and second values. This technical solution stores the first private key in the server, so that the key agreement data is decrypted by the server and is not known to third parties, thereby preventing attackers from eavesdropping on key agreement messages to obtain key agreement information. Furthermore, since the third party does not have the first private key, it cannot decrypt the first value encrypted with the first public key, and thus cannot impersonate the server (IoT platform). Therefore, the IoT device can determine the legitimacy of the IoT platform through the first numerical verification code. The first and second numerical values used to generate the device key in this technical solution are generated by the IoT device and the server respectively, rather than unilaterally specified, which can better ensure the randomness and security of the key. The communication data of this technical solution is data encrypted with the public key and random numbers, etc., and its data volume is small, which reduces the overhead of data storage and communication.

[0113] Example 4

[0114] Figure 5 This is a schematic diagram of the structure of a key negotiation device for an Internet of Things device provided in the fourth embodiment of the present application. The device can execute the key negotiation method for an Internet of Things device performed by an Internet of Things device provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 5 As shown, the device is configured in an Internet of Things device, and the device includes:

[0115] A data generation module 410 is configured to generate a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair;

[0116] A first encrypted data determination module 420 is configured to encrypt the first value using a first public key to obtain first encrypted data;

[0117] The key agreement data sending module 430 is configured to send the first encrypted data and the second public key as key agreement data to the server, so that the server decrypts the first encrypted data using the pre-stored first private key to obtain the first value, and encrypts the second value and the first value verification code using the second public key to obtain second encrypted data, and sends the second encrypted data to the IoT device; the second value is generated by the server;

[0118] The first device key determination module 440 is configured to determine a device key based on the first value and the second value if it is determined that the server has decrypted the first value based on the decryption result of the second encrypted data with the second private key.

[0119] The technical solution of the embodiment of the present application is configured in an IoT device. The device includes: a data generation module 410 for generating a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair; a first encrypted data determination module 420 for encrypting the first value using the first public key to obtain first encrypted data; a key agreement data sending module 430 for sending the first encrypted data and the second public key as key agreement data to a server, so that the server decrypts the first encrypted data using a pre-stored first private key to obtain the first value; and the server encrypts the second value and the first value verification code using the second public key to obtain second encrypted data, which is then sent to the IoT device; the second value is generated by the server; and a first device key determination module 440 for determining a device key based on the first and second values if the server decrypts the second encrypted data using the second private key. This technical solution stores the first private key in the server, so that the key agreement data is decrypted by the server and cannot be obtained by a third party, thereby preventing attackers from eavesdropping on key agreement messages and obtaining key agreement information. Furthermore, since a third party lacks the first private key, they cannot decrypt the first value encrypted with the first public key and therefore cannot impersonate the server (IoT platform). Therefore, the IoT device can use the first value verification code to determine the legitimacy of the IoT platform. This technical solution generates the first and second values used to generate the device key, which are generated by the IoT device and server respectively, rather than unilaterally specified, thereby better ensuring the randomness and security of the key.

[0120] Optionally, the first device key determination module 440 includes:

[0121] a second encrypted data decryption unit, configured to decrypt the second encrypted data sent by the server using the second private key to obtain a second numerical value and a first numerical verification code;

[0122] a message sending unit, configured to send a message to the server indicating that the second encrypted data has been successfully decrypted if it is determined that the first numerical verification code matches the first numerical value, so that the server determines the device key based on the first numerical value and the second numerical value;

[0123] The first device key determination unit is configured to determine the device key based on the first value and the second value upon receiving a notification from the server indicating that the device key has been updated; the server determines the device key based on the first value and the second value in the same manner as the IoT device determines the device key.

[0124] Optionally, the first numerical verification code is obtained by the server processing the first numerical value based on a hash function;

[0125] Accordingly, the message sending unit is specifically used to:

[0126] Processing the first value using a hash function to obtain a processing result;

[0127] If the processing result is the same as the first numerical verification code, a message indicating that the second encrypted data has been successfully decrypted is sent to the server.

[0128] A key negotiation device for an IoT device provided in an embodiment of the present application can execute a key negotiation method for an IoT device performed by an IoT device provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.

[0129] Example 5

[0130] Figure 6 This is a structural diagram of a key negotiation device for an Internet of Things device provided in Example 5 of this application. The device can execute the key negotiation method for an Internet of Things device executed by a server provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 6 As shown, configured in a server, the device includes:

[0131] The first encrypted data decryption module 510 is configured to, upon receiving key agreement data sent by the IoT device, decrypt first encrypted data in the key agreement data using a pre-stored first private key to obtain a first value; the key agreement data includes the first encrypted data and a second public key; the second public key is generated by the IoT device; and the first encrypted data is obtained by encrypting the first value by the IoT device using the first public key.

[0132] A second encrypted data determination module 520 is configured to generate a second value, and encrypt the second value and the first value verification code using the second public key to obtain second encrypted data;

[0133] A second encrypted data sending module 530 is configured to send the second encrypted data to the IoT device, so that the IoT device determines whether the server has decrypted the first value based on the decryption result of the second encrypted data using the second private key, and feedback to the server whether the second encrypted data is successfully decrypted;

[0134] The second device key determination module 540 is configured to determine the device key according to the first value and the second value upon receiving a message indicating that the IoT device has successfully decrypted the second encrypted data.

[0135] The technical solution of the embodiment of the present application is configured in the server, and the device includes: a first encrypted data decryption module 510, which is used to decrypt the first encrypted data in the key negotiation data by using a pre-stored first private key to obtain a first value if key negotiation data sent by the Internet of Things device is received; the key negotiation data includes first encrypted data and a second public key; the second public key is generated by the Internet of Things device; the first encrypted data is obtained by the Internet of Things device encrypting the first value by using the first public key; a second encrypted data determination module 520, which is used to generate a second value, and encrypt the second value and the first value verification code by using the second public key to obtain second encrypted data; a second encrypted data sending module 530, which is used to send the second encrypted data to the Internet of Things device, so that the Internet of Things device determines whether the server has decrypted the first value based on the decryption result of decrypting the second encrypted data by using the second private key, and feeds back to the server whether the second encrypted data is successfully decrypted; a second device key determination module 540, which is used to determine the device key based on the first value and the second value if a message is received that the Internet of Things device has successfully decrypted the second encrypted data. This technical solution stores the first private key in the server so that the key negotiation data is decrypted by the server and is not known to a third party, thus preventing attackers from eavesdropping on the key negotiation message to obtain key negotiation information. Furthermore, since the third party does not have the first private key, it cannot decrypt the first numerical value encrypted with the first public key, and thus cannot impersonate the server (IoT platform). Therefore, the IoT device can judge the legitimacy of the IoT platform through the first numerical verification code. This technical solution generates the first numerical value and the second numerical value used for the device key, which are generated by the IoT device and the server respectively, rather than unilaterally specified, which can better ensure the randomness and security of the key. The communication data of this technical solution is data encrypted by the public key and random numbers, etc., and its data volume is relatively small, which reduces the overhead of data storage and communication.

[0136] Optionally, the device further comprises:

[0137] A key update notification sending module is used to send a notification that the device key has been updated to the Internet of Things device, so that the Internet of Things device determines the device key based on the first value and the second value; the way in which the server determines the device key based on the first value and the second value is the same as the way in which the Internet of Things device determines the device key.

[0138] Optionally, the device further includes: a first numerical verification code determination module, specifically configured to:

[0139] The first numerical value is processed based on a hash function to obtain a first numerical verification code.

[0140] A key negotiation device for an IoT device provided in an embodiment of the present application can execute a key negotiation method for an IoT device executed by a server provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.

[0141] Example 6

[0142] Figure 7 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0143] like Figure 7 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0144] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0145] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the key negotiation method for IoT devices.

[0146] In some embodiments, the key agreement method for an IoT device may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the key agreement method for an IoT device described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the key agreement method for an IoT device in any other appropriate manner (e.g., by means of firmware).

[0147] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0148] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0149] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0150] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0151] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0152] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0153] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0154] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A key negotiation method for an Internet of Things device, characterized in that: The method is performed by an IoT device and includes: Generate a first value, a second private key, and a second public key, wherein the second private key and the second public key are an asymmetric key pair; Encrypting the first value using a first public key to obtain first encrypted data; Sending the first encrypted data and the second public key as key agreement data to a server, so that the server decrypts the first encrypted data using a pre-stored first private key to obtain the first value, and encrypts the second value and the first value verification code using the second public key to obtain second encrypted data, and sends the data to the IoT device; the second value is generated by the server; If it is determined that the server has decrypted the first value according to the decryption result of the second encrypted data using the second private key, the device key is determined according to the first value and the second value.

2. The method according to claim 1, characterized in that If it is determined that the server has decrypted the first value based on the decryption result of the second encrypted data with the second private key, determining the device key based on the first value and the second value includes: Decrypting the second encrypted data sent by the server using the second private key to obtain a second value and a first value verification code; If it is determined that the first numerical verification code matches the first numerical value, sending a message to the server indicating that the second encrypted data has been successfully decrypted, so that the server determines the device key based on the first numerical value and the second numerical value; If a notification is received from the server that the device key has been updated, the device key is determined based on the first value and the second value; the server determines the device key based on the first value and the second value in the same way as the IoT device determines the device key.

3. The method according to claim 2, characterized in that The first numerical verification code is obtained by the server processing the first numerical value based on a hash function; Correspondingly, if it is determined that the first numerical verification code matches the first numerical value, a message indicating that the second encrypted data has been successfully decrypted is sent to the server, so that the server determines the device key based on the first numerical value and the second numerical value, including: Processing the first value using a hash function to obtain a processing result; If the processing result is the same as the first numerical verification code, a message indicating that the second encrypted data has been successfully decrypted is sent to the server.

4. A key negotiation method for an Internet of Things device, characterized in that: Executed by a server, the method includes: If key agreement data sent by the IoT device is received, decrypting first encrypted data in the key agreement data using a pre-stored first private key to obtain a first value; the key agreement data includes the first encrypted data and a second public key; the second public key is generated by the IoT device; and the first encrypted data is obtained by encrypting the first value by the IoT device using the first public key; Generate a second numerical value, and encrypt the second numerical value and the first numerical verification code using the second public key to obtain second encrypted data; Sending the second encrypted data to the IoT device, so that the IoT device determines whether the server has decrypted the first value based on a decryption result of the second encrypted data using the second private key, and feedbacks to the server whether the second encrypted data is successfully decrypted; If a message is received indicating that the IoT device has successfully decrypted the second encrypted data, the device key is determined based on the first value and the second value.

5. The method according to claim 4, characterized in that After determining the device key according to the first value and the second value, the method further includes: Sending a notification that the device key has been updated to the IoT device, so that the IoT device determines the device key based on the first value and the second value; the server determines the device key based on the first value and the second value in the same manner as the IoT device determines the device key.

6. The method according to claim 4, characterized in that The process of determining the first numerical verification code includes: The first numerical value is processed based on a hash function to obtain a first numerical verification code.

7. A key agreement device for an Internet of Things device, characterized in that: Configured in an IoT device, the device includes: A data generation module, configured to generate a first value, a second private key, and a second public key; the second private key and the second public key are an asymmetric key pair; A first encrypted data determination module, configured to encrypt the first value using a first public key to obtain first encrypted data; a key agreement data sending module, configured to send the first encrypted data and the second public key as key agreement data to a server, so that the server decrypts the first encrypted data using a pre-stored first private key to obtain the first value, and encrypts the second value and the first value verification code using the second public key to obtain second encrypted data, and sends the second encrypted data to the IoT device; the second value is generated by the server; The first device key determination module is configured to determine a device key based on the first value and the second value if it is determined that the server has decrypted the first value based on the decryption result of the second encrypted data with the second private key.

8. A key agreement device for an Internet of Things device, characterized in that: Configured in a server, the device includes: a first encrypted data decryption module, configured to, upon receiving key agreement data sent by an IoT device, decrypt first encrypted data in the key agreement data using a pre-stored first private key to obtain a first value; the key agreement data includes the first encrypted data and a second public key; the second public key is generated by the IoT device; and the first encrypted data is obtained by encrypting the first value by the IoT device using the first public key; A second encrypted data determination module is configured to generate a second numerical value, and encrypt the second numerical value and the first numerical verification code using the second public key to obtain second encrypted data; a second encrypted data sending module, configured to send the second encrypted data to the IoT device, so that the IoT device determines whether the server has decrypted the first value based on a decryption result of the second encrypted data using the second private key, and feeds back to the server whether the decryption of the second encrypted data is successful; The second device key determination module is configured to determine the device key according to the first value and the second value upon receiving a message indicating that the IoT device has successfully decrypted the second encrypted data.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the key negotiation method of the Internet of Things device executed by the Internet of Things device according to any one of claims 1 to 3; or execute the key negotiation method of the Internet of Things device executed by the server according to any one of claims 4 to 6.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, which are used to enable a processor to implement the key negotiation method of the Internet of Things device executed by the Internet of Things device according to any one of claims 1 to 3; or to implement the key negotiation method of the Internet of Things device executed by the server according to any one of claims 4 to 6.