A key exchange method, system, device and storage medium

By combining classical algorithms and post-quantum algorithms, the system compatibility and performance challenges of the existing technology during the transition to post-quantum cryptography are solved, and the balance of quantum attack resistance and efficient key exchange is achieved.

CN119544216BActive Publication Date: 2025-04-29BEIJING WATCH DATA SYSTEM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510089714.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-04-29
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

The prior art faces challenges in system compatibility and performance when transitioning to post-quantum cryptography, and it is difficult to provide quantum attack resistance while taking into account system compatibility and performance.

Method used

By combining classical algorithms and post-quantum algorithms, we ensure the security of the key exchange process, and use multiple algorithms to work together to generate shared keys, and a dynamic selection mechanism is used to optimize the compatibility and security of the system.

Benefits of technology

It realizes that while providing anti-quantum attack capabilities, it takes into account system compatibility and performance, ensuring the security and efficiency of the key exchange process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544216B_ABST
    Figure CN119544216B_ABST
Patent Text Reader

Abstract

The present invention discloses a key exchange method, system, device and storage medium, which relates to the field of information security. The method includes: a first device and a second device generate their own public-private key pairs respectively; the public-private key pairs include the public-private key pairs of the classical shared key algorithm and / or the public-private key pairs of the post-quantum shared key algorithm; further, the first device and the second device exchange data; the first device and the second device establish a shared key through key negotiation or key encapsulation; finally, the first device and the second device mutually verify whether the shared keys are consistent. By combining the classical algorithm with the post-quantum algorithm to ensure the security of the key exchange process, the system compatibility and performance are taken into account while providing anti-quantum attack capabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security, and in particular to a key exchange method, system, device and storage medium. Background Art

[0002] With the development of quantum computing technology, classical cryptographic algorithms face the risk of being cracked by quantum computers. Therefore, it is necessary to develop quantum-resistant cryptography to replace classical algorithms to ensure the security of communication keys in the era of quantum computing.

[0003] Currently, post-quantum key encapsulation algorithms have been widely studied and have demonstrated strong resistance to quantum computing. However, a complete transition to post-quantum cryptography will involve challenges in many aspects, such as system compatibility and performance. Summary of the invention

[0004] The main purpose of the present invention is to provide a key exchange method, system, device and storage medium. By combining classical algorithms with post-quantum algorithms, the security of the key exchange process is ensured, while providing anti-quantum attack capabilities and taking into account system compatibility and performance.

[0005] In order to achieve the above objectives, the embodiments of the present application provide the following technical solutions:

[0006] According to a first aspect of an embodiment of the present application, a key exchange method is provided, the method comprising:

[0007] The first device and the second device generate their own public-private key pairs respectively; the public-private key pairs include the public-private key pairs of the classical shared key algorithm and / or the public-private key pairs of the post-quantum shared key algorithm;

[0008] exchanging data between the first device and the second device;

[0009] The first device and the second device establish a shared key through key negotiation or key encapsulation;

[0010] The first device and the second device mutually verify whether the shared key is consistent.

[0011] Optionally, if the public-private key pair generated by the first device includes a first public-private key pair of the classical shared key algorithm and a third public-private key pair of the post-quantum shared key algorithm, the public-private key pair generated by the second device includes a second public-private key pair of the classical shared key algorithm; each public-private key pair includes a public key and a private key; exchanging data between the first device and the second device includes:

[0012] The first device sends the first public key and the third public key to the second device;

[0013] The second device uses the third public key of the first device to encrypt a randomly generated post-quantum shared key to obtain encrypted information, and sends the encrypted information and the second public key to the first device.

[0014] Optionally, the first device and the second device establish a shared key through key negotiation or key encapsulation, including:

[0015] The first device uses the third private key to decrypt the encrypted information to obtain the post-quantum shared key, and uses the second public key and the first private key of the second device to calculate a first classical shared key through a classical shared key algorithm; the first classical shared key and the post-quantum shared key are combined through a combination function to form a first shared key;

[0016] The second device uses the first public key and the second private key of the first device to calculate a first classical shared key through a classical shared key algorithm; and combines the first classical shared key and the post-quantum shared key through a combination function to form the first shared key.

[0017] Optionally, if the public-private key pair generated by the first device includes the fifth public-private key pair of the classical shared key algorithm and the sixth public-private key pair of the post-quantum shared key algorithm, the public-private key pair generated by the second device includes the seventh public-private key pair of the classical shared key algorithm and the fourth public-private key pair of the post-quantum shared key algorithm; each public-private key pair includes a public key and a private key; the first device and the second device exchange data, including:

[0018] The first device sends the sixth public key to the second device, and the second device sends the fourth public key to the first device;

[0019] The first device encrypts the fifth public key using the fourth public key to obtain first encrypted information and sends the first encrypted information to the second device;

[0020] The second device encrypts the seventh public key using the sixth public key to obtain second encrypted information and sends the second encrypted information to the first device.

[0021] Optionally, the first device and the second device establish a shared key through key negotiation or key encapsulation, including:

[0022] The first device decrypts the second encrypted information using the sixth private key to obtain the seventh public key, calculates a second classic shared key using the seventh public key and the fifth private key through a classic key agreement algorithm, and calculates a second shared key derived from the second classic shared key through a key derivation function;

[0023] The second device uses the fourth private key to decrypt the first encrypted information to obtain the fifth public key, and uses the fifth public key and the seventh private key to calculate a second classic shared key through a classic key agreement algorithm, and calculates a second shared key derived from the second classic shared key through a key derivation function.

[0024] Optionally, if the public-private key pair generated by the first device includes the ninth public-private key pair of the classical shared key algorithm and the tenth public-private key pair of the post-quantum shared key algorithm, and the public-private key pair generated by the second device includes the eleventh public-private key pair of the classical shared key algorithm; each public-private key pair includes a public key and a private key; exchanging data between the first device and the second device includes:

[0025] The first device sends the ninth public key to the second device, and the second device sends the eleventh public key to the first device;

[0026] The first device encrypts the tenth public key using the eleventh public key to obtain third encrypted information and sends the third encrypted information to the second device.

[0027] Optionally, the first device and the second device establish a shared key through key negotiation or key encapsulation, including:

[0028] The second device decrypts the third encrypted information using the eleventh private key to obtain the tenth public private key, encrypts the randomly generated second post-quantum shared key using the tenth public private key to obtain fourth encrypted information, and encrypts the fourth encrypted information using the ninth public key to obtain fifth encrypted information and sends it to the first device;

[0029] The first device decrypts the fifth encrypted information using the ninth private key to obtain fourth encrypted information, and decrypts the fourth encrypted information using the tenth private key to obtain the second post-quantum shared key;

[0030] The first device calculates a third shared key derived from the second post-quantum shared key through a key derivation function; the second device calculates a third shared key derived from the second post-quantum shared key through a key derivation function.

[0031] According to a second aspect of an embodiment of the present application, a key exchange system is provided, the system comprising:

[0032] A public-private key pair generation module, used for the first device and the second device to generate their own public-private key pairs respectively; the public-private key pairs include public-private key pairs of classical shared key algorithms and / or public-private key pairs of post-quantum shared key algorithms;

[0033] A data exchange module, used for exchanging data between the first device and the second device;

[0034] A shared key generation module, used for establishing a shared key between the first device and the second device through key negotiation or key encapsulation;

[0035] The verification module is used to verify whether the shared key between the first device and the second device is consistent.

[0036] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0037] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement the method described in the first aspect above.

[0038] In summary, the embodiments of the present application provide a key exchange method, system, device and storage medium. The first device and the second device generate respective public-private key pairs; the public-private key pairs include the public-private key pairs of the classical shared key algorithm and / or the public-private key pairs of the post-quantum shared key algorithm; further, the first device and the second device exchange data; the first device and the second device establish a shared key through key negotiation or key encapsulation; finally, the first device and the second device mutually verify whether the shared key is consistent. The security of the key exchange process is ensured by combining the classical algorithm with the post-quantum algorithm, while providing anti-quantum attack capabilities and taking into account system compatibility and performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 the structures shown in these drawings without paying creative work.

[0040] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0041] Figure 1A schematic diagram of a key exchange method flow provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of a process for using post-quantum and classical key exchange simultaneously provided in an embodiment of the present application;

[0043] Figure 3 A schematic diagram of a classical key negotiation process for protecting a post-quantum encryption and decryption algorithm provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of a post-quantum key encapsulation process for classical encryption and decryption protection provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of a key exchange system provided in an embodiment of the present application;

[0046] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present application is shown;

[0047] Figure 7 A diagram showing a computer-readable storage medium provided in an embodiment of the present application.

[0048] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.

[0050] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0051] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0052] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0053] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0054] The embodiment of the present application proposes a key exchange method that combines classical cryptographic algorithms (such as RSA, DH, SM2) and post-quantum cryptographic algorithms (such as Kyber, NTRU), and uses multiple algorithms to work together to generate shared keys. This method is suitable for the post-quantum migration stage, and optimizes the compatibility and security of the existing system through a dynamic algorithm selection mechanism. The shared key generated by this method can be widely used in a variety of application scenarios, including but not limited to Internet communications, Internet of Things devices, Internet of Vehicles systems, financial payments, blockchains, and 5G communications.

[0055] Figure 1 The key exchange method provided in the embodiment of the present application is shown, and the method specifically comprises the following steps:

[0056] Step 101: The first device and the second device generate their own public-private key pairs respectively; the public-private key pairs include the public-private key pairs of the classical shared key algorithm and / or the public-private key pairs of the post-quantum shared key algorithm;

[0057] Step 102: exchanging data between the first device and the second device;

[0058] Step 103: The first device and the second device establish a shared key through key negotiation or key encapsulation;

[0059] Step 104: The first device and the second device mutually verify whether the shared key is consistent.

[0060] By using different types of key algorithms, the security of the key exchange process is improved to ensure that communications are secure even under the threat of quantum computing. Devices are allowed to select different classical and post-quantum key algorithms as needed to meet different security needs and performance requirements. Ensure that the system is compatible with existing classical cryptographic systems while preparing for the future era of quantum computing. By verifying the shared key, the consistency and correctness of the devices on both sides during the key exchange process are ensured.

[0061] In a possible implementation manner, if the public-private key pair generated by the first device includes a first public-private key pair of the classical shared key algorithm and a third public-private key pair of the post-quantum shared key algorithm, and the public-private key pair generated by the second device includes a second public-private key pair of the classical shared key algorithm; each public-private key pair includes a public key and a private key; in step 102, exchanging data between the first device and the second device includes:

[0062] The first device sends the first public key PK 1 and the third public key PK 3 Send to the second device; the second device uses the third public key of the first device to encrypt a randomly generated post-quantum shared key K PQC Get the encrypted information C = KEM.ENC(K PQC , PK 3 ), and the encrypted information C and the second public key PK 2 Send to the first device.

[0063] In a possible implementation manner, in step 103, the first device and the second device establish a shared key through key negotiation or key encapsulation, including:

[0064] The first device uses the third private key SK to decrypt the encrypted information C to obtain the post-quantum shared key K PQC and use the second public key PK of the second device 2 and the first private key SK 1 The first classic shared key K is calculated by the classic shared key algorithm c ; The first classic shared key K c and the post-quantum shared key K PQC The first shared key K is formed by combining the combination function; the second device uses the first public key PK of the first device 1 and the second private key SK 2 The first classic shared key K is calculated by the classic shared key algorithm c ; The first classic shared key K c and the post-quantum shared key KPQC The first shared key K is formed by combining the keys through a combination function.

[0065] In a possible implementation, in step 104, the first device and the second device may send verification data to each other using a hash function or a message authentication code to confirm whether the shared key is consistent. The combination function includes but is not limited to a simple concatenation, or the concatenation is then input into a hash function.

[0066] Assume that the first device is a server and the second device is a client. The server and the client need to exchange information securely. The server generates a pair of RSA public and private keys (classical algorithm) and a pair of Kyber public and private keys (post-quantum algorithm). The client also generates a pair of RSA public and private keys. The server sends the RSA public key (PK 1 ) and Kyber public key (PK 3 ) is sent to the client. The client uses the server’s Kyber public key (PK 3 ) encrypts a randomly generated post-quantum shared key K PQC , get the encrypted data C, and compare it with your own RSA public key (PK 2 ) is sent to the server. The server uses its own Kyber private key (SK 3 ) Decrypt C to get K PQC , and use the client's RSA public key (PK 2 ) and your own RSA private key (SK 1 ) Calculate the classic shared key K c The server will K c and K PQC Combined to form a shared key K. The client also uses the server's RSA public key (PK 1 ) and your own RSA private key (SK 2 ) Calculate K c , and K c and K PQC Combined to form a shared key K. The server and client use hash functions or message authentication codes to send verification data to each other to confirm whether the shared key K is consistent. Through this process, the server and client can securely establish a shared key, and maintain communication security even in the face of attacks by quantum computers.

[0067] By using post-quantum and classical key exchange simultaneously, the results of the two algorithms are used in parallel to enhance the security of the key. This provides double security protection, even if the classical algorithm is cracked, the post-quantum algorithm still provides protection, and vice versa.

[0068] In a possible implementation manner, if the public-private key pair generated by the first device includes the fifth public-private key pair (PK 1 , SK 1 ) and the sixth public-private key pair (PK 3 ,SK 3 ), the public-private key pair generated by the second device includes the seventh public-private key pair (PK 2 ,SK 2 ) and the fourth public-private key pair (PK 4 , SK 4 ); each public-private key pair includes a public key and a private key; in step 102, exchanging data between the first device and the second device includes:

[0069] The first device sends the sixth public key PK 3 Send it to the second device, and the second device sends the fourth public key PK 4 Send to the first device; the first device uses the fourth public key PK 4 For the fifth public key PK 1 Encrypt to obtain the first encrypted information C 1 and sends it to the second device; the second device uses the sixth public key PK 3 For the seventh public key PK 2 Encrypt to obtain the second encrypted information C 2 and sent to the first device.

[0070] In a possible implementation manner, in step 103, the first device and the second device establish a shared key through key negotiation or key encapsulation, including:

[0071] The first device uses the sixth private key to encrypt the second encrypted information C 2 Decrypt to obtain the seventh public key PK 2 , and use the seventh public key PK 2 and the fifth private key SK 1 The second classic shared key K is calculated by the classic key agreement algorithm c = DH.KeyExchange(SK 1 , PK 2 ), calculates a second shared key derived from the second classic shared key through a key derivation function; the second device uses a fourth private key SK 4 The first encrypted information C 1 Decrypt to obtain the fifth public key PK 1 = KEM.DEC(C1 , SK 4 ), and using the fifth public key PK 1 And the seventh private key SK 2 The second classic shared key K is calculated by the classic key agreement algorithm c = DH.KeyExchange(SK 2 , PK 1 ), and calculate a second shared key derived from the second classic shared key through a key derivation function.

[0072] In a possible implementation, in step 104, the first device and the second device may send verification data to each other using a hash function or a message authentication code to confirm whether the shared key is consistent. The key derivation function includes but is not limited to a hash function.

[0073] Assume that the first device is a communication satellite and the second device is a ground control station. The satellite and the ground control station need to exchange information securely. The satellite generates a pair of DH public-private keys (classical algorithm) and a pair of Kyber public-private keys (post-quantum algorithm). The ground control station also generates a pair of DH public-private keys and a pair of Kyber public-private keys. The satellite sends the Kyber public key (PK 3 ) is sent to the ground control station. The ground control station sends the Kyber public key (PK 4 ) is sent to the satellite. The satellite uses the Kyber public key (PK 4 ) encrypts its DH public key (PK 1 ), get the encrypted information C 1 And send it to the ground control station. The ground control station uses the satellite’s Kyber public key (PK 3 ) encrypts its DH public key (PK 2 ), get the encrypted information C 2 and sent to the satellite. The satellite uses its own Kyber private key (SK 3 ) Decryption C 2 Get the DH public key (PK 2 ), and use PK 2 and your own DH private key (SK 1 ) Calculate the classic shared key K c The ground control station uses its own Kyber private key (SK 4 ) Decryption C 1 Get the satellite's DH public key (PK 1 ), and use PK 1 and your own DH private key (SK 2 ) Calculate the classic shared key K cThe satellite and the ground control station use hash functions or message authentication codes to send verification data to each other to confirm whether the shared key K is consistent. Through this process, the satellite and the ground control station can securely establish a shared key, which can keep the communication secure even in the face of attacks by quantum computers.

[0074] The use of post-quantum cryptographic algorithms to protect key steps in the classical key exchange process ensures that the security of the classical key exchange will not be weakened even under quantum attacks. The ability of the classical key exchange algorithm to resist quantum attacks is enhanced, ensuring the security of the key exchange process.

[0075] In a possible implementation manner, if the public-private key pair generated by the first device includes the ninth public-private key pair (PK 1 , SK 1 ) and the tenth public-private key pair (PK 3 ,SK 3 ), and the public-private key pair generated by the second device includes the eleventh public-private key pair (PK 2 , SK 2 ); each public-private key pair includes a public key and a private key; in step 102, exchanging data between the first device and the second device includes:

[0076] The first device uses the ninth public key PK 1 Send it to the second device, and the second device sends the eleventh public key PK 2 Send to the first device; the first device uses the eleventh public key PK 2 For the tenth public key PK 3 Encrypt to obtain the third encrypted information C 1 =RSA.ENC(PK 3 , PK 2 ) and sends it to the second device.

[0077] In a possible implementation manner, in step 103, the first device and the second device establish a shared key through key negotiation or key encapsulation, including:

[0078] The second device uses the eleventh private key SK 2 Decrypt the third encrypted information C 1 Get the tenth public and private PK 3 =RSA.DEC(C 1 , SK 2 ), using the tenth public-private PK 3 The randomly generated second post-quantum shared key K PQCEncryption is performed to obtain the fourth encrypted information D = KEM.ENC(K PQC , PK 3 ), using the ninth public key PK 1 The fourth encrypted information D is encrypted to obtain the fifth encrypted information C 2 =RSA.ENC(D, PK 1 ) and sends it to the first device; the first device uses the ninth private key SK 1 Decrypt the fifth encrypted information C 2 Get the fourth encrypted information D = RSA.DEC(C 2 , SK 1 ), using the tenth private key SK 3 Decrypt the fourth encrypted information D to obtain the second post-quantum shared key K PQC = KEM.DEC(D, SK 3 ); The first device calculates a third shared key K derived from the second post-quantum shared key through a key derivation function = H(K PQC ); the second device calculates a third shared key K derived from the second post-quantum shared key through a key derivation function = H(K PQC ).

[0079] In a possible implementation, in step 104, the first device and the second device may send verification data to each other using a hash function or a message authentication code to confirm whether the shared key is consistent. The key derivation function includes but is not limited to a hash function.

[0080] Assume that the first device is a bank's server and the second device is a customer's mobile device. The server and the customer's mobile device need to exchange information securely to conduct secure financial transactions. Step 101: The bank server generates a pair of RSA public and private keys (classical algorithm) and a pair of Kyber public and private keys (post-quantum algorithm). The customer's mobile device generates a pair of RSA public and private keys. Step 102: The bank server sends the RSA public key (PK 1 ) is sent to the customer's mobile device. The customer's mobile device sends the RSA public key (PK 2 ) is sent to the bank server. The bank server uses the customer's RSA public key (PK 2 ) encrypts its Kyber public key (PK 3 ), get the encrypted information C 1 Step 103: The customer's mobile device uses its own RSA private key (SK 2 ) decrypts C1 to get the bank server’s Kyber public key (PK 3 ). The client generates a post-quantum shared key KPQC and use PK 3 Encrypt it and get the decrypted data D. The customer uses the bank server's RSA public key (PK 1 ) Encrypt D to get encrypted data C 2 The bank server uses its own RSA private key (SK 1 ) Decryption C 2 Get D, and then use the Kyber private key (SK 3 ) Decrypt D to get K PQC The bank server and the customer's mobile device both calculate the shared key K through the key derivation function H. Step 104: The bank server and the customer's mobile device send verification data to each other using a hash function or message authentication code to confirm whether the shared key K is consistent. Through this process, the bank server and the customer's mobile device can securely establish a shared key, and maintain communication security even in the face of attacks by quantum computers.

[0081] The present invention provides a hybrid key exchange method combining classical cryptographic algorithms and post-quantum cryptographic algorithms. The maturity and stability of classical cryptographic algorithms are used to protect the post-quantum key exchange process, ensuring the security and reliability of post-quantum key exchange. The practicality and compatibility of post-quantum key exchange are improved, so that it can operate effectively in the existing communication infrastructure. In this method, the classical cryptographic algorithm and the post-quantum cryptographic algorithm work together to generate multi-level or multi-dimensional key materials, and finally form a shared key with high security. During the key exchange process, the system uses classical cryptographic algorithms (such as DH, SM2, RSA) and post-quantum cryptographic algorithms (such as Kyber or NTRU) to generate multiple key materials respectively. These key materials can cooperate with each other by direct combination derivation or protection to jointly generate the final shared key. In this process, the post-quantum cryptographic algorithm can be used to enhance the security of the classical cryptographic algorithm, protect intermediate data, or independently generate additional keys to ensure the resistance of the shared key to quantum computing attacks. In practical applications, the system can select specific post-quantum algorithms and classical algorithms according to environmental requirements to adapt to different security levels and performance requirements.

[0082] The key exchange method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0083] Figure 2 The embodiment process of using post-quantum and classical key exchange at the same time is shown. Taking DH algorithm and Kyber algorithm as examples, the specific implementation steps are as follows:

[0084] Phase 1: System initialization: Users A and B generate DH and Kyber public and private key pairs respectively.

[0085] User A generates a DH public-private key pair (PK 1 , SK 1 ) and Kyber public-private key pair (PK 3 , SK 3 ) ; User B generates a DH public-private key pair (PK 2 , SK 2 ) .

[0086] Phase 2: Key exchange: User A sends DH and Kyber public key to User B. User B generates and encrypts the post-quantum shared key and then sends it to User A.

[0087] Step 1: User A sends DH and Kyber public key (PK 1 , PK 3 ) is sent to user B.

[0088] Step 2: User B generates a random number as the post-quantum shared key K PQC , using user A’s Kyber public key PK 3 Encrypt it and get C = KEM.ENC(K PQC , PK 3 ), (PK 2 , C) is sent to user A.

[0089] Phase 3: Key calculation: Users A and B calculate the classical shared key and the decrypted quantum shared key respectively, and then generate the final shared key through the combination function F.

[0090] User A uses SK 1 and PK 2 Calculate the classic shared key K c = DH.KeyExchange(SK 1 , PK 2 ), using your own Kyber private key SK 3 Decrypt C to obtain the post-quantum shared key K PQC = KEM.DEC(C, SK 3 ), the classic shared key K c and the post-quantum shared key K PQC The final shared key K = F(K c , K PQC );

[0091] User B uses SK 2 and PK 1 Calculate the classic shared key K c= DH.KeyExchange(SK 2 , PK 1 ), the classic shared key K c and the post-quantum shared key K PQC The final shared key K = F(K c ,K PQC ).

[0092] Phase 4: Key confirmation: Users A and B confirm whether the shared key is consistent through hash functions or message authentication codes.

[0093] User A and user B can send verification data to each other using hash functions or message authentication codes to confirm whether the shared keys are consistent. The combination function includes but is not limited to simple concatenation, or concatenation followed by input into a hash function.

[0094] In this embodiment, the classical cryptographic algorithm (DH) and the post-quantum cryptographic algorithm (Kyber) each independently generate key material, and then the two results are combined through the combination function F to form the final shared key. This approach allows the results of both algorithms to contribute to the final key.

[0095] Figure 3 The embodiment process of protecting classical key negotiation with post-quantum encryption and decryption algorithms is shown. Taking DH algorithm and Kyber algorithm as examples, the specific implementation steps are as follows:

[0096] Phase 1: Initialization: Users A and B generate DH and Kyber public and private key pairs respectively.

[0097] User A generates a DH public-private key pair (PK 1 , SK 1 ) and Kyber public-private key pair (PK 3 , SK 3 ) ; User B generates a DH public-private key pair (PK 2 , SK 2 ) and Kyber public-private key pair (PK 4 , SK 4 ).

[0098] Phase 2: Key Exchange: User A and B exchange Kyber public keys, and then use the other party’s Kyber public key to encrypt their own DH public key.

[0099] Step 1: User A sends PK 3 Send to user B; user B will send PK 4 Sent to user A.

[0100] Step 2: User A uses User B’s Kyber public key PK 4 PK 1 Encrypt to get C 1 = KEM.ENC(PK 1 ,PK 4 ), and C 1 Send to user B; user B uses user A’s Kyber public key PK 3 PK 2 Encrypt to get C 2 = KEM.ENC(PK 2 , PK 3 ), and C 2 Sent to user A.

[0101] Phase 3: Key calculation: Users A and B decrypt each other's encrypted DH public key, calculate the classic shared key, and generate the final shared key through the key derivation function H.

[0102] User A uses SK 3 C 2 Decrypt to get PK 2 = KEM.DEC(C 2 , SK 3 ), calculate the classic shared key K c =DH.KeyExchange(SK 1 , PK 2 ), the final shared key K = H(K c );

[0103] User B uses SK 4 C 1 Decrypt to get PK 1 = KEM.DEC(C 1 , SK 4 ), calculate the classic shared key K c =DH.KeyExchange(SK 2 , PK 1 ), the final shared key K = H(K c ).

[0104] Phase 4: Key confirmation: Users A and B confirm whether the shared key is consistent through hash functions or message authentication codes.

[0105] User A and user B can send verification data to each other using hash functions or message authentication codes to confirm whether the shared keys are consistent.

[0106] In this embodiment, the post-quantum cryptographic algorithm (Kyber) is mainly used to protect the public key exchange process of the classical cryptographic algorithm (DH). The final shared key is completely based on the result of the classical cryptographic algorithm, while the post-quantum algorithm is mainly used to ensure the security of the exchange process.

[0107] Figure 4 The embodiment process of classical encryption and decryption protection post-quantum key encapsulation is shown. Taking the RSA algorithm and Kyber algorithm as examples, the specific implementation steps are as follows:

[0108] Phase 1: System initialization phase: Users A and B generate RSA and Kyber public and private key pairs respectively.

[0109] User A generates an RSA public-private key pair (PK 1 , SK 1 ) and Kyber public-private key pair (PK 3 , SK 3 ); User B generates an RSA public-private key pair (PK 2 , SK 2 ) .

[0110] Phase 2: Key Exchange: User A encrypts his Kyber public key with User B’s RSA public key and sends it to User B.

[0111] Step 1: User A sends PK 1 Send to user B; user B will send PK 2 Sent to user A.

[0112] Step 2: User A uses user B's RSA public key PK 2 PK 3 Encrypt to get C 1 =RSA.ENC(PK 3 , PK 2 ), and C 1 Sent to user B.

[0113] Phase 3: Key calculation: User B decrypts the Kyber public key, generates a post-quantum shared key and encrypts it, then encrypts it with User A’s RSA public key and sends it to User A. User A decrypts the post-quantum shared key and generates the final shared key through the key derivation function H.

[0114] Step 1: User B uses SK 2 Decryption C 1 Get PK 3 =RSA.DEC(C 1 , SK 2 ), generate a random number as the post-quantum shared key K PQC, using PK 3 Encrypt it and get D = KEM.ENC(K PQC , PK 3 ), using PK 1 Encrypt D to get C 2 =RSA.ENC(D, PK 1 ) 2 Sent to user A.

[0115] Step 2: User A uses SK 1 Decryption C 2 We get D = RSA.DEC(C 2 , SK 1 ), using SK 3 Decrypt D to get K PQC =KEM.DEC(D, SK 3 ).

[0116] Step 3: User A calculates the final shared key K = H(K PQC ); User B uses the key derivation function H to calculate the final shared key K = H(K PQC ).

[0117] Phase 4: Key confirmation: Users A and B confirm whether the shared key is consistent through hash functions or message authentication codes.

[0118] User A and user B can send verification data to each other using hash functions or message authentication codes to confirm whether the shared keys are consistent.

[0119] In this embodiment, the classical cryptographic algorithm (RSA) is used to protect the key material of the post-quantum cryptographic algorithm (Kyber). The final shared key is completely based on the results of the post-quantum cryptographic algorithm, while the classical algorithm is mainly used to ensure the secure transmission of the key material.

[0120] These three examples demonstrate the flexibility and diversity of the hybrid key exchange method. Through different combinations and protection strategies, the most appropriate key exchange scheme can be selected according to specific security needs and performance requirements. This hybrid approach not only improves the security of key exchange, but also ensures that in the era of quantum computing, the existing cryptographic system can smoothly transition and maintain its effectiveness and security.

[0121] The technical solution described in the present invention improves the ability to resist quantum computing attacks during the key exchange process and enhances the overall security of the system. By combining classical algorithms and post-quantum algorithms, the system's compatibility with existing security protocols (such as TLS, VPN, etc.) is ensured, and the generated shared key can be used as a session key in the original manner of the protocol, so that the existing infrastructure can smoothly transition to the quantum-resistant era. The flexible key exchange mode can select a combination of classical and post-quantum algorithms according to specific application scenarios and security requirements to ensure a balance between high security requirements and performance requirements.

[0122] In summary, the embodiment of the present application provides a key exchange method, wherein a first device and a second device generate respective public-private key pairs; the public-private key pairs include public-private key pairs of a classical shared key algorithm and / or public-private key pairs of a post-quantum shared key algorithm; further, the first device and the second device exchange data; the first device and the second device establish a shared key through key negotiation or key encapsulation; finally, the first device and the second device mutually verify whether the shared key is consistent. By combining the classical algorithm with the post-quantum algorithm to ensure the security of the key exchange process, the system compatibility and performance are taken into account while providing anti-quantum attack capabilities.

[0123] Based on the same technical concept, the embodiment of the present application also provides a key exchange system, such as Figure 5 As shown, the system comprises:

[0124] A public-private key pair generation module 501 is used for the first device and the second device to generate their own public-private key pairs respectively; the public-private key pairs include public-private key pairs of classical shared key algorithms and / or public-private key pairs of post-quantum shared key algorithms;

[0125] A data exchange module 502, configured to exchange data between the first device and the second device;

[0126] A shared key generation module 503, configured to establish a shared key between the first device and the second device through key negotiation or key encapsulation;

[0127] The verification module 504 is used for the first device and the second device to verify whether the shared key is consistent with each other.

[0128] The present application also provides an electronic device corresponding to the method provided in the above embodiment. Figure 6, which shows an electronic device diagram provided by some embodiments of the present application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202 and a communication interface 203, wherein the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and the processor 200 executes the method provided by any of the aforementioned embodiments of the present application when running the computer program.

[0129] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one physical port (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0130] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving execution instructions. The method disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.

[0131] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.

[0132] The electronic device provided in the embodiment of the present application and the method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, operated or implemented by them.

[0133] The present application also provides a computer-readable storage medium corresponding to the method provided in the above embodiment. Figure 7 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the method provided in any of the aforementioned embodiments is executed.

[0134] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0135] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.

[0136] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets should not be constructed as a limitation to the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names.

[0137] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

[0138] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A key exchange method, characterized in that: The method comprises: The first device and the second device generate their own public-private key pairs respectively; the public-private key pairs include the public-private key pairs of the classical shared key algorithm and / or the public-private key pairs of the post-quantum shared key algorithm; exchanging data between the first device and the second device; The first device and the second device establish a shared key through key negotiation or key encapsulation; The first device and the second device mutually verify whether the shared key is consistent; If the public-private key pair generated by the first device includes the first public-private key pair of the classical shared key algorithm and the third public-private key pair of the post-quantum shared key algorithm, the public-private key pair generated by the second device includes the second public-private key pair of the classical shared key algorithm; each public-private key pair includes a public key and a private key; exchanging data between the first device and the second device includes: the first device sends the first public key and the third public key to the second device; the second device uses the third public key of the first device to encrypt a randomly generated post-quantum shared key to obtain encrypted information, and sends the encrypted information and the second public key to the first device.

2. The method according to claim 1, characterized in that The first device and the second device establish a shared key through key negotiation or key encapsulation, including: The first device uses the third private key to decrypt the encrypted information to obtain the post-quantum shared key, and uses the second public key and the first private key of the second device to calculate a first classical shared key through a classical shared key algorithm; the first classical shared key and the post-quantum shared key are combined through a combination function to form a first shared key; The second device uses the first public key and the second private key of the first device to calculate a first classical shared key through a classical shared key algorithm; and combines the first classical shared key and the post-quantum shared key through a combination function to form the first shared key.

3. The method according to claim 1, characterized in that If the public-private key pair generated by the first device includes the fifth public-private key pair of the classical shared key algorithm and the sixth public-private key pair of the post-quantum shared key algorithm, the public-private key pair generated by the second device includes the seventh public-private key pair of the classical shared key algorithm and the fourth public-private key pair of the post-quantum shared key algorithm; each public-private key pair includes a public key and a private key; The first device and the second device exchange data, including: The first device sends the sixth public key to the second device, and the second device sends the fourth public key to the first device; The first device encrypts the fifth public key using the fourth public key to obtain first encrypted information and sends the first encrypted information to the second device; The second device encrypts the seventh public key using the sixth public key to obtain second encrypted information and sends the second encrypted information to the first device.

4. The method according to claim 3, characterized in that The first device and the second device establish a shared key through key negotiation or key encapsulation, including: The first device uses the sixth private key to decrypt the second encrypted information to obtain the seventh public key, and uses the seventh public key and the fifth private key to calculate a second classic shared key through a classic key agreement algorithm, and calculates a second shared key derived from the second classic shared key through a key derivation function; The second device uses the fourth private key to decrypt the first encrypted information to obtain the fifth public key, and uses the fifth public key and the seventh private key to calculate a second classic shared key through a classic key agreement algorithm, and calculates a second shared key derived from the second classic shared key through a key derivation function.

5. The method according to claim 1, characterized in that If the public-private key pair generated by the first device includes the ninth public-private key pair of the classical shared key algorithm and the tenth public-private key pair of the post-quantum shared key algorithm, and the public-private key pair generated by the second device includes the eleventh public-private key pair of the classical shared key algorithm; each public-private key pair includes a public key and a private key; The first device and the second device exchange data, including: The first device sends the ninth public key to the second device, and the second device sends the eleventh public key to the first device; The first device encrypts the tenth public key using the eleventh public key to obtain third encrypted information and sends the third encrypted information to the second device.

6. The method according to claim 5, characterized in that The first device and the second device establish a shared key through key negotiation or key encapsulation, including: The second device decrypts the third encrypted information using the eleventh private key to obtain the tenth public key, encrypts the randomly generated second post-quantum shared key using the tenth public key to obtain fourth encrypted information, and encrypts the fourth encrypted information using the ninth public key to obtain fifth encrypted information and sends it to the first device; The first device decrypts the fifth encrypted information using the ninth private key to obtain fourth encrypted information, and decrypts the fourth encrypted information using the tenth private key to obtain the second post-quantum shared key; The first device calculates a third shared key derived from the second post-quantum shared key through a key derivation function; the second device calculates a third shared key derived from the second post-quantum shared key through a key derivation function.

7. A key exchange system, characterized in that: The system comprises: A public-private key pair generation module, used for the first device and the second device to generate their own public-private key pairs respectively; the public-private key pairs include public-private key pairs of classical shared key algorithms and / or public-private key pairs of post-quantum shared key algorithms; A data exchange module, used for exchanging data between the first device and the second device; A shared key generation module, used for establishing a shared key between the first device and the second device through key negotiation or key encapsulation; A verification module, used for verifying whether the shared key between the first device and the second device is consistent; The public-private key pair generation module is specifically used to: if the public-private key pair generated by the first device includes the first public-private key pair of the classical shared key algorithm and the third public-private key pair of the post-quantum shared key algorithm, the public-private key pair generated by the second device includes the second public-private key pair of the classical shared key algorithm; each public-private key pair includes a public key and a private key; exchanging data between the first device and the second device includes: the first device sends the first public key and the third public key to the second device; the second device uses the third public key of the first device to encrypt a randomly generated post-quantum shared key to obtain encrypted information, and sends the encrypted information and the second public key to the first device.

8. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Anti-quantum cryptography migration method based on FIDO2 protocol, electronic equipment and medium

    CN119276642A

  • Methods and systems for primary authentication using hybrid key exchange / hybrid encryption in communication networks

    WO2024172439A1