A two-party key exchange method, device, system and medium

By splitting the private key in a mobile smart terminal and collaboratively generating a public key, the problem of private key security in mobile smart terminals is solved, and high-security and low-cost key exchange is achieved in a cloud computing environment.

CN116192374BActive Publication Date: 2025-12-23BEIJING WATCH DATA SYSTEM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310081724.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-17
Publication Date
2025-12-23
Estimated Expiration
2043-01-17

AI Technical Summary

Technical Problem

The lack of hardware cryptographic modules in mobile smart terminals makes it crucial to address the issue of protecting the security of the private key in the SM2 elliptic curve public-key cryptography algorithm.

Method used

A two-party collaborative key exchange method is adopted, in which the private key is split into multiple sub-private keys and stored in different communicating parties. By collaboratively generating a public key and exchanging some calculation results, a shared key is finally generated, thus avoiding the exposure of the complete private key.

Benefits of technology

It improves the security of private keys, is suitable for low-latency, high-interaction cloud computing environments, and does not require additional cryptographic operation modules, resulting in low deployment costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116192374B_ABST
    Figure CN116192374B_ABST
Patent Text Reader

Abstract

The application provides a two-party collaborative key exchange method, device, system and storage medium. The method comprises: based on an SM2 algorithm, a first communication party generates a first sub-private key, and a second communication party generates a second sub-private key; based on the first sub-private key and the second sub-private key, the first communication party and the second communication party collaboratively generate a first public key common to both parties and make it public; after the first communication party receives a second public key sent by a third communication party, the first communication party and the second communication party collaboratively generate a third public key based on the first sub-private key, the second sub-private key and the first public key, send the third public key to the third communication party, and generate a shared key with the third communication party. In the application, the complete private key does not appear in the private key generation and private key operation process, so that the security of the private key can be effectively improved. In addition, the scheme can reuse the basic operation module of the SM2 algorithm, has strong operability, and can meet the low-delay and few-interaction cloud computing environment.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication, in particular to a two-party collaborative key exchange method, device, system and medium. BACKGROUND

[0002] In the public key cryptography system, how to ensure the security of the user's private key is a very important problem. Usually the user's private key needs to be securely generated, stored and used in a special hardware. However, with the popularization of public key cryptography algorithm and the promotion of SM2 elliptic curve public key cryptography algorithm independently developed by China, SM2 algorithm also plays an increasingly important role in Internet of Things applications such as Internet of Vehicles, intelligent medical system, smart home system and cloud computing system.

[0003] However, many mobile intelligent terminals do not configure hardware cryptographic modules such as cryptographic chips, secure elements, etc. In this case, how to protect the security of the private key becomes a technical problem that needs to be solved in the field. SUMMARY

[0004] The present application provides a two-party collaborative key exchange method, device, system and storage medium, which can effectively improve the security of the private key.

[0005] The first aspect of the present application provides a two-party collaborative key exchange method, comprising:

[0006] Based on the SM2 algorithm, the first communication party generates a first sub-private key, and the second communication party generates a second sub-private key;

[0007] Based on the first sub-private key and the second sub-private key, the first communication party and the second communication party collaboratively generate a first public key common to both parties and make it public;

[0008] After receiving the second public key sent by the third communication party, the first communication party and the second communication party collaboratively generate a third public key based on the first sub-private key, the second sub-private key and the first public key, send the third public key to the third communication party, and generate a shared key with the third communication party.

[0009] In a possible implementation, in the two-party collaborative key exchange method of the present application, the first communication party generates a first sub-private key, and the second communication party generates a second sub-private key, comprising:

[0010] The first communication party uses a random number generator to generate a random number d1, and stores the random number d1 as the first sub-private key;

[0011] The second communication party uses a random number generator to generate a random number d2, and stores the random number d2 as the second sub-private key.

[0012] In one possible implementation, in the two-party collaborative key exchange method described above in this application, the step of the first and second communicating parties collaboratively generating and publishing a common first public key based on a first sub-private key and a second sub-private key includes:

[0013] The first communicating party calculates a portion of the public key P1 = [d1]G and sends the portion of the public key P1 to the second communicating party;

[0014] The second communicating party receives a portion of the public key P1 transmitted by the first communicating party and calculates the first public key P. B =P1+[d2]G, if P B =O or P B If +G = 0, then the second communicating party needs to regenerate the random number d2; otherwise, P will be... B Publicly disclosed as the first public key;

[0015] Where G is the base point of the elliptic curve, O is the point at infinity of the elliptic curve, and [] represents the dot product operation on the elliptic curve.

[0016] In one possible implementation, in the two-party collaborative key exchange method described above in this application, after the first communicating party receives the second public key from the third communicating party, the first and second communicating parties collaboratively generate a third public key based on the first sub-private key, the second sub-private key, and the first public key, send the third public key to the third communicating party, and generate a shared key with the third communicating party, including:

[0017] The first communicating party receives the second public key R sent by the third communicating party. A And verify the second public key R A Check if the equation of the elliptic curve is satisfied; if not, the negotiation fails.

[0018] The first communicating party generates a random number r1 and calculates a partial random number public key R1 = [r1](P B -[d1]G), using part of the random number public key R1 and the second public key R A Send to the second communicating party;

[0019] The second communicating party generates a random number r2 and calculates the third public key. According to the SM2 algorithm, from the second public key R A Parameters recovered From the third public key R B Parameters recovered Calculate third-party data Next, the second part of the shared secret point was calculated. Use the third public key R B The second part, shared secret point V2, is sent to the first communicating party;

[0020] The first communication party recovers a parameter from the second public key R A recovers a parameter from the third public key R B calculates third-party data the first part of the shared secret point Then, a shared secret point V = [h](V1+V2) is calculated, and if the shared secret point V is an infinite point, the negotiation fails.

[0021] The first communication party calculates a shared key K with the third communication party from the shared secret point V according to the SM2 algorithm B The third public key R B is sent to the third communication party.

[0022] In a possible implementation, in the two-party collaborative key exchange method provided in the present application, the method further includes: the first communication party and the third communication party performing key confirmation based on the shared key.

[0023] The second aspect of the present application provides a two-party collaborative key exchange device, which includes: a first communication party and a second communication party.

[0024] The first communication party includes a first key generation unit and a first key exchange unit.

[0025] The second communication party includes a second key generation unit and a second key exchange unit.

[0026] The first key generation unit generates a first sub-private key based on the SM2 algorithm.

[0027] The second key generation unit generates a second sub-private key based on the SM2 algorithm.

[0028] The first key generation unit and the second key generation unit collaboratively generate a first public key common to the first communication party and the second communication party based on the first sub-private key and the second sub-private key, and the first public key is disclosed.

[0029] After receiving the second public key sent by the third communication party, the first key exchange unit and the second key exchange unit collaboratively generate a third public key based on the first sub-private key, the second sub-private key, and the first public key.

[0030] The first key exchange unit sends the third public key to the third communication party, and generates a shared key with the third communication party.

[0031] In a possible implementation, in the two-party collaborative key exchange device provided in the present application,

[0032] ​​The first key generating unit is specifically configured to generate a random number d1 by using a random number generator, and store the random number d1 as a first sub-private key.

[0033] The second key generating unit is specifically configured to generate a random number d2 by using a random number generator, and store the random number d2 as a second sub-private key.

[0034] In a possible implementation, in the two-party collaborative key exchange device,

[0035] The first key generating unit is further specifically configured to calculate a partial public key P1 = [d1]G, and send the partial public key P1 to the second key generating unit.

[0036] The second key generating unit is further specifically configured to receive the partial public key P1 sent by the first key generating unit, and calculate a first public key P B = P1 + [d2]G, if P B = O or P B + G = O, re-generate the random number d2, or take P B as the first public key and publish the first public key.

[0037] wherein G is a base point of an elliptic curve, O is an infinite point of the elliptic curve, and [] represents a point multiplication operation on the elliptic curve.

[0038] In a possible implementation, in the two-party collaborative key exchange device,

[0039] The first key exchange unit receives a second public key R A sent by a third communication party, and verifies whether the second public key R A satisfies an elliptic curve equation, and if not, the negotiation fails.

[0040] The first key exchange unit generates a random number r1, calculates a partial random number public key R1 = [r1](P B - [d1]G), and sends the partial random number public key R1 and the second public key R A to the second key exchange unit.

[0041] The second key exchange unit generates a random number r2, calculates a third public key According to an SM2 algorithm, a parameter A is recovered from the second public key R A parameter B is recovered from the third public key R A third-party data is calculated A second partial shared secret point is calculated The third public key R B, the second part of the shared secret point V2 is sent to the first key exchange unit;

[0042] The first key exchange unit recovers the parameter A from the second public key R The first key exchange unit recovers the parameter B from the third public key R The third party data is calculated The first part of the shared secret point Then the shared secret point V = [h] (V1 + V2) is calculated, and if the shared secret point V is an infinite point, the negotiation fails.

[0043] The first key exchange unit calculates the shared key K B with the third communication party from the shared secret point V according to the SM2 algorithm. B The third public key R is sent to the third communication party.

[0044] In a possible implementation manner, in the two-party collaborative key exchange device provided in the application,

[0045] The first key exchange unit and the third communication party perform key confirmation based on the shared key.

[0046] The third aspect of the application provides a two-party collaborative key exchange system, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method of the first aspect of the application when executing the computer program.

[0047] The fourth aspect of the application provides a computer readable storage medium, which stores computer readable instructions, and the computer readable instructions can be executed by a processor to implement the method of the first aspect of the application.

[0048] Compared with the prior art, the two-party collaborative key exchange method, device, two-party collaborative key exchange system and storage medium provided by the embodiments of the present application are based on the SM2 algorithm, the first communication party generates a first sub-private key, and the second communication party generates a second sub-private key; based on the first sub-private key and the second sub-private key, the first communication party and the second communication party collaboratively generate a first public key common to both parties and make it public; after receiving the second public key sent by the third communication party, the first communication party and the second communication party collaboratively generate a third public key based on the first sub-private key, the second sub-private key and the first public key, send the third public key to the third communication party, and generate a shared key with the third communication party. In the present application, the private key is split into multiple sub-private keys and stored separately in different communication parties. When performing private key operations, each communication party performs operations using its own sub-private key and interacts with part of the operation results, so that the final private key operation result is obtained in a certain party. In the private key generation and private key operation process, the complete private key does not appear, which can effectively improve the security of the private key. In addition, the present scheme can reuse the basic operation module of the SM2 algorithm, has strong operability, and can meet the low-delay, low-interaction cloud computing environment. BRIEF DESCRIPTION OF DRAWINGS

[0049] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not intended to limit the scope of the present application. Moreover, the same reference numerals are used throughout the various drawings to designate similar or equivalent parts. In the drawings:

[0050] Figure 1 A flowchart of a two-party collaborative key exchange method provided by the present application is shown;

[0051] Figure 2 One of the flowcharts of the key generation stage provided by the present application is shown;

[0052] Figure 3 The second flowchart of the key generation stage provided by the present application is shown;

[0053] Figure 4 A flowchart of the collaborative key exchange stage provided by the present application is shown;

[0054] Figure 5 A schematic diagram of a two-party collaborative key exchange device provided by the present application is shown;

[0055] Figure 6 A schematic diagram of a two-party collaborative key exchange system provided by the present application is shown;

[0056] Figure 7 A schematic diagram of a computer-readable storage medium provided by the present application is shown. DETAILED DESCRIPTION

[0057] Exemplary embodiments of the present disclosure will be described in greater detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.

[0058] It should be noted that the technical terms or scientific terms used in the present application should be understood as their ordinary meanings understood by those skilled in the art, unless otherwise specified.

[0059] In addition, the terms "first" and "second" and the like are used to distinguish different objects, rather than to describe a particular order. Furthermore, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus including a series of steps or units is not limited to the listed steps or units, but can optionally include other steps or units not listed or can optionally include other steps or units inherent to such processes, methods, products, or apparatuses.

[0060] To solve the private key security problem in the prior art, a feasible solution is to use a multi-party cooperative method, in which the private key is divided into multiple parts and stored separately in different terminals. When performing private key operation, each terminal performs operation using its own sub-private key and interacts with part of the operation result, so that the final private key operation result is obtained at a certain party. In the private key generation and private key operation process, the complete private key does not appear, which can effectively improve the security of the private key.

[0061] Elliptic curve cryptography (ECC) is a public key system based on an elliptic curve algorithm defined on a finite field. The SM2 algorithm is a specific algorithm of the ECC cryptographic system. The SM2 algorithm is divided into three parts: a digital signature algorithm, a key exchange protocol, and a public key encryption algorithm. At present, there are many two-party or multi-party cooperative signature or cooperative decryption schemes based on the SM2 algorithm, but there is no cooperative key exchange scheme based on the SM2 algorithm, and the present application can fill this gap.

[0062] To further illustrate the scheme of the embodiments of the present application, the following will be described with reference to the accompanying drawings. It can be understood that in the following embodiments, the same or corresponding contents can be referred to each other, and for the sake of simplicity, the subsequent description will not be repeated.

[0063] Reference should be made to Figure 1The diagram illustrates a flowchart of a two-party collaborative key exchange method provided in an embodiment of this application. The method can be implemented by a two-party collaborative key exchange system, which includes a first communicating party and a second communicating party, such as a client and a server. This application can be divided into a key generation stage and a collaborative key exchange stage.

[0064] like Figure 1 As shown, the above-mentioned two-party collaborative key exchange method may include the following steps S101 to S103:

[0065] S101. Based on the SM2 algorithm, the first communicating party generates the first sub-private key, and the second communicating party generates the second sub-private key.

[0066] In this application, the first communicating party and the second communicating party share the elliptic curve parameters E(F) of the SM2 algorithm. q The elliptic curve E is defined in the finite field F. q Let G be an elliptic curve on the x-axis, where G is the base point of the elliptic curve with order n, O is the point at infinity of the elliptic curve, and h is the cofactor of the elliptic curve.

[0067] In this application, [] represents a dot product operation on E, [k]G represents a dot product of G multiplied by k, and mod n represents a modulo n operation. For elliptic curve point addition and numerical addition, the plus sign + is used: if it is the addition of elliptic curve points, then + represents point addition; if it is the addition of numerical values, then + represents numerical addition.

[0068] S102. Based on the first sub-private key and the second sub-private key, the first communicating party and the second communicating party jointly generate a first public key and publish it.

[0069] Specifically, such as Figure 2 As shown, the key generation phase includes the following steps:

[0070] The first communicating party uses a random number generator to generate a random number d1∈[1,n-1], and stores the random number d1 as the first sub-private key;

[0071] The second communicating party uses a random number generator to generate a random number d2∈[1,n-1], and stores the random number d2 as the second sub-private key;

[0072] The first communicating party calculates a portion of the public key P1 = [d1]G and sends the portion of the public key P1 to the second communicating party;

[0073] The second communicating party receives a portion of the public key P1 transmitted by the first communicating party and calculates the first public key P. B =P1+[d2]G, if P B =O or P B+G=O, the second communication party needs to generate a new random number d2, otherwise P B The first public key is disclosed.

[0074] In this application, the processes of the first communication party and the second communication party can be interchanged, that is, the key generation stage described above can also be modified as follows, as shown in Figure 3

[0075] The second communication party generates a random number d2∈[1, n-1] using a random number generator, and stores the random number d2 as a second sub-private key;

[0076] The second communication party calculates a partial public key P2=[d2]G, and sends the partial public key P2 to the first communication party;

[0077] The first communication party generates a random number d1∈[1, n-1] using a random number generator, and stores the random number d1 as a first sub-private key;

[0078] The first communication party receives the partial public key P2 transmitted by the second communication party, and calculates a first public key P B =P1+[d1]G, if P B =O or P B +G=O, the first communication party needs to generate a new random number d1, otherwise P B The first public key is disclosed.

[0079] In this embodiment, the private key is divided into two sub-private keys, which can be stored in different terminals, and is more suitable for the application scenarios in which many mobile intelligent terminals are involved.

[0080] S103, after receiving the second public key sent by the third communication party, the first communication party and the second communication party generate a third public key based on the first sub-private key, the second sub-private key and the first public key, send the third public key to the third communication party, and generate a shared key with the third communication party.

[0081] Specifically, as shown in Figure 4 The collaborative key exchange stage includes the following steps:

[0082] The first communication party receives the second public key R A sent by the third communication party, and verifies whether the second public key R A satisfies the elliptic curve equation, if not, the negotiation fails;

[0083] The first communication party generates a random number r1∈[1, n-1], and calculates a partial random number public key R1=[r1](P B -[d1]G), and sends the partial random number public key R1 and the second public key R A to the second communication party; ​

[0084] The second communication party generates a random number r2∈[1, n-1], calculates a third public key According to a related method in the SM2 algorithm, parameters are recovered from the second public key R A Parameters are recovered from the third public key R B Third-party data is calculated Then, a second partial shared secret point V2 is calculated The third public key R B , the second partial shared secret point V2 are sent to the first communication party.

[0085] According to the SM2 algorithm, parameters are recovered from the second public key R A Parameters are recovered from the third public key R B Third-party data is calculated A first partial shared secret point V1 is calculated Then, a shared secret point V = [h](V1+V2) is calculated, and if the shared secret point V is an infinite point, the negotiation fails; wherein h is a cofactor of an elliptic curve.

[0086] According to the SM2 algorithm, a shared secret key K B is calculated by the first communication party from the shared secret point V and the third communication party. B The third public key R B is sent to the third communication party. Optionally, the first communication party and the third communication party can perform a corresponding key confirmation step in the SM2 algorithm based on the shared secret key K B .

[0087] In this application, no new cryptographic operation is introduced in the collaborative key exchange process, the calculation is simple, less data is transmitted in the communication process, and it is more suitable for cloud computing environments that require low delay and high interaction.

[0088] For ease of understanding, the specific process of the two-party collaborative key exchange method described above is introduced as follows in one specific embodiment:

[0089] Suppose that the two parties for key exchange are users A and B. User B is split into a first communication party and a second communication party (user A can use the original SM2 key exchange algorithm architecture, or can also be split, and if both parties are split, the process of the split algorithm needs to be adjusted accordingly), and collaborates with user A for key exchange, and user A is the third communication party.

[0090] ​​In the key generation stage, the first communication party generates and stores its own sub-private key d1, the second communication party generates and stores its own sub-private key d2, and a common public key P is calculated and disclosed B .

[0091] In the collaborative key exchange stage, the first communication party receives the random number public key R sent by the user A A , generates a random number, calculates a partial random number public key R1, and sends R1 and R A to the second communication party; the second communication party generates a random number and calculates a common random number public key R B and a second partial shared secret point V2 on the basis of the random number, and sends R B and V2 to the first communication party; the first communication party finally calculates a shared secret point V with the user A, and generates a shared key K B on the basis of the shared secret point V, sends R B to the user A, and optionally performs a corresponding key confirmation link with the user A in the SM2 algorithm based on the shared key K B .

[0092] The two-party collaborative key exchange method provided in the application includes a key generation stage and a collaborative key exchange stage. In the key generation stage, the first communication party and the second communication party, two participants, generate and store their respective sub-private keys and calculate and disclose a common public key. In the collaborative key exchange stage, after receiving the random number public key sent by the third communication party, the two parties interact with each other, use their respective sub-private keys to collaboratively generate a common random number public key and send the common random number public key to the third communication party, and generate a shared key with the third communication party. In the entire process, the private key is split and stored by the first communication party and the second communication party, and the real private key never appears, thereby ensuring the security of the SM2 private key; and the method can be implemented by using the basic operation module of the SM2 algorithm without adding additional operation modules, thereby reducing the layout cost, reducing the communication and calculation amount, and being suitable for a cloud computing environment.

[0093] The application can complete the generation and storage of the sub-private keys of the two parties and disclose the common public key through one round of information transmission, and make one of the communication parties generate a shared key obtained through the key exchange with the third party through two rounds of information transmission. The application ensures that the two communication parties can complete the key exchange with the third party through two rounds of information transmission on the premise that the sub-private key information of the other party cannot be obtained.

[0094] In the above embodiment, a two-party collaborative key exchange method is provided, and a two-party collaborative key exchange device corresponding to the method is also provided. Please refer to Figure 5Fig. 6 shows a schematic diagram of another two-party collaborative key exchange device according to some embodiments of the present application. Since the device embodiments are basically similar to the method embodiments, they are described more simply, and the relevant parts refer to the part of the method embodiments. The device embodiments described below are only schematic.

[0095] As shown in Fig. 6, the two-party collaborative key exchange device 10 can include a first communication party 100 and a second communication party 200. Figure 5

[0096] The first communication party 100 includes a first key generation unit 110 and a first key exchange unit 120.

[0097] The second communication party 200 includes a second key generation unit 210 and a second key exchange unit 220.

[0098] The first key generation unit 110 generates a first sub-private key based on the SM2 algorithm.

[0099] The second key generation unit 210 generates a second sub-private key based on the SM2 algorithm.

[0100] The first key generation unit 110 and the second key generation unit 210 collaboratively generate a first public key common to the first communication party and the second communication party based on the first sub-private key and the second sub-private key and disclose it.

[0101] After receiving the second public key sent by the third communication party, the first key exchange unit 120 and the second key exchange unit 220 collaboratively generate a third public key based on the first sub-private key, the second sub-private key and the first public key.

[0102] The first key exchange unit 120 sends the third public key to the third communication party and generates a shared key with the third communication party.

[0103] In a possible implementation, in the two-party collaborative key exchange device of the present application,

[0104] The first key generation unit 110 is specifically configured to generate a random number d1 by a random number generator and store the random number d1 as the first sub-private key.

[0105] The second key generation unit 210 is specifically configured to generate a random number d2 by a random number generator and store the random number d2 as the second sub-private key.

[0106] In a possible implementation, in the two-party collaborative key exchange device of the present application,

[0107] ​The first key generation unit 110 is also specifically used to: calculate a partial public key P1 = [d1]G and send the partial public key P1 to the second key generation unit 210;

[0108] The second key generation unit 210 is further specifically configured to: receive a portion of the public key P1 transmitted by the first key generation unit 110, and calculate the first public key P B =P1+[d2]G, if P B =O or P B If +G = 0, then regenerate random number d2; otherwise, P... B Publicly disclosed as the first public key;

[0109] Where G is the base point of the elliptic curve, O is the point at infinity of the elliptic curve, and [] represents the dot product operation on the elliptic curve.

[0110] In one possible implementation, in the aforementioned two-party collaborative key exchange device of this application,

[0111] The first key exchange unit 120 receives the second public key R sent by the third communicating party. A And verify the second public key R A Check if the equation of the elliptic curve is satisfied; if not, the negotiation fails.

[0112] The first key exchange unit 120 generates a random number r1 and calculates a partial random number public key R1 = [r1](P B -[d1]G), using part of the random number public key R1 and the second public key R A Send to the second key exchange unit 220;

[0113] The second key exchange unit 220 generates a random number r2 and calculates the third public key. According to the SM2 algorithm, from the second public key R A Parameters recovered From the third public key R B Parameters recovered Calculate third-party data Next, the second part of the shared secret point was calculated. Use the third public key R B The second part, shared secret point V2, is sent to the first key exchange unit 120;

[0114] The first key exchange unit 120 obtains the second public key R from the SM2 algorithm. A Parameters recovered From the third public key R B Parameters recovered Calculate third-party data The first shared secret point Then, a shared secret point V = [h](V1+V2) is calculated, and if the shared secret point V is an infinite point, the negotiation fails.

[0115] The first key exchange unit 120 calculates a shared key K with the third communication party from the shared secret point V according to an SM2 algorithm. B The third public key R B is sent to the third communication party.

[0116] In a possible implementation, in the two-party collaborative key exchange device provided in the above embodiments of the present application,

[0117] The first key exchange unit and the third communication party perform key confirmation based on the shared key.

[0118] The two-party collaborative key exchange device provided by the embodiments of the present application and the two-party collaborative key exchange method provided by 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 them.

[0119] The embodiments of the present application also provide a two-party collaborative key exchange system corresponding to the two-party collaborative key exchange method provided in the above embodiments, such as a mobile phone, a notebook computer, a tablet computer, a desktop computer, etc., to execute the above two-party collaborative key exchange method.

[0120] Please refer to Figure 6 which shows a schematic diagram of a two-party collaborative key exchange system provided by some embodiments of the present application. As shown in Figure 6 The two-party collaborative key exchange system 20 includes a processor 200, a memory 201, a bus 202 and a communication interface 203, the processor 200, the communication interface 203 and the memory 201 are connected through the bus 202; the memory 201 stores a computer program which can run on the processor 200, and the processor 200 executes the two-party collaborative key exchange method provided by any of the above embodiments of the present application when running the computer program.

[0121] The memory 201 can include a high-speed random access memory (RAM: Random Access Memory) and can 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 communication interface 203 (which can be wired or wireless), and the Internet, a wide area network, a local network, a metropolitan area network, etc. can be used.

[0122] The bus 202 can be an ISA bus, a PCI bus, an EISA bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, and the like. The memory 201 is configured to store a program, and the processor 200 executes the program after receiving an execution instruction. The two-party collaborative key exchange method disclosed in any of the embodiments of the present application can be applied to the processor 200 or implemented by the processor 200.

[0123] The processor 200 can be an integrated circuit chip with a processing capability of signals. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 200 or an instruction in the form of software. The processor 200 described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), and the like; or can be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a ready-to-program gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. Each method, step, and logic block diagram disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware coding processor for execution, or a combination of hardware and software modules in the coding processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, or other mature storage media in the art. The storage medium is located in the memory 201, and the processor 200 reads information in the memory 201 and combines hardware to complete the steps of the above method.

[0124] The two-party collaborative key exchange system provided by the embodiments of the present application and the two-party collaborative key exchange method provided by the embodiments of the present application have the same beneficial effects as the method adopted, run, or implemented.

[0125] The embodiments of the present application also provide a computer-readable storage medium corresponding to the two-party collaborative key exchange method provided in the foregoing embodiments. Please refer to Figure 7 The computer-readable storage medium shown is an optical disc 30, and a computer program (i.e., a program product) is stored on the optical disc 30. When the computer program is run by a processor, the two-party collaborative key exchange method provided in any of the foregoing embodiments is executed.

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

[0127] The computer-readable storage medium provided by the above embodiments of the present application has the same beneficial effects as the method adopted, run or implemented by the application program stored therein, based on the same inventive concept as the two-party collaborative key exchange method provided by the embodiments of the present application.

[0128] It should be noted that the flowcharts and block diagrams in the drawings show the possible implementation architecture, function and operation of the system, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order from that shown in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0129] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be described here.

[0130] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interfaces, devices or units, which can be electrical, mechanical or other forms.

[0131] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0132] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0133] If the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the prior art that essentially contributes can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various program code storage media.

[0134] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and they should be covered in the scope of the claims and the specification of the present application.

Claims

1. A two-party key exchange method, characterized by, The method comprises the steps of: Based on the SM2 algorithm, the first communication party generates a first sub-private key, and the second communication party generates a second sub-private key; Based on the first sub-private key and the second sub-private key, the first communication party and the second communication party jointly generate a first public key common to both parties and make it public; After receiving the second public key sent by the third communication party, the first communication party and the second communication party jointly generate a third public key based on the first sub-private key, the second sub-private key and the first public key, send the third public key to the third communication party, and generate a shared key with the third communication party; Wherein, the first communication party generates a first sub-private key, and the second communication party generates a second sub-private key, comprising: The first communication party uses a random number generator to generate a random number d1, and stores the random number d1 as the first sub-private key; The second communication party uses a random number generator to generate a random number d2, and stores the random number d2 as the second sub-private key; Wherein, the first communication party and the second communication party jointly generate a first public key common to both parties based on the first sub-private key and the second sub-private key, and make it public, comprising: The first communication party calculates a partial public key P1 = [d1]G, and sends the partial public key P1 to the second communication party; The second communication party receives the partial public key P1 transmitted by the first communication party, and calculates the first public key P B = P1 + [d2]G, if P B = O or P B + G = O, the second communication party needs to re-generate the random number d2, otherwise P B is disclosed as the first public key Wherein, G is the base point of the elliptic curve, O is the infinite point of the elliptic curve, and [] represents the point multiplication operation on the elliptic curve; Wherein, after receiving the second public key sent by the third communication party, the first communication party and the second communication party jointly generate a third public key based on the first sub-private key, the second sub-private key and the first public key, send the third public key to the third communication party, and generate a shared key with the third communication party, comprising: The first communication party receives the second public key R sent by the third communication party A and verifies the second public key R A whether the elliptic curve equation is satisfied, and if not, the negotiation fails The first communication party generates a random number r1, calculates a partial random number public key R1 = [r1](P B - [d1]]G), sends the partial random number public key R1 and the second public key R A to the second communication party; The second communicating party generates a random number r2 and calculates the third public key. According to the SM2 algorithm, from the second public key R A Parameters recovered From the third public key R B Parameters recovered Calculate third-party data Next, the second part of the shared secret point was calculated. Use the third public key R B The second part, shared secret point V2, is sent to the first communicating party; where P A This represents the long-term public key of the third-party communicator; The first communication party recovers parameters from the second public key R A The first communication party recovers parameters from the third public key R B The third party data is calculated The first part of the shared secret point Then, the shared secret point V=[h](V1+V2) is calculated, and if the shared secret point V is an infinite point, the negotiation fails; wherein, h is the cofactor of the elliptic curve.​​ The first communication party calculates the shared key K with the third communication party according to the SM2 algorithm from the shared secret point V B The third public key R B is sent to the third communication party.

2. The method of claim 1, wherein, The method further comprises: the first communication party and the third communication party perform key confirmation based on the shared key.

3. An apparatus for two-party key exchange, characterized by The method comprises the steps of: A first communication party and a second communication party; The first communication party comprises a first key generation unit and a first key exchange unit: The second communication party comprises a second key generation unit and a second key exchange unit; The first key generation unit generates a first sub-private key based on the SM2 algorithm; The second key generation unit generates a second sub-private key based on the SM2 algorithm; The first key generation unit and the second key generation unit jointly generate a first public key common to the first communication party and the second communication party based on the first sub-private key and the second sub-private key, and make it public; After receiving the second public key sent by the third communication party, the first key exchange unit and the second key exchange unit jointly generate a third public key based on the first sub-private key, the second sub-private key and the first public key; The first key exchange unit sends the third public key to the third communication party, and generates a shared key with the third communication party; Wherein, the first key generation unit is specifically configured to use a random number generator to generate a random number d1, and store the random number d1 as the first sub-private key; Wherein, the second key generation unit is specifically configured to use a random number generator to generate a random number d2, and store the random number d2 as the second sub-private key; Wherein, the first key generation unit is further specifically configured to calculate a partial public key P1 = [[d1]G, and send the partial public key P1 to the second key generation unit; The second key generating unit is also specifically configured to receive the partial public key P1 transmitted by the first key generating unit, calculate a first public key P B = P1 + [d2]G, if P B = O or P B + G = O, then regenerate the random number d2, otherwise, take P B as the first public key and publish it. Wherein, G is a base point of the elliptic curve, O is an infinite point of the elliptic curve, and [] represents a point multiplication operation on the elliptic curve. The first key exchange unit receives a second public key R sent by a third communication party A and verifies whether the second public key R A satisfies an elliptic curve equation, and if not, negotiation fails. The first key exchange unit generates a random number r1, calculates a partial random number public key R1 = [r1](P B -[d1]G), sends the partial random number public key R1 and the second public key R A to the second key exchange unit. The second key exchange unit generates a random number r2, calculates a third public key According to the SM2 algorithm, a parameter is recovered from the second public key R A A parameter is recovered from the third public key R B Third-party data is calculated Then, a second partial shared secret point V2 is calculated The third public key R B , the second partial shared secret point V2 are sent to the first key exchange unit; wherein P A represents a long-term public key of the third communication party;​​ The first key exchange unit recovers parameters from the second public key R A The third public key R B The third party data The first part of the shared secret point Then the shared secret point V = [h] (V1 + V2) is calculated, and if the shared secret point V is an infinite point, the negotiation fails.​​ The first key exchange unit calculates a shared key K with the third communication party according to the SM2 algorithm from the shared secret point V B The third public key R B is sent to the third communication party.

4. A two-party key exchange system comprising: Memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method of any one of claims 1 to 2.

5. A computer-readable storage medium having stored thereon computer-readable instructions executable by a processor to implement the method of any one of claims 1 to 2.

Citation Information

Patent Citations

  • Collaborative decryption method, device and system based on SM2 algorithm, and medium

    CN111049650A

  • Two-party collaborative signature and decryption method and system based on SM2 algorithm

    CN113849831A