Secure communication method and secure communication system based on Internet of Things
Establishing a secure communication channel in the Internet of Things through elliptic curve cryptography and blockchain technology solves the problems of key exchange and data transmission security between IoT devices, and realizes efficient data encryption and identity verification to prevent unauthorized Access and data breaches improve system security and efficiency.
Patent Information
- Application Number
- CN202411105236.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-22
AI Technical Summary
Secure communication between devices in the Internet of Things lacks efficient key exchange and update processes, resulting in the easy cracking of secure channels and high risks of unauthorized access and data leakage.
Using elliptic curve cryptography to form public and private keys, device registration and authentication is carried out through smart contracts and blockchain, secure channels are established for public key exchange and shared key verification, data transmission is encrypted using symmetric session keys, and through Message authentication codes and timestamps ensure data integrity and freshness.
Provides a powerful data encryption and authentication mechanism to effectively prevent unauthorized access and data leakage, improves efficiency and resource utilization, enhances the overall security and credibility of the system, and significantly enhances the defense of replay attacks. ability.
Smart Images

Figure CN119011115A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of secure communication of the Internet of Things, and in particular relates to a secure communication method based on the Internet of Things and a corresponding system. Background Art
[0002] With the rapid development of Internet of Things technology, various smart devices are widely interconnected, forming a huge data exchange network. However, this also brings severe security challenges. At present, the secure communication between devices in the Internet of Things lacks an efficient key exchange and update process. The Chinese invention patent application with application number 202280019393.3 discloses a point-to-point secure communication method for the Internet of Things. This method establishes a secure channel through a three-way handshake between the sender and the receiver, and transmits encrypted data, keys, signatures and other information through the secure channel. The receiver confirms the integrity of the received data and decrypts it after confirmation, thereby realizing point-to-point communication between the sender and the receiver. In this method, the encrypted data information and encryption key as well as the random key and signature data are sent in one message. Once the secure channel is destroyed, the transmitted message can be easily cracked. Summary of the invention
[0003] Purpose of the invention: The technical problem to be solved by the present invention is to provide a secure communication method based on the Internet of Things in view of the shortcomings of the prior art, which can effectively prevent unauthorized access and data leakage.
[0004] In order to solve the above technical problems, the present invention discloses a secure communication method based on the Internet of Things, comprising the steps of:
[0005] S1. Generate a pair of public and private keys when the device starts;
[0006] S2. Register the public key as the digital identity of the device with the smart contract and record it on the blockchain.
[0007] S3. When data is exchanged, a secure channel is established between the communication devices, public keys are exchanged through the secure channel, and a shared key pair is calculated and verified; after the shared key pair is successfully verified, a symmetric session key is negotiated;
[0008] S4. Encrypt the interactive data using the symmetric session key and send it;
[0009] S5. The data receiver uses the symmetric session key to decrypt the received data.
[0010] Specifically, in step S1, a pair of public key and private key is generated when the device is started, which specifically includes:
[0011] Generate a random number through a random number generator, and use an elliptic curve cryptographic algorithm to generate a device private key d according to the random number;
[0012] The device public key Q is generated by using elliptic curve cryptography point multiplication operation: Q=d·G; wherein G represents the base point of the elliptic curve, and · represents the elliptic curve cryptography point multiplication operation.
[0013] Specifically, the registration with the smart contract in step S2 specifically includes:
[0014] The device sends a registration request to the smart contract, and the registration request carries the public key of the device;
[0015] The smart contract verifies the validity and uniqueness of the public key in the registration request; upon successful verification, a record is created on the blockchain, binding the device’s public key and device information.
[0016] Specifically, the step S3 specifically includes the steps of:
[0017] S31. Both devices of the communicating parties send an authentication request to the smart contract, where the authentication request includes a device public key and signature data; the signature data is obtained by signing the device public key with the device private key;
[0018] S32. The smart contract searches for registered devices and verifies whether the signature in the authentication request matches the device public key recorded on the blockchain; if they match, a secure channel is established between the devices of both communicating parties.
[0019] S33, the communication initiator and the responder device exchange public keys through a secure channel;
[0020] S34: The communication initiator device calculates the first shared key K AB =d A Q B , where d A is the private key of the initiator device, Q B is the public key of the responder device, is the elliptic curve cryptography point multiplication operation, K AB is the first shared key;
[0021] Calculate the public key Q of the communication responder device B The hash value H QB , using the first shared key K AB For H QB Encrypt the ciphertext H′ QB Sending to the communication responder device;
[0022] The communication responder device calculates the second shared key K BA =d B Q A , where d Bis the private key of the responder device, Q A is the public key of the initiator device, is the elliptic curve cryptography point multiplication operation, K BA is the second shared key;
[0023] The communication responder device uses the second shared key K BA For the received ciphertext H′ QB Decrypt and get the decryption result if With d B The hash value H dB If they are equal, the shared key authentication is successful;
[0024] S35, after the shared key verification is successful, the communication initiator generates a symmetric session key and uses the public key Q B Encrypting the symmetric session key, and sending the encrypted symmetric session key to the communication responder;
[0025] The communication responder uses the private key d B Decrypt to obtain the symmetric session key.
[0026] Furthermore, when the session ends, the shared key pair is destroyed.
[0027] Furthermore, the step S4 also includes: the data sender uses a message authentication code algorithm to calculate the symmetric session key and the sent data to obtain a first message authentication code Mac, and the first message authentication code Mac and the encrypted sent data form a transmission message and send it to the data receiver;
[0028] The step S5 also includes: the data receiving party parses the first message authentication code Mac and the encrypted transmission data from the received transmission message; the data receiving party uses the message authentication code algorithm to obtain the second message authentication code Mac* from the symmetric session key and the decrypted transmission data;
[0029] If Mac* is equal to Mac, the authentication is successful and the transmitted message has not been tampered with.
[0030] Furthermore, the step S4 further includes: the data sender appends a current timestamp to the end of the encrypted data to form a transmission message;
[0031] The step S5 also includes: the data receiver parses the current timestamp from the received transmission message, checks the freshness of the timestamp, and determines whether it is within a preset receiving time window; if it exceeds the preset receiving time window, discards the received transmission message.
[0032] On the other hand, the present invention also discloses a secure communication system for implementing the secure communication method based on the Internet of Things, comprising:
[0033] The device initialization module is used to generate a pair of public and private keys when the device starts;
[0034] A registration module, which is used to register the public key as the digital identity of the device to the smart contract and record it on the blockchain;
[0035] A shared key and symmetric session key generation module is used to establish a secure channel between communication devices when data is exchanged, exchange public keys through the secure channel, calculate and verify the shared key pair; and negotiate the symmetric session key after the shared key pair is successfully verified;
[0036] An encryption module, used to encrypt and send the interactive data using the symmetric session key;
[0037] The decryption module is used to decrypt the received data using the symmetric session key.
[0038] Furthermore, it also includes a first message authentication module and a second message authentication module;
[0039] The first message authentication module is used to calculate the first message authentication code Mac using the symmetric session key and the sent data using a message authentication code algorithm;
[0040] The second message authentication module is used to use the message authentication code algorithm to obtain the second message authentication code Mac* from the symmetric session key and the decrypted sending data obtained by the data recipient; if Mac* is equal to Mac, the verification is successful and the transmitted message has not been tampered with.
[0041] Furthermore, it also includes a timestamp adding module and a timestamp freshness checking module;
[0042] The timestamp adding module is used to add the current timestamp at the end of the encrypted data;
[0043] The timestamp freshness checking module is used to check the freshness of the current timestamp parsed by the data receiver to determine whether it is within a preset receiving time window; if it exceeds the preset receiving time window, the received transmission message is discarded.
[0044] Beneficial effects: The secure communication method and secure communication system based on the Internet of Things disclosed in the present invention have the following advantages: 1. The present invention combines the efficient key exchange and hybrid encryption strategy of elliptic curve cryptography, that is, asymmetric encryption is used for key exchange, symmetric encryption is used for actual data transmission, the initiator uses the other party's public key to encrypt the symmetric session key, and then uses this session key to encrypt the data, which can provide a powerful data encryption and identity authentication mechanism, effectively prevent unauthorized access and data leakage, and the elliptic curve cryptography algorithm can achieve the same security strength with a shorter key length compared to traditional public key algorithms such as RSA, thereby improving efficiency and reducing resource consumption;
[0045] 2. In the present invention, the secure channel is used to exchange public keys, and subsequent transmissions can be transmitted through paths other than the secure channel. After the shared key verification is successful, the communication parties transmit the public key Q of the communication responder. B Encrypted symmetric session keys, and interactive data encrypted with symmetric session keys; even if the information is illegally obtained, since the private key of the communication responder cannot be known, the encrypted symmetric session key cannot be decrypted, and the encrypted interactive data cannot be decrypted, and no information leakage will occur.
[0046] 3. The present invention uses blockchain technology to assign a unique digital identity to each device, and combines smart contracts to automatically perform identity verification, which can improve the efficiency and security of identity verification, achieve transparent and tamper-proof management records, and enhance the overall security and credibility of the system;
[0047] 4. The present invention effectively ensures the integrity and freshness of data transmission by introducing timestamp and message verification code mechanism, significantly enhances the defense capability against replay attacks, and ensures the authenticity and timeliness of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.
[0049] Figure 1 It is a flow chart of the secure communication method based on the Internet of Things disclosed in the present invention;
[0050] Figure 2 The present invention is a schematic diagram of the composition of the secure communication system based on the Internet of Things disclosed in the present invention. DETAILED DESCRIPTION
[0051] The present invention discloses a secure communication method based on the Internet of Things. Figure 1 As shown, the steps include:
[0052] S1. Generate a pair of public and private keys when the device starts;
[0053] The present invention uses an elliptic curve cryptographic algorithm to generate a public key and a private key of a device, specifically: a random number is generated by a random number generator, and an elliptic curve cryptographic algorithm is used to generate a device private key d according to the random number;
[0054] The device public key Q is generated by using elliptic curve cryptography point multiplication operation: Q=d·G; wherein G represents the base point of the elliptic curve, and · represents the elliptic curve cryptography point multiplication operation.
[0055] Compared with traditional public key algorithms such as RSA, elliptic curve cryptography algorithms can achieve the same security strength with a shorter key length, improve efficiency and reduce resource consumption, and are suitable for situations where IoT devices have limited resources.
[0056] S2. Register the public key as the digital identity of the device to the smart contract and record it on the blockchain. The specific steps are:
[0057] After the device is started, it sends a registration request to the smart contract, and the registration request carries the public key of the device; the smart contract verifies the validity and uniqueness of the public key in the registration request; after successful verification, a record is created on the blockchain to bind the public key of the device to the device information. If the verification fails, it returns to step S1, regenerates the public key and private key, and ensures the uniqueness and validity of the public key of the device, that is, the digital identity of the device on the blockchain. In this way, the smart contract is combined to automatically perform identity authentication and access control, which not only improves the efficiency and security of identity authentication, but also realizes transparent and tamper-proof permission management records, and enhances the overall security and credibility of the system. The private key of the device is securely stored by the device and used to sign transactions. Different roles and permission levels are defined in the smart contract, and corresponding access rights are assigned to each device or user group. All identity authentication and access control operations are recorded on the blockchain to form an unalterable log.
[0058] S3. When data is exchanged, a secure channel is established between the communication devices, public keys are exchanged through the secure channel, and a shared key pair is calculated and verified; after the shared key pair is successfully verified, a symmetric session key is negotiated; specifically, the steps include:
[0059] S31. Both devices of the communicating parties send an authentication request to the smart contract, where the authentication request includes a device public key and signature data; the signature data is obtained by signing the device public key with the device private key;
[0060] S32. The smart contract searches for registered devices and verifies whether the signature in the authentication request matches the device public key recorded on the blockchain; if they match, the authenticity of the device identity is confirmed and a secure channel is established between the communicating devices.
[0061] If they do not match, the device needs to resend the authentication request; after multiple authentication failures, the device needs to re-execute steps S1 and S2 to generate the public key and private key again, and register them to ensure the correct establishment of the secure communication channel between devices;
[0062] S33, the communication initiator and the responder device exchange public keys through a secure channel;
[0063] S34: The communication initiator device calculates the first shared key K AB =d A Q B , where d A is the private key of the initiator device, Q B is the public key of the responder device, is the elliptic curve cryptography point multiplication operation, K AB is the first shared key;
[0064] Calculate the public key Q of the communication responder device B The hash value H QB , using the first shared key K AB For H QB Encrypt the ciphertext H′ QB Sending to the communication responder device;
[0065] The communication responder device calculates the second shared key K BA =d B Q A , where d B is the private key of the responder device, Q A is the public key of the initiator device, is the elliptic curve cryptography point multiplication operation, K BA is the second shared key;
[0066] The communication responder device uses the second shared key K BA For the received ciphertext H′ QB Decrypt and get the decryption result if With d B The hash value H dB If they are equal, the shared key authentication is successful;
[0067] S35, after the shared key verification is successful, the communication initiator generates a symmetric session key and uses the public key Q B Encrypting the symmetric session key, and sending the encrypted symmetric session key to the communication responder;
[0068] The communication responder uses the private key d B Decrypt to obtain the symmetric session key.
[0069] S4. Encrypt the interactive data using the symmetric session key and send it;
[0070] S5. The data receiver uses the symmetric session key to decrypt the received data.
[0071] The data sender uses the symmetric session key to encrypt the data to be sent, and the encrypted data is used as the transmission message; the data receiver uses the symmetric session key to decrypt the encrypted data to obtain the decrypted sending data.
[0072] In this embodiment, in order to ensure the integrity and freshness of the transmitted message, a message authentication code and a timestamp are added to the transmitted message. Specifically:
[0073] The step S4 also includes: the data sender uses a message authentication code algorithm to calculate the symmetric session key and the sent data to obtain a first message authentication code Mac, and the first message authentication code Mac, the encrypted sent data and the current timestamp form a transmission message and send it to the data receiver;
[0074] The step S5 further comprises: the data receiving party parses the first message authentication code Mac, the encrypted transmission data and the current timestamp from the received transmission message;
[0075] The data recipient uses a message authentication code algorithm to combine the symmetric session key and the decrypted transmission data to obtain a second message authentication code Mac*; if Mac* is equal to Mac, the verification is successful and the transmission message has not been tampered with.
[0076] Check the freshness of the parsed timestamp to determine whether it is within the preset receiving time window; if it exceeds the preset receiving time window, discard the received transmission message to prevent replay attacks.
[0077] When the session ends, the shared key pair K AB and K BA Destroy it and re-generate a new shared key during the next communication.
[0078] In the secure communication method disclosed in the present invention, the secure channel is used to exchange public keys, and subsequent transmissions can be transmitted through paths outside the secure channel. After the shared key verification is successful, the communication parties transmit the public key Q of the communication responder. BEncrypted symmetric session keys, and interactive data encrypted with symmetric session keys; even if the information is illegally obtained, the encrypted symmetric session keys cannot be decrypted because the private key of the communication responder cannot be known, and the encrypted interactive data cannot be decrypted, and information leakage will not occur. Transmission through paths outside the secure channel can dynamically select the optimal path according to the network status of the Internet of Things, reduce latency, and integrate fault detection and recovery mechanisms. By monitoring the network status in real time, the faulty link can be quickly identified and bypassed. During data analysis, random noise is added to sensitive data through differential privacy. By controlling the privacy budget, privacy protection and data practicality are balanced to achieve data anonymization.
[0079] The present invention also discloses a secure communication system for realizing the secure communication method based on the Internet of Things, such as Figure 2 As shown, including:
[0080] Device initialization module 1, used to generate a pair of public key and private key when the device is started according to step S1;
[0081] A registration module 2, configured to register the public key as the digital identity of the device with the smart contract according to step S2, and record it on the blockchain;
[0082] A shared key and symmetric session key generation module 3 is used to establish a secure channel between communication devices when performing data interaction according to step S3, perform public key exchange through the secure channel, calculate and verify the shared key pair; and negotiate the symmetric session key after the shared key pair is successfully verified;
[0083] An encryption module 4, used to encrypt and send the interactive data using the symmetric session key;
[0084] The decryption module 5 is used to decrypt the received data using the symmetric session key.
[0085] In this embodiment, it also includes a first message authentication module 6-1, a second message authentication module 6-2, a timestamp adding module 7-1 and a timestamp freshness checking module 7-2;
[0086] The first message authentication module 6-1 is used to calculate the first message authentication code Mac using the symmetric session key and the sent data using a message authentication code algorithm;
[0087] The second message authentication module 6-2 is used to use the message authentication code algorithm to obtain the second message authentication code Mac* from the symmetric session key and the decrypted sending data obtained by the data recipient; if Mac* is equal to Mac, the verification is successful and the transmitted message has not been tampered with.
[0088] The timestamp adding module 7-1 is used to add the current timestamp at the end of the encrypted data;
[0089] The timestamp freshness checking module 7-2 is used to check the freshness of the current timestamp parsed by the data receiver to determine whether it is within a preset receiving time window; if it exceeds the preset receiving time window, the received transmission message is discarded.
[0090] The present invention provides a thought and method. There are many methods and ways to implement the technical solution. The above is only the preferred implementation of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.
Claims
1. A secure communication method based on the Internet of Things, characterized in that: Includes steps: S1. Generate a pair of public and private keys when the device starts; S2. Register the public key as the digital identity of the device with the smart contract and record it on the blockchain. S3. When data is exchanged, a secure channel is established between the communication devices, public keys are exchanged through the secure channel, and a shared key pair is calculated and verified; after the shared key pair is successfully verified, a symmetric session key is negotiated; S4. Encrypt the interactive data using the symmetric session key and send it; S5. The data receiver uses the symmetric session key to decrypt the received data.
2. The secure communication method based on the Internet of Things according to claim 1, characterized in that: In step S1, a pair of public and private keys are generated when the device is started, specifically including: Generate a random number through a random number generator, and use an elliptic curve cryptographic algorithm to generate a device private key d according to the random number; The device public key Q is generated by using elliptic curve cryptography point multiplication operation: Q=d·G; wherein G represents the base point of the elliptic curve, and · represents the elliptic curve cryptography point multiplication operation.
3. The secure communication method based on the Internet of Things according to claim 1, characterized in that: The step S2 of registering with the smart contract specifically includes: The device sends a registration request to the smart contract, and the registration request carries the public key of the device; The smart contract verifies the validity and uniqueness of the public key in the registration request; upon successful verification, a record is created on the blockchain, binding the device’s public key and device information.
4. The secure communication method based on the Internet of Things according to claim 1, characterized in that: The step S3 specifically comprises the following steps: S31. Both devices of the communicating parties send an authentication request to the smart contract, where the authentication request includes a device public key and signature data; the signature data is obtained by signing the device public key with the device private key; S32. The smart contract searches for registered devices and verifies whether the signature in the authentication request matches the device public key recorded on the blockchain; if they match, a secure channel is established between the devices of both communicating parties. S33, the communication initiator and the responder device exchange public keys through a secure channel; S34: The communication initiator device calculates the first shared key K AB =d A Q B , where d A is the private key of the initiator device, Q B is the public key of the responder device, is the elliptic curve cryptography point multiplication operation, K AB is the first shared key; Calculate the public key Q of the communication responder device B The hash value H QB , using the first shared key K AB For H QB Encrypt the ciphertext H′ QB Sending to the communication responder device; The communication responder device calculates the second shared key K BA =d B Q A , where d B is the private key of the responder device, Q A is the public key of the initiator device, is the elliptic curve cryptography point multiplication operation, K BA is the second shared key; The communication responder device uses the second shared key K BA For the received ciphertext H′ QB Decrypt and get the decryption result if With d B The hash value H dB If they are equal, the shared key authentication is successful; S35, after the shared key verification is successful, the communication initiator generates a symmetric session key and uses the public key Q B Encrypting the symmetric session key, and sending the encrypted symmetric session key to the communication responder; The communication responder uses the private key d B Decrypt to obtain the symmetric session key.
5. The secure communication method based on the Internet of Things according to claim 1, characterized in that: When the session ends, the shared key pair is destroyed.
6. The secure communication method based on the Internet of Things according to claim 1, characterized in that: The step S4 also includes: the data sender uses a message authentication code algorithm to calculate the symmetric session key and the sent data to obtain a first message authentication code Mac, and the first message authentication code Mac and the encrypted sent data form a transmission message and send it to the data receiver; The step S5 further includes: the data receiving party parses the first message authentication code Mac and the encrypted transmission data from the received transmission message; The data receiver uses the message authentication code algorithm to obtain the second message authentication code Mac* by combining the symmetric session key and the decrypted transmission data; If Mac* is equal to Mac, the authentication is successful and the transmitted message has not been tampered with.
7. The secure communication method based on the Internet of Things according to claim 1, characterized in that: The step S4 also includes: the data sender appends a current timestamp to the end of the encrypted data to form a transmission message; The step S5 also includes: the data receiver parses the current timestamp from the received transmission message, checks the freshness of the timestamp, and determines whether it is within a preset receiving time window; if it exceeds the preset receiving time window, discards the received transmission message.
8. A secure communication system based on the Internet of Things, characterized in that: include: The device initialization module is used to generate a pair of public and private keys when the device starts; A registration module, which is used to register the public key as the digital identity of the device to the smart contract and record it on the blockchain; A shared key and symmetric session key generation module is used to establish a secure channel between communication devices when data is exchanged, exchange public keys through the secure channel, calculate and verify the shared key pair; and negotiate the symmetric session key after the shared key pair is successfully verified; An encryption module, used to encrypt and send the interactive data using the symmetric session key; The decryption module is used to decrypt the received data using the symmetric session key.
9. The secure communication system based on the Internet of Things according to claim 8, characterized in that: Also includes a first message authentication module and a second message authentication module; The first message authentication module is used to calculate the first message authentication code Mac using the symmetric session key and the sent data using a message authentication code algorithm; The second message authentication module is used to obtain a second message authentication code Mac* by using a message authentication code algorithm to obtain the decrypted sending data obtained by the symmetric session key and the data receiving party; If Mac* is equal to Mac, the authentication is successful and the transmitted message has not been tampered with.
10. The secure communication system based on the Internet of Things according to claim 8, characterized in that: It also includes a timestamp adding module and a timestamp freshness checking module; The timestamp adding module is used to add the current timestamp at the end of the encrypted data; The timestamp freshness checking module is used to check the freshness of the current timestamp parsed by the data receiving party, and determine whether it is within a preset receiving time window; If the preset receiving time window is exceeded, the received transmission message is discarded.
Citation Information
Cited By
Access control method and system of intelligent door lock
CN119339467A
Dual-mode communication network identity authentication method based on HPLC and HRF
CN119696893A
Integrated information security system supporting multi-platform environment
CN119835079A
Public key legality verification method and device based on asymmetric encryption algorithm, equipment and medium
CN121486081A
