A secure way to exchange keys
By using preset keys and real-time updated authentication key exchange methods in network communications, combined with asymmetric and symmetric encryption algorithms, the existing technology problems of dependence on authentication centers and difficulty in key update are solved, achieving security and Risk-reduced authentication and key exchange.
Patent Information
- Application Number
- CN202410824243.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-25
AI Technical Summary
The existing technology relies on the authentication center for identity authentication in network communications, which has security risks and difficulty in key update. In addition, the pre-shared key is difficult to update and easily leaked.
Adopt a secure key exchange method, perform initial authentication through preset keys, combine asymmetric encryption algorithms and symmetric encryption algorithms, update the authentication keys in real time, realize identity authentication and key exchange of both parties, and reduce dependence on the certification center and the risk of key leakage.
Identity authentication can be completed without relying on a certification center, which reduces the difficulty of key maintenance and improves security. It also reduces the risk of leakage by updating the authentication key in real time, ensuring that even if the authentication key is leaked, the attacker cannot obtain the shared key.
Smart Images

Figure CN118400186B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of confidential communication, and in particular to a secure key exchange method. Background Art
[0002] In network communication, in order to ensure the security of information transmission between the two communicating parties, symmetric encryption algorithms are usually used to encrypt the transmitted data. Before data transmission, a shared key for data encryption needs to be established between the two parties. Currently, asymmetric encryption is more popular to securely transmit shared keys, but in order to confirm the authenticity of the public key, this method usually requires identity authentication by a certification center (CA), and communication with the CA needs to go through a public channel, which brings additional security risks to the internal network; and the certificate cannot be updated in real time. If it is updated too often, the risk of being cracked will increase.
[0003] Another way to transmit keys is to use a pre-shared key (PSK), which means that the key is distributed to the communication partner in a secure way before the communication begins. The disadvantage of this method is that it is difficult to update the key, which often needs to be updated manually. And it relies on the confidentiality of the key. Once the key is leaked, the information transmitted using the key can be stolen by attackers. Summary of the invention
[0004] In view of the above defects in the prior art, the present invention proposes a secure key exchange method.
[0005] The technical solution of the present invention is achieved in this way:
[0006] A secure key exchange method. Before the initial communication, both parties obtain the preset key in a secure way and distribute it to A and B in a secure way as their initial authentication key. A is the initiator of the communication and B is the responder of the communication. After each communication starts, A and B exchange keys according to the following steps:
[0007] 1) A and B synchronize the authentication keys so that both authentication keys are updated to the latest value s determined in the last key exchange process;
[0008] 2) A generates the public key PK of the asymmetric encryption algorithm A and private key SK A , PK A And its hash value is encrypted with s using a symmetric encryption algorithm to obtain the ciphertext c A , the ciphertext c A Send to B;
[0009] 3) B uses s to ciphertext c A Decryption, the obtained PK ACalculate the hash value and compare the result with the hash value obtained by decrypting with s. If the hash values are the same, it can be determined that the information has not been tampered with and A's identity is legitimate. Then B generates the public key PK B and private key SK B , then randomly generate a shared key KB and update the authentication key to s', and then use PK A PK A , KB, s' and the hash value of KB and s' are encrypted to obtain the ciphertext c BA , c BA Send to A;
[0010] 4) A uses SK A C BA Decryption, the PK obtained A Generate PK at the beginning A The values of are compared. If they are the same, B's identity can be confirmed, and then s' and KB can be solved. At this point, A completes the acquisition of KB.
[0011] 5) A determines whether the information has been tampered with by the hash value, then updates the authentication key to s', and then uses PK B PK B , KA, s' and the hash value of KA and s' are encrypted to obtain the ciphertext c AB , c AB Send it to B, and pass the decrypted PK B Compare it with the value generated by B at the beginning to confirm A's identity, and B decrypts the ciphertext to obtain PK B and KA, so far B has completed the acquisition of KA.
[0012] Preferably, the authentication key synchronization method is as follows:
[0013] A and B respectively record the authentication key pair s locally A =(s A0 , s A1 ) and s B =(s B0 , s B1 ), where s A0 and A1 Respectively represent the authentication key of A before and after the update, s B0 and B1 Denote the authentication keys of B before and after the update respectively. The initial values of the authentication key pairs of A and B are both (K_{-1}, K0), where K0 is the preset key and K_{-1} is an arbitrarily selected constant. The authentication key synchronization phase includes the following steps:
[0014] 1) A calculates h(s A0 ) and h(s A1) and sent to B, where h is an arbitrarily selected one-way function with hash properties;
[0015] 2) After receiving the message, B performs one of the following operations according to the following conditions:
[0016] (a) If h(s A1 ) is equal to h(s B0 ), h(s B0 ) and use s B0 The result of symmetric encryption of the authentication key held by B is sym(s B0 , s B0 ||s B1 ) is sent to A;
[0017] (b) If h(s A0 ) is equal to h(s B1 ), update the authentication key: s B0 =s A0 , s B1 =s A1 , and then send h(s B1 ) ;
[0018] (c) If h(s A1 ) is equal to h(s B1 ), send h(s) to A B1 );
[0019] 3) After receiving the information, A determines that the hash value sent by B is equal to h(s A1 ) and there is encrypted data other than the hash value, use s A1 Decrypt the additional encrypted data to obtain the latest authentication key and update the authentication key: A0 =s B0 ,s A1 =s B1 , otherwise it will not be updated.
[0020] Preferably, in the synchronization phase of the authentication key, A and B generate a random number r before sending the authentication key, calculate the value obtained by applying a one-way function h with hash properties to the authentication key and the random number, and send the value together with the random number to the other party to prevent replay attacks.
[0021] Preferably, the function h can be selected as a hash function SHA-3, and the public key encryption algorithm can be selected as a post-quantum encryption algorithm.
[0022] Preferably, the algorithm for public key encryption includes one of Crystals-Kyber based on lattice problem, Classical McEliece, HQC, BIKE based on error-correcting code, and SIKE based on supersingular elliptic curve homology problem.
[0023] Preferably, the safe method includes one of the following:
[0024] 1) Pre-set authentication keys for both parties through manual distribution;
[0025] 2) A trusted third party distributes authentication keys to both communicating parties for identity authentication.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] Compared with the usual method of using public key encryption to transmit shared keys, the secure key exchange method of the present invention can complete the identity authentication of the communicating parties without relying on CA, reduces the difficulty of key maintenance, and further improves security; uses a real-time updated authentication key for identity authentication, reducing the risk of authentication key leakage; combines public key encryption with the authentication key, even if the authentication key is leaked, the attacker can only obtain the public key but cannot obtain the shared key. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a timing diagram of the entire communication process between two communicating parties performing key exchange in the first embodiment of the present invention;
[0029] Figure 2 This is a timing diagram of the entire communication process between two communicating parties performing key exchange in the second embodiment of the present invention;
[0030] Figure 3 This is the indirect communication process between two encryption devices connected to two QKD networks in Example 3 of the present invention. DETAILED DESCRIPTION
[0031] The present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.
[0032] The present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.
[0033] A secure key exchange method of the present invention utilizes an encrypted public key to transmit a shared key to improve security, and uses a real-time updated authentication key to verify identity without relying on a CA for authentication.
[0034] Assume there are two communicating parties A and B, A is the initiator and B is the responder. A and B respectively record the identity authentication key pair s locallyA =(s A0 , s A1 ) and s B =(s B0 , s B1 ), which needs to be updated every time a key is exchanged. A0 and A1 Respectively represent the authentication key of A before and after the update, s B0 and B1 Respectively represent the authentication key before and after B's update. If one party fails to update the authentication key due to reasons such as packet loss during the key exchange process, this party will lag behind by one authentication key. Recording the authentication key before the update can determine which one is the latest and synchronize the authentication key during the next communication. The specific key exchange process between A and B is as follows:
[0035] Distribution of pre-set keys:
[0036] First, a pre-set key K0 is randomly generated and distributed to A and B in a secure manner. After receiving K0, A and B initialize the authentication key respectively: A =(K_{-1}, K0), s B =(K_{-1}, K0) , where K_{-1} is an arbitrarily selected constant.
[0037] After the communication starts, the authentication key synchronization phase begins:
[0038] (1) A calculates h(s A0 ) and h(s A1 ) and sent to B, where h is an arbitrarily selected one-way function with hash properties.
[0039] (2) After receiving the message, B performs one of the following operations according to the following conditions:
[0040] (a) If h(s A1 ) is equal to h(s B0 ), it means that A lags behind B by one authentication key. B will h(s B0 ) and use s B0 The result of symmetric encryption of the authentication key held by B is sym(s B0 , s B0 ||s B1 )Send to A
[0041] (b) If h(s A0 ) is equal to h(s B1 ), it means that B lags behind A by one authentication key. B updates the authentication key: B0 =s A0, s B1 =s A1 , and then send h(s B1 ) .
[0042] (c) If h(s A1 ) is equal to h(s B1 ), it means that the authentication keys of A and B have been synchronized. B sends h(s B1 ).
[0043] (3) After receiving the information, A determines whether the hash value sent by B is equal to h(s A1 ) and there is encrypted data other than the hash value, then it means that A lags behind B by one authentication key. A uses s A1 Decrypt the additional encrypted data to obtain the latest authentication key and update the authentication key: A0 =s B0 , s A1 =s B1 .
[0044] Key exchange phase:
[0045] (1) After performing authentication key synchronization related operations, A uses an asymmetric encryption algorithm to generate a public key PK A and private key SK A , PK A and its hash value s A1 Encrypt using a symmetric encryption algorithm: A =sym(s A1 , PK A ||h(PK A )), then c A Send to B.
[0046] (2) After receiving A's message, B uses s B1 For ciphertext c A Decryption: PK A ||h(PK A )=sym-1(s B1 , c A ), the obtained PK A Calculate the hash value. If the result is the same as the decrypted hash value, it means that the information has not been tampered with and is indeed sent by A. Then randomly generate a shared key KB and an updated authentication key s' B1 , update the authentication key: s B =(s B1 ,s' B1 ), and then use the public key PK A For KB, s' B1 And its hash value is encrypted: c B=enc(PK A , KB||s' B1 ||h(KB||s' B1 )||PK A ), the ciphertext c B Send to A.
[0047] (3) A receives the private key SK A Decrypt the ciphertext: KB||s' B1 ||h(KB||s' B1 )||PK A =dec(SK A ,c B ), decrypt the obtained PK A Compare it with the value sent at the beginning. If they are the same, it means that the sender is indeed using PK A The information is encrypted, that is, the sender is indeed B, and then the decrypted KB||s' B1 Calculate the hash value. If the result is the same as the decrypted hash value, it means that KB and s' B1 Has not been tampered with, then update the authentication key: A =(s A1 , s' B1 ).
[0048] In the authentication key synchronization phase, A and B can generate a random number before sending the authentication key, calculate the hash value of the authentication key and the random number, and send the hash value together with the random number to prevent replay attacks.
[0049] The function h can be selected as the hash function SHA-3 to ensure sufficient security; the public key encryption algorithm can be selected as a post-quantum encryption algorithm.
[0050] Post-quantum encryption algorithms include Crystals-Kyber based on lattice problems, ClassicalMcEliece, HQC, BIKE based on error-correcting codes, and SIKE based on supersingular elliptic curve homology problems. Embodiment 1
[0051] The public key encryption algorithm used in this embodiment is Kyber, the symmetric encryption algorithm is AES-256, and the hash function is SHA3-256.
[0052] Assume that two parties A and B need to send their respective keys KA and KB to each other. A is the initiator of the communication and B is the responder. A and B respectively record the authentication key pair s locally. A =(s A0 , s A1 ) and sB =(s B0 , s B1 ), the authentication key needs to be updated every time a key is exchanged, where s A0 and A1 Respectively represent the authentication key of A before and after the update, s B0 and B1 Respectively represent B's authentication key before and after the update. Figure 1 As shown in the figure, it is a timing diagram of key exchange between A and B. The specific process is as follows:
[0053] Distribution of pre-set keys:
[0054] First, a pre-set key K0 is randomly generated and distributed to A and B in a secure manner. After receiving K0, A and B initialize the authentication key respectively: A =(K_{-1}, K0), s B =(K_{-1}, K0) , where K_{-1} is an arbitrarily selected constant.
[0055] After the communication starts, the authentication key synchronization phase begins:
[0056] (1) A generates a 256-bit random number r and replaces r||h(s A0 ⊕r)||h(s A1 ⊕r) is sent to B, where ⊕ represents the XOR operation and h represents the SHA3-256 hash function.
[0057] (2) After receiving the message, B performs one of the following operations according to the following conditions:
[0058] (a) If h(s A1 ⊕r) is equal to h(s B0 ⊕r), it means that A lags behind B by one authentication key, and h(s B0 ⊕r) and use s B0 The result of symmetric encryption of the authentication key held by B is sym(s B0 , s B0 ||s B1 ) is sent to A, where sym represents the encryption function of AES-256.
[0059] (b) If h(s A0 ⊕r) is equal to h(s B1 ⊕r), it means that B lags behind A by one authentication key. B updates the authentication key: s B0 =s A0 , s B1 =s A1 , and then send h(s B1⊕r).
[0060] (c) If h(s A1 ⊕r) is equal to h(s B1 ⊕r), it means that the authentication keys of A and B have been synchronized. B sends h(s B1 ⊕r).
[0061] (3) After receiving the information, A determines whether the hash value sent by B is equal to h(s A1 ⊕r) and the total message length is greater than 256 bits, then A lags behind B by one authentication key, and s is used A1 Decrypt the additional encrypted data to obtain the latest authentication key and update the authentication key: A0 =s B0 , s A1 =s B1 .
[0062] Key exchange phase:
[0063] (1) After performing authentication key synchronization related operations, A uses the key generation function of Kyber's public key encryption algorithm (PKE) to generate the public key PK A and private key SK A , the public key PK A and its hash value s A1 Encrypt using AES and save the result in A =sym(s A1 , PK A ||h(PK A ))Send to B.
[0064] (2) After receiving A's message, B uses s B1 For ciphertext c A Decryption: PK A ||h(PK A )=sym-1(s B1 , c A ), the obtained PK A Calculate the hash value. If the result is the same as the decrypted hash value, it means that the information has not been tampered with and is indeed sent by A. Then B generates a public-private key pair PK B and SK B , as well as a shared key KB and an updated authentication key s' B1 , and update the authentication key: B =(s B1 , s' B1 ), and then use the public key PK A For KB and PK B 、s' B1 And its hash value is encrypted: cBA =enc(PK A , KB||PK B ||s' B1 ||h(KB||PK B ||s' B1 )||PK A , r'), where enc is Kyber's PKE encryption function, and r' is a 256-bit random number, which is used as the random number seed required by the enc function. BA Send to A.
[0065] (3) A receives the private key SK A Decrypt the ciphertext: KB||PK B ||s' B1 ||h(KB||PK B ||s' B1 )||PK A =dec(SK A , c BA ), where dec is Kyber’s PKE decryption function. A Compare it with the value sent at the beginning. If they are the same, it means that the sender is indeed using PK A The information is encrypted, that is, the sender is indeed B, and then the decrypted KB||PK B ||s' B1 Calculate the hash value. If the result is the same as the decrypted hash value, it means that KB and PK are in the same state during the transmission. B and s' B1 Has not been tampered with, then update the authentication key: A =(s A1 , s' B1 ). Then A generates a key KA and uses the public key PK B Encrypt it: c AB =enc(PK B , KA||h(KA)||PK B , r''), where r'' is a 256-bit random number. Finally, A converts the ciphertext c AB Send to B.
[0066] (4) B decrypts the ciphertext to obtain the key KA: KA||h(KA)||PK B =dec(SK B , c AB ), and obtain the decrypted PK B Compare it with the value generated by B at the beginning to confirm A's identity. Embodiment 2
[0067] In this embodiment, the communication party A uses its own key to encrypt the ciphertext c obtained by the key exchange process. AB =enc(KA, enc(KB1, KB2)) is sent to B, and the communication party B will encrypt the ciphertext c obtained by using its own key BA =enc(KB, enc(KA1, KA2)) is sent to A, where KA, KA1, KA2 are A's keys, and KB, KB1, KB2 are B's keys. The encryption method enc is characterized in that A cannot obtain the key from C through KA1 and KA2. BA B can decrypt KB from C, but can process the information encrypted by KB; B cannot obtain information from C through KB1 and KB2. AB KA is decrypted from the KA, but the information encrypted by KA can be processed. A is the initiator of the communication and B is the responder. A and B respectively record the authentication key pair s locally. A =(s A0 , s A1 ) and s B =(s B0 , s B1 ), the authentication key needs to be updated every time a key is exchanged, where s A0 and A1 Respectively represent the authentication key of A before and after the update, s B0 and B1 Respectively represent B's authentication key before and after the update. Figure 2 As shown in the figure, it is a timing diagram of key exchange between A and B. The specific process is as follows:
[0068] Distribution of pre-set keys:
[0069] First, a pre-set key K0 is randomly generated and distributed to A and B in a secure manner. After receiving K0, A and B initialize the authentication key respectively: A =(K_{-1}, K0), s B =(K_{-1}, K0) , where K_{-1} is an arbitrarily selected constant.
[0070] After the communication starts, the authentication key synchronization phase begins:
[0071] (1) A generates a random number r and sets r||h(s A0 ⊕r)||h(s A1 ⊕r) is sent to B, where ⊕ represents an XOR operation and h represents a hash function.
[0072] (2) After receiving the message, B performs one of the following operations according to the following conditions:
[0073] (a) If h(sA1 ⊕r) is equal to h(s B0 ⊕r), it means that A lags behind B by one authentication key, and h(s B0 ⊕r) and use s B0 The result of symmetric encryption of the authentication key held by B is sym(s B0 , s B0 ||s B1 ) is sent to A, where sym represents the encryption function of AES-256.
[0074] (b) If h(s A0 ⊕r) is equal to h(s B1 ⊕r), it means that B lags behind A by one authentication key. B updates the authentication key: s B0 =s A0 , s B1 =s A1 , and then send h(s B1 ⊕r).
[0075] (c) If h(s A1 ⊕r) is equal to h(s B1 ⊕r), it means that the authentication keys of A and B have been synchronized. B sends h(s B1 ⊕r).
[0076] (3) After receiving the information, A determines whether the hash value sent by B is equal to h(s A1 ⊕r) and the total message length is greater than the length of the hash value, it means that A lags behind B by one authentication key, and s is used A1 Decrypt the additional encrypted data to obtain the latest authentication key and update the authentication key: A0 =s B0 , s A1 =s B1 .
[0077] Key exchange phase:
[0078] (1) A performs authentication key synchronization operations to generate keys KA1 and KA2, and uses KA1 to encrypt KA2: A =enc(KA1, KA2), then c A and its hash value with authentication key s A1 Encrypted by symmetric encryption function sym and the result c' A =sym(s A1 , c A ||h(c A ))Send to B.
[0079] (2) After receiving A's message, B uses sB1 For the ciphertext c' A Decryption: c A ||h(c A )=sym-1(s B1 , c' A ), for the obtained c A Calculate the hash value. If the result is the same as the decrypted hash value, it means that the information has not been tampered with and is indeed sent by A. Then B generates an updated authentication key s' B1 And update the authentication key: B =(s B1 , s' B1 ), then generate keys KB1 and KB2 and use KB1 to encrypt KB2 to obtain c B =enc(KB1, KB2), then generate a key KB and use KB to encode c A To encrypt: c BA =enc(KB, c A ). Finally, B converts the ciphertext c BA and sym(s B1 , c B ||s' B1 ||h(c B ||s' B1 ))Send to A.
[0080] (3) A receives and uses s A1 For sym(s B1 , c B ||s' B1 ||h(c B ||s' B1 ))Decrypt to get c B and s' B1 , and then use KA1 and KA2 to encrypt the ciphertext c BA To decrypt: c A =dec(KA1, KA2, c BA ). By decrypting c A Compare with the value sent by A at the beginning to confirm B's identity, and then update the authentication key: s A =(s A1 , s' B1 ). Then A generates the key KA and uses it to B To encrypt: c AB =enc(KA, c B ). Finally, A will c AB Send to B.
[0081] (4) B uses KB1 and KB2 to decrypt the ciphertext: c B=dec(KB1, KB2, c AB ). By decrypting c B Comparing it with the value calculated by B at the beginning can confirm the identity of A.
[0082] Through the above process, A and B received c BA and c AB In this case, A and B can process the information encrypted by the other party using KB and KA through their respective keys KA1, KA2 and KB1, KB2. Embodiment 3
[0083] like Figure 3 As shown, there are two QKD networks that cannot communicate due to reasons such as being too far apart or being incompatible with each other. One of the networks is connected to encryption devices A and Ai, and the other is connected to encryption devices B and Bj. The encryption devices A, B, Ai, and Bj are connected to QKD devices a, b, ai, and bj in a secure manner, respectively. Ai and Bj need to perform an interaction process similar to that of Example 2, but since Ai and Bj do not have a preset authentication key, they cannot communicate directly with each other. The above process is implemented by indirectly communicating Ai and Bj with the help of A, B, and the QKD network. The specific steps are as follows:
[0084] (1) A generates keys KA1, KA2 and KA, and then transmits them to Ai through the QKD network.
[0085] (2) B generates keys KB1, KB2 and KB, and then transmits them to Bj through the QKD network.
[0086] (3) A and B perform key exchange according to the steps of Example 2, so that A receives the c sent by B. BA =enc(KB,enc(KA1, KA2)), B receives the c sent by A AB =enc(KA, enc(KB1, KB2)).
[0087] (4) A receives c BA Then the ciphertext enc(KA, c BA ) is sent to Ai, which decrypts it to obtain c BA .
[0088] (5) B receives c AB Then the ciphertext enc(KB, c AB ) is sent to Bj, who decrypts it to obtain c AB .
[0089] Through the above process, Ai and Bj received c BAThrough the above process, Ai and Bj received c BA and c AB In this case, Ai and Bj can process the information encrypted by the other party using KB and KA through keys KA1, KA2 and KB1, KB2 respectively.
[0090] From the embodiments of the present invention, it can be seen that a secure key exchange method of the present invention, compared with the usual method of using public key encryption to transmit shared keys, can complete the identity authentication of the communicating parties without relying on CA, reduces the difficulty of key maintenance, and further improves security; uses a real-time updated authentication key for identity authentication, reducing the risk of authentication key leakage; combines public key encryption with the authentication key, even if the authentication key is leaked, the attacker can only obtain the public key but cannot obtain the shared key.
Claims
1. A secure key exchange method, characterized in that: Before the initial communication, both parties obtain the preset key in a secure manner and distribute it to A and B in advance as their initial authentication key. A is the initiator of the communication and B is the responder of the communication. After each communication starts, A and B exchange keys according to the following steps: 1) A and B synchronize the authentication keys so that both authentication keys are updated to the latest value s determined in the last key exchange process; 2) A generates the public key PK of the asymmetric encryption algorithm A and private key SK A , PK A And its hash value is encrypted with s using a symmetric encryption algorithm to obtain the ciphertext c A , the ciphertext c A Send to B; 3) B uses s to ciphertext c A Decryption, the obtained PK A Calculate the hash value and compare the result with the hash value obtained by decrypting with s. If the hash values are the same, it can be determined that the information has not been tampered with and A's identity is legitimate. Then B generates the public key PK B and private key SK B , then randomly generate a shared key KB and update the authentication key to s', and then use PK A PK A , KB, s' and the hash value of KB and s' are encrypted to obtain the ciphertext c BA , c BA Send to A; 4) A uses SK A C BA Decryption, the PK obtained A Generate PK at the beginning A The values of are compared. If they are the same, B's identity can be confirmed, and then s' and KB can be solved. At this point, A completes the acquisition of KB. 5) A determines whether the information has been tampered with by the hash value, and then updates the authentication key to s'. Then A generates the key KA and uses PK B PK B , KA, s' and the hash value of KA and s' are encrypted to obtain the ciphertext c AB , c AB Send it to B, and pass the decrypted PK B Compare it with the value generated by B at the beginning to confirm A's identity, and B checks the ciphertext c AB Decrypt to get PK B and KA, so far B has completed the acquisition of KA, The authentication key synchronization method is as follows: A and B respectively record the authentication key pair s locally A =(s A0 , s A1 ) and s B =(s B0 , s B1 ), where s A0 and A1 Respectively represent the authentication key of A before and after the update, s B0 and B1 Denote the authentication keys of B before and after the update respectively. The initial values of the authentication key pairs of A and B are both (K_{-1}, K0), where K0 is the preset key and K_{-1} is an arbitrarily selected constant. The authentication key synchronization phase includes the following steps: 1) A calculates h(s A0 ) and h(s A1 ) and sent to B, where h is an arbitrarily selected one-way function with hash properties; 2) After receiving the message, B performs one of the following operations according to the following conditions: (a) If h(s A1 ) is equal to h(s B0 ), h(s B0 ) and use s B0 The result of symmetric encryption of the authentication key held by B is sym(s B0 , s B0 ||s B1 ) is sent to A; (b) If h(s A0 ) is equal to h(s B1 ), update the authentication key: s B0 =s A0 , s B1 =s A1 , and then send h(s B1 ); (c) If h(s A1 ) is equal to h(s B1 ), send h(s) to A B1 ); 3) After receiving the information, A determines that the hash value sent by B is equal to h(s A1 ) and there is encrypted data other than the hash value, use s A1 Decrypt the additional encrypted data to obtain the latest authentication key and update the authentication key: A0 =s B0 ,s A1 =s B1 , otherwise it will not be updated.
2. The secure key exchange method according to claim 1, characterized in that: In the authentication key synchronization phase, A and B generate a random number r before sending the authentication key, calculate the value obtained by applying the one-way function h with hash properties to the authentication key and the random number, and send this value together with the random number to each other to prevent replay attacks.
3. The secure key exchange method according to claim 2, characterized in that: The function h is selected as the hash function SHA-3, and the asymmetric encryption algorithm is selected as the post-quantum encryption algorithm.
4. The secure key exchange method according to claim 3, characterized in that: The post-quantum encryption algorithm includes one of Crystals-Kyber based on lattice problems, Classical McEliece, HQC, BIKE based on error-correcting codes, and SIKE based on supersingular elliptic curve homology problems.
5. The secure key exchange method according to claim 1, characterized in that: The safe method includes one of the following: 1) Pre-set authentication keys for both parties through manual distribution; 2) A trusted third party distributes authentication keys to both communicating parties for identity authentication.
