Data processing method, device and system
By verifying the key and intermediate data in the process of threshold encryption, decryption and signature, the problem of inability to guarantee the accuracy of the key in the existing technology is solved, and the efficiency and security of data processing are improved.
Patent Information
- Application Number
- CN202011063484.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-30
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-09-30
AI Technical Summary
In the process of threshold encryption and threshold signature in the existing technology, the accuracy of the key cannot be effectively verified, resulting in reduced efficiency in using the key.
In the process of threshold encryption, threshold decryption and threshold signature, the electronic equipment participating in the calculation verifies the key and intermediate data used to ensure their accuracy before subsequent processing. Specific methods include verifying the correctness of public keys and signature parameters through multi-party multiplication protocols and zero-knowledge proofs, ensuring the accuracy of private key sharding and calculation data provided by each participant.
It improves the efficiency and accuracy of data processing, prevents key use failures caused by incorrect data, and enhances the security and reliability of the system.
Smart Images

Figure CN114337994B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device and system. Background Art
[0002] With the continuous development of electronic technology and Internet communication technology, people use electronic devices to transmit more and more data. Some important data are subject to security risks of data leakage and tampering during the transmission process. At the same time, some electronic devices themselves are also prone to remote control and illegal manipulation. Therefore, ensuring the security of data transmitted between electronic devices has become an important development and research direction in the industry.
[0003] In the existing threshold encryption technology, the public key and private key of the electronic device are shared by multiple participants, each of which holds a private key slice of the electronic device. In the case of not recovering the private key itself and not exposing the private key slice held by each participant, the multiple participants can jointly complete the encryption or decryption of the data of the electronic device; in the existing threshold signature technology, the public key and private key of the electronic device are shared by multiple participants, each of which holds a private key slice of the electronic device. In the case of not recovering the private key itself and not exposing the private key slice held by each participant, the multiple participants can jointly complete the signing or verification of the data of the electronic device.
[0004] However, the prior art cannot guarantee the accuracy of the keys jointly provided by multiple participating devices when obtaining keys and using them for threshold signing, threshold encryption, and threshold decryption. Once the key used is itself wrong, the data cannot be further encrypted, decrypted, and signed based on the wrong key, thereby reducing the success rate of the electronic device in processing data, and further reducing the efficiency of the electronic device in processing data. Summary of the invention
[0005] The present application provides a data processing method, device and system to solve the problem of lack of verification of the key itself and the intermediate data related to the key calculation in the existing technology. In the data processing process related to threshold encryption, threshold decryption and threshold signature, the electronic devices involved in the relevant calculations verify the used keys and intermediate data before continuing to process the keys, thereby ensuring the processing efficiency of the electronic devices when using the keys to process data.
[0006] The first aspect of the present application provides a data processing method, which is applied to a scenario where n participating devices jointly calculate and generate a public key of a first electronic device. When multiple participating devices jointly calculate the public key of the first electronic device, the target participating device among the multiple participating devices does not output the public key of the first electronic device immediately after obtaining it, but verifies whether the generated public key of the first electronic device is accurate, and only outputs it for subsequent calculation when the verification is passed, otherwise the obtained public key will not be output. Therefore, in this embodiment, the target participating device also verifies the public key after obtaining the public key of the first electronic device, and only outputs it after the verification is passed, so as to prevent the participating device from providing wrong data and calculating the wrong public key due to being attacked, stolen, etc. when multiple participating devices jointly calculate the public key of the first electronic device, thereby ensuring the accuracy of the calculated public key, and then ensuring the accuracy of the first electronic device when using its public key to process data, so that other devices can also obtain the correct public key, and improve the efficiency of the first electronic device in processing data.
[0007] In an embodiment of the first aspect of the present application, the target participant device specifically calculates the public key to be verified by using the IDs of any t participant devices among the n participant devices, and then determines whether all the calculated public keys to be verified are the same, and only outputs the obtained public key if they are the same. Therefore, it is possible to find an error when the intermediate data provided by any participant device is wrong. If the verification is passed, it means that the private key fragments provided by the multiple participant devices participating in the calculation of the public key of the first electronic device are correct, so that it can be guaranteed that the public key obtained by subsequent calculation is also correct.
[0008] In an embodiment of the first aspect of the present application, the target participant device specifically determines the public key calculation parameters, i.e., the first commitment information, the target participant device, and sends the determined private key shard to the other n-1 participant devices in the following manner; receives the private key shards sent by the other n-1 participant devices; then, the target participant device adds the received n-1 private key shards and the 1 private key shard determined by itself to obtain a joint shard; then, the target participant device determines the first commitment information based on the joint shard and the base point of the elliptic curve, and sends the determined first commitment information to the other n-1 participant devices; finally, the target participant device receives the first commitment information sent by the other n-1 participant devices, and the other n-1 participant devices calculate the first commitment information in the same way as the target participant device.
[0009] In an embodiment of the first aspect of the present application, it is applied to a scenario where t participant devices among n participant devices jointly sign data sent by a first electronic device to a second electronic device, and when multiple participant devices jointly calculate the signature information of the first electronic device, the target participant device among the multiple participant devices does not immediately calculate the signature information after obtaining the calculation information of the signature information of the first electronic device, but verifies whether the obtained calculation information is accurate, and only continues to calculate the signature information if the verification is passed, otherwise the signature information will not be calculated. Therefore, in this embodiment, the target participant device also verifies the calculation information after obtaining the calculation information of the signature information of the first electronic device, and only calculates the signature information of the first electronic device after the verification is passed, so as to prevent the error of the signature information caused by the participant device providing wrong data due to attack, theft, etc. when multiple participant devices jointly calculate the signature information of the first electronic device, thereby ensuring the accuracy of the signature information of the calculated first electronic device, and further ensuring the accuracy of the digital signature of the data of the first electronic device by multiple participant devices, so that other devices receiving the data can successfully verify the signature information of the first electronic device, and improve the efficiency of the first electronic device in processing data.
[0010] In an embodiment of the first aspect of the present application, the target participant device specifically determines the signature parameters Tao and Beta through the following steps. The target participant device calculates the parameters M, N, L, R and sign_sk i ; Where t≤n, parameter M is the parameter M provided by t participating devices i The sum of M i The i-th participant device among the t participant devices uses the formula M i =ro i *G is calculated, G is the base point of the elliptic curve, ro i is a random number; parameter R is the parameter R provided by t participating devices i The sum, R i The i-th participant device among the t participant devices uses the formula R i =k i *G is calculated; parameter N is the parameter N provided by t participating devices i sum, N i The i-th participant device among the t participant devices uses the formula N i =ro i *PK is calculated, where PK is the public key of the first electronic device; parameter L is the parameter L provided by t participating devices i The sum of L i =ro i *R; parameter sign_ski By formula sign_sk i =lambda i *p(ID i ) is calculated, where lambda i The target device is obtained by the ID of t participants; the target device is obtained by the parameter ro i and parameter 1 / t+sign_sk i (mod q) is used as the input of the first multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter w i After that, the calculated w i The target device sends the data to the other t-1 devices among the t participants. The target device sends the data to the other t-1 devices among the t participants with the parameter ro. i and k i –r*sign_sk i (mod q) is used as the input of the second multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter v i After that, the calculated v i Send to the other t-1 participant devices among the t participant devices; r is the first part of the signature sigma=[r,s] of the first electronic device; the target participant device receives the parameter w sent by the other t-1 participant devices among the t participant devices i , and the received t-1 parameters w i And a parameter w determined by itself i The signature parameter Beta is calculated; the target participant device receives the parameter v sent by the other t-1 participant devices among the t participant devices i , and the received t-1 parameters v i And a parameter v determined by itself i The signature parameter Tao is calculated.
[0011] In an embodiment of the first aspect of the present application, the target participant device verifies whether the formula Beta*G=M+N and the formula Tao*G=L–r*N are established; wherein, if both formulas are established, the verification is passed.
[0012] In the two multi-party multiplication protocols designed in this embodiment, different parameters are used, so that the two multi-party multiplication protocols are independent of each other and do not interfere with each other. Therefore, in the specific execution process of this embodiment, t participating devices can simultaneously execute the two multi-party multiplication protocols in parallel. Compared with the method in the prior art in which the parameters of the two multi-party multiplication protocols are the same and the parameters are interactive, it can also improve the computing efficiency, save the time required for computing, and can also be equivalent to further improving the efficiency of electronic devices in processing data.
[0013] In an embodiment of the first aspect of the present application, the target participant device can obtain the signature information of the first electronic device by specifically calculating through the following steps: the target participant device calculates the first part r of the signature sigma=[r,s] of the first electronic device through the formula r=e+x1(mod q), where e=Hash(message||Z), message is the message, and Z is the public string; the target participant device calculates the second part s of the signature sigma=[r,s] of the first electronic device through the formula s=Tao / Beta; the target participant device obtains the signature sigma=[r,s] of the first electronic device based on the first part r and the second part s.
[0014] In an embodiment of the first aspect of the present application, a method for decrypting data sent from a third electronic device to a first electronic device by t participant devices among n participant devices is applied. When multiple participant devices decrypt data received by the first electronic device, the target participant device among the multiple participant devices does not immediately decrypt the data after obtaining the decryption parameter of the first electronic device, but verifies whether the obtained decryption parameter is accurate, and continues to decrypt the data only when the verification is passed, otherwise the data will not be decrypted. Therefore, in this embodiment, the target participant device also verifies the decryption parameter after obtaining the decryption parameter of the first electronic device, so as to prevent the decryption parameter error caused by the participant device providing wrong data due to attack, theft, etc. when multiple participant devices jointly decrypt the data received by the first electronic device, thereby ensuring the accuracy of the calculated decryption parameter of the first electronic device, and further ensuring the accuracy of the decryption of the data of the first electronic device by multiple participant electronic devices, thereby improving the efficiency of the first electronic device in processing data.
[0015] In an embodiment of the first aspect of the present application, the target participant device specifically determines the decryption parameter by the following method: the target participant device calculates the parameter R i , parameter Q i And parameter proof i ; Among them, the parameter R i =decrypt_ski *C1,decrypt_sk i =lambda i *p(ID i ), ID i Used to represent the ID of the i-th participant device among the t participant devices, the Lagrangian coefficient lambda i Obtained from the IDs of t participating devices; parameter Q i =decrypt_sk_i*G, G is the base point of the elliptic curve; parameter proof_i is the device P of the participant i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof; C1 is the first part of the ciphertext C = {C1||C2||C3} for the data received by the first electronic device; the target participant device sets the parameter R i , parameter Q i And parameter proof i Send to other t-1 participating devices; the target participating device receives the parameter R sent by other t-1 participating devices i , parameter Q i And parameter proof i , combined with the target participant's parameter R i , parameter Q i And parameter proof i , and obtain the decryption parameters R1, R2, …, R of t participating devices t and the decryption parameters Q1, Q2, …, Q of the t participating devices t As multiple decryption parameters.
[0016] In an embodiment of the first aspect of the present application, the target participant device specifically verifies the decryption parameters by the following method: the target participant device verifies the decryption parameters R1, R2, ..., R t and the decryption parameters Q1, Q2, …, Q of the t participating devices t The correctness of the decryption parameters proof1, proof2, …, proof t The validity of the DHTuple zero-knowledge proof is verified, and the formula PK=Q1+Q2+…+Q t Whether it is established; among them, when the correctness, validity and formula are all established, the verification is passed.
[0017] In an embodiment of the first aspect of the present application, the target participant device specifically decrypts the data by the following method: the target participant device decrypts the data by the formula R=R1+R2+…+R t=(x1,y1) calculates parameters x1 and y1, and calculates parameter e through formula e=KDF(x1||y1||parameters), where parameters are public parameters and KDF is a key generation function; the target participant device calculates the plaintext data M' to be verified through formula M'=C2 XOR e; where C2 is the second part of the ciphertext C={C1||C2||C3} set for the data received by the first electronic device; the target participant device calculates parameter C3' according to formula C3'=Hash(x1||M||y1), and determines whether C3' is equal to C3, where C3 is the third part of the ciphertext C={C1||C2||C3} set for the data received by the first electronic device; when C3'=C3, the target participant device determines to output the plaintext data M'.
[0018] The second aspect of the present application provides a data processing device, which can be used as a target participant device and execute the data processing method provided in the first aspect of the present application. The data transmission device can be applied to a data processing system, which includes: a first electronic device and n participant devices, n is an integer greater than 1, and the data processing device is the target participant device among the n participant devices. The data processing device includes: a determination module, which is used to receive public key calculation parameters sent by other n-1 participant devices; wherein the public key calculation parameters are used to calculate the public key of the first electronic device, and the public key of the first electronic device is calculated according to the received n-1 public key calculation parameters and its own 1 public key calculation parameter; a verification module, which is used to verify the public key of the first electronic device; and a processing module, which is used to output the public key of the first electronic device if the verification by the verification module is successful.
[0019] In an embodiment of the second aspect of the present application, the public key calculation parameters include: a first commitment information; the determination module is specifically used to randomly select t first commitment information from the received n-1 first commitment information and its own 1 first commitment information, calculate the public key to be verified of the first electronic device, and repeat multiple times to obtain multiple public keys to be verified; the verification module is specifically used to verify whether the multiple public keys to be verified are the same; wherein, when the multiple public keys to be verified are the same, the verification is passed, and the determination module determines that the public key of the first electronic device is any one of the multiple public keys to be verified.
[0020] In an embodiment of the second aspect of the present application, the determination module is specifically used to determine the private key shard, and send the determined private key shard to the other n-1 participant devices; receive the private key shards sent by the other n-1 participant devices; add the received n-1 private key shards and the 1 private key shard determined by itself to obtain a joint shard; determine the first commitment information based on the joint shard and the base point of the elliptic curve, and send the determined first commitment information to the other n-1 participant devices; receive the first commitment information sent by the other n-1 participant devices, and the other n-1 participant devices calculate the first commitment information in the same way as the target participant device.
[0021] In an embodiment of the second aspect of the present application, the determination module is also used to determine at least two signature parameters; wherein the at least two signature parameters are used to obtain the signature information of the first electronic device; the verification module is also used to verify the at least two signature parameters; the processing module is also used to calculate the signature information of the first electronic device based on the at least two signature parameters if the verification by the verification module passes.
[0022] In an embodiment of the second aspect of the present application, the determination module is specifically used to calculate the parameters M, N, L, R and sign_sk i ; Where t≤n, parameter M is the parameter M provided by t participating devices i The sum of M i The i-th participant device among the t participant devices uses the formula M i =ro i *G is calculated, G is the base point of the elliptic curve, ro i is a random number; parameter R is the parameter R provided by t participating devices i The sum, R i The i-th participant device among the t participant devices uses the formula R i =k i *G is calculated; parameter N is the parameter N provided by t participating devices i sum, N i The i-th participant device among the t participant devices uses the formula N i =ro i *PK is calculated, where PK is the public key of the first electronic device; parameter L is the parameter L provided by t participating devices i The sum of L i =ro i *R; parameter sign_sk i By formula sign_sk i =lambda i*p(ID i ) is calculated, where lambda i Obtained from the IDs of t participating devices; with parameter ro i and parameter 1 / t+sign_sk i (mod q) is used as the input of the first multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter w i After that, the calculated w i Sent to the other t-1 participating devices among the t participating devices; with parameter ro i and k i –r*sign_sk i (mod q) is used as the input of the second multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter v i After that, the calculated v i Send to the other t-1 participant devices among the t participant devices; the r is the first part of the signature sigma=[r,s] of the first electronic device; receive the parameter w sent by the other t-1 participant devices among the t participant devices i , and the received t-1 parameters w i And a parameter w determined by itself i Calculate the signature parameter Beta; receive the parameter v sent by the other t-1 participating devices among the t participating devices i , and the received t-1 parameters v i And a parameter v determined by itself i The signature parameter Tao is calculated.
[0023] In an embodiment of the second aspect of the present application, the verification module is specifically used to verify whether the formula Beta*G=M+N and the formula Tao*G=L–r*N are established; wherein, if both formulas are established, the verification is passed.
[0024] In an embodiment of the second aspect of the present application, the processing module is specifically used to calculate the first part r of the signature sigma=[r,s] of the first electronic device through the formula r=e+x1(modq), where e=Hash(message||Z), message is the message, and Z is the public string; calculate the second part s of the signature sigma=[r,s] of the first electronic device through the formula s=Tao / Beta; and obtain the signature sigma=[r,s] of the first electronic device based on the first part r and the second part s.
[0025] In an embodiment of the second aspect of the present application, the determination module is also used to determine multiple decryption parameters; wherein the decryption parameters are used to decrypt data received by the first electronic device; the verification module is also used to verify the multiple decryption parameters; the processing module is also used to decrypt the data received by the first electronic device based on the multiple decryption parameters.
[0026] In an embodiment of the second aspect of the present application, the determination module is specifically used to calculate the parameter R i , parameter Q i And parameter proof i ; Among them, the parameter R i =decrypt_sk i *C1,decrypt_sk i =lambda i *p(ID i ), ID i Used to represent the ID of the i-th participant device among the t participant devices, the Lagrangian coefficient lambda i Obtained from the IDs of t participating devices; parameter Q i =decrypt_sk_i*G, G is the base point of the elliptic curve; parameter proof_i is the device P of the participant i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof; C1 is the first part of the ciphertext C={C1||C2||C3} received by the first electronic device; the parameter R i , parameter Q i And parameter proof i Send to other t-1 participating devices; receive parameter R sent by other t-1 participating devices i , parameter Q i And parameter proof i , combined with the target participant's parameter R i , parameter Q i And parameter proof i , and obtain the decryption parameters R1, R2, …, R of t participating devices t and the decryption parameters Q1, Q2, …, Q of the t participating devices t as the multiple decryption parameters.
[0027] In an embodiment of the second aspect of the present application, the verification module is specifically used to verify the decryption parameters R1, R2, ..., R t and the decryption parameters Q1, Q2, …, Q of the t participating devices tThe correctness of the decryption parameters proof1, proof2, …, proof t The validity of the DHTuple zero-knowledge proof is verified, and the formula PK=Q1+Q2+…+Q t Whether it is established; among them, when the correctness, validity and formula are all established, the verification is passed.
[0028] In an embodiment of the second aspect of the present application, the processing module is specifically used to, through the formula R = R1 + R2 + ... + R t =(x1,y1) calculates parameters x1 and y1, and calculates parameter e through formula e=KDF(x1||y1||parameters), where parameters are public parameters and KDF is a key generation function; calculates the plaintext data M' to be verified through formula M'=C2 XOR e; where C2 is the second part of the ciphertext C={C1||C2||C3} set for the data received by the first electronic device; calculates parameter C3' according to formula C3'=Hash(x1||M||y1), and determines whether C3' is equal to C3, where C3 is the third part of the ciphertext C={C1||C2||C3} set for the data received by the first electronic device; when it is determined that C3'=C3, determines to output the plaintext data M'.
[0029] The third aspect of the present application provides a data processing system, including: a first electronic device and n participant devices, n is an integer greater than 1, and the n participant devices include a target participant device. The target participant device can be transmitted through the data transmission device time provided in any one of the second aspects of the present application.
[0030] A fourth aspect of the present application provides an electronic device, including: a processor and a communication interface.
[0031] The communication interface is used to realize the connection and communication between the communication device and the peripheral device.
[0032] The processor is used to implement the method described in any one of the first aspect, the second aspect or the third aspect.
[0033] As a possible design, the above-mentioned communication device also includes: a memory.
[0034] The memory is used to store a computer program, and the processor executes the computer program stored in the memory, so that the device performs the method described in any one of the first aspect, the second aspect, or the third aspect.
[0035] A fifth aspect of the present application provides a chip, including: a processor and a communication interface;
[0036] The communication interface is used to realize communication with other devices;
[0037] The processor is used to read instructions to implement the method as described in any one of the first aspect, the second aspect or the third aspect.
[0038] In a sixth aspect, the present application provides a computer program product, which includes a computer program code. When the computer program code is executed by a computer, the computer executes the method described in any one of the first, second or third aspects above. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is a schematic diagram of application scenario 1 of this application;
[0040] Figure 2 This is a schematic diagram of application scenario 2 of this application;
[0041] Figure 3 A schematic diagram of a flow chart of an embodiment of a data processing method provided by the present application;
[0042] Figure 4 A schematic diagram of a flow chart of an embodiment of a data processing method provided by the present application;
[0043] Figure 5 A schematic diagram of a flow chart of an embodiment of a data processing method provided by the present application;
[0044] Figure 6 A schematic diagram of a flow chart of an embodiment of a data processing method provided by the present application;
[0045] Figure 7 A schematic diagram of the structure of an embodiment of a data transmission device provided by the present application;
[0046] Figure 8 A schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] Before formally introducing the embodiments of the present application, the application scenarios of the present application and the problems existing in the prior art are introduced in conjunction with the accompanying drawings.
[0048] Figure 1 This is a schematic diagram of application scenario 1 of this application, such as Figure 1The process of encrypting and decrypting data when transmitting data between electronic devices is shown. With the continuous development of electronic technology and Internet communication technology, people use electronic devices to transmit more and more data. Some important data are subject to security risks of data leakage and tampering during transmission. At the same time, some electronic devices themselves are also easily remotely controlled and illegally manipulated. Therefore, ensuring the security of data transmitted between electronic devices has become an important development and research direction in the industry. The electronic devices described in the embodiments of the present application can be mobile phones, tablet computers, laptops, desktop computers, workstations, IoT devices, or servers, etc., which have relevant data processing capabilities and implement relevant functions. Figure 1 In the examples shown, the electronic device is a computer as an example but not limited thereto. Figure 1 The scenarios shown may be specifically applied to scenarios such as device collaborative authentication, joint payment, anonymous voting, device collaborative decryption, and sensitive data backup and recovery.
[0049] In some technologies, when Figure 1 When the electronic device 1 shown wants to send data A to the electronic device 2, it first encrypts the data A using the public key of the electronic device 2 to obtain the ciphertext B, and then sends the ciphertext B to the electronic device 2. The electronic device 2 can decrypt the ciphertext B using its private key to obtain the data A, and finally completes the transmission of the data A from the electronic device 1 to the electronic device 2. In this process, the public key is publicized by the electronic device 2 and can be used by other devices to encrypt data, and the data encrypted by the public key of the electronic device 2 can only be decrypted by the private key of the electronic device 2, so that in the process of transmitting the ciphertext B from the electronic device 1 to the electronic device 2, even if it is leaked or maliciously stolen, others cannot decrypt the ciphertext B to obtain the unencrypted data A, thereby ensuring the data security of the data A during the transmission process.
[0050] In the above technology, although only electronic device 2 has its private key, so that other devices cannot encrypt data encrypted by the public key of electronic device 2, the private key of electronic device 2 itself still has certain security risks. Once electronic device 2 is remotely controlled or illegally manipulated, the private key of electronic device 2 is still at risk of being stolen, and thus the security of data sent to electronic device 2 cannot be further ensured.
[0051] Therefore, the concept of "threshold encryption" is proposed in other technologies. Its biggest feature can be understood as "the key is available but not visible". For example, in Figure 1In the data encryption scenario shown, the private key used by the electronic device 2 is jointly generated by multiple electronic devices 21 (recorded as multiple participants), so that the public key and private key of the electronic device 2 are shared by multiple participants, and each of the multiple participants holds a private key slice of the electronic device 2, and can complete encryption or decryption without restoring the private key itself and without exposing the private key slice held by each participant. Figure 1 The multiple electronic devices 21 shown can jointly calculate the public key and private key of the electronic device 2, and when the electronic device 1 sends data A to the electronic device 2, the public key of the electronic device 2 provided by the multiple electronic devices 21 can be used to encrypt the data A to obtain data B, and the data B can be sent to the electronic device 2. After the electronic device 2 receives the data B, the private key of the electronic device 2 provided by the multiple electronic devices 21 is used to decrypt the data B to obtain data A. In this process, even if the data B is leaked or stolen maliciously, the thief still cannot decrypt the data B if he cannot obtain all the private key fragments owned by the multiple electronic devices 21, so that the security of the private key is further guaranteed while ensuring the data security of the data A during the transmission process, and at the same time improving the security and availability of the key.
[0052] However, in the threshold encryption technology, since the private key of the electronic device is shared by multiple participants, more participants also bring more possible risks. In the case where each participant may be maliciously remotely controlled and illegally manipulated, the encryption or decryption processing of the data of the electronic device also has certain risks. For example, when multiple electronic devices 21 jointly generate a public key for the electronic device 2, if any one or more of the multiple electronic devices 21 provide wrong data, the multiple electronic devices 21 cannot generate the correct public key, and the generated wrong public key cannot be used for subsequent encryption; for another example, when the electronic device 2 uses the private key provided by the multiple electronic devices 21 to decrypt the data, if any one or more of the multiple electronic devices 21 provide wrong data, the electronic device 2 cannot successfully decrypt the received encrypted data through the private key, thereby reducing the success rate of using the key (public key or private key) to process (encrypt or decrypt) the data, and reducing the efficiency of the electronic device to process the data.
[0053] Figure 2 This is a schematic diagram of the second application scenario of this application, in which, Figure 2The process of signing and verifying data when transmitting data between electronic devices is shown, wherein when electronic device 3 is to send data C to electronic device 4, in order to enable electronic device 4 to verify the validity of the source of data C, electronic device 3 can use its private key to sign data C and then send it to electronic device 4. After receiving data C signed by electronic device 3, electronic device 4 can verify the signature of data C by using the public key of electronic device 3 to determine that the signature of data C belongs to electronic device 3. In this process, only the private key owned by electronic device 3 can be used to sign data, and the public key is publicized by electronic device 3 and can be used to verify the private key signature of electronic device 3, so that other devices cannot imitate electronic device 3 to send data C, thereby realizing that electronic device 3 signs the data it transmits, thereby ensuring the validity of the data.
[0054] However, in the above technology, although only electronic device 3 has a private key, so that other devices cannot use the private key of electronic device 3 to sign data, the private key of electronic device 3 itself still has certain security risks. Once electronic device 3 is remotely controlled or illegally manipulated, the private key of electronic device 3 is still at risk of being stolen, which will reduce the validity of its signature.
[0055] Therefore, the concept of "threshold signature" is proposed in other technologies, for example, Figure 2 In the data signature scenario shown, the private key used by the electronic device 3 for signing is jointly generated by multiple electronic devices 31 (recorded as multiple participants), so that the public key and private key of the electronic device 3 are shared by multiple participants, and the multiple participants each hold a private key slice of the electronic device 3, and can complete the signing or verification without restoring the private key itself and without exposing the private key slice held by each participant. Figure 2 The multiple electronic devices 31 shown can jointly calculate the public key and private key of the electronic device 3, and when the electronic device 3 sends data C to the electronic device 4, the data C can be signed using the private key of the electronic device 3 provided by the multiple electronic devices 31 and then sent to the electronic device 4. After the electronic device 4 receives the data C, it verifies the signature in the data C using the public key of the electronic device 3 provided by the multiple electronic devices 31, thereby ensuring the validity of the data by verifying the signature, and further ensuring the security of the private key, while improving the security and availability of the key.
[0056] However, in the threshold signature technology, since the private key of the electronic device is shared by multiple participants, more participants also bring more possible risks. In the case where each participant may be maliciously remotely controlled and illegally manipulated, the signing or verification processing of the data of the electronic device also has certain risks. For example, when multiple electronic devices 31 jointly generate a public key for the electronic device 3, if any one or more of the multiple electronic devices 31 provide wrong data, the multiple electronic devices 31 cannot generate the correct public key, and the generated wrong public key cannot be used for the subsequent electronic device 4 to verify the signature; for another example, when the electronic device 3 uses the private key provided by multiple electronic devices 31 to sign the data, if any one or more of the multiple electronic devices 31 provide wrong data, the electronic device 3 cannot sign the data with the private key, thereby reducing the success rate of using the key (public key or private key) to process (sign or verify) the data, and reducing the efficiency of the electronic device to process the data.
[0057] In summary, in Figure 1 Threshold encryption as shown and Figure 2 In the threshold signature scenario shown, the existing technologies all have the problem of lack of verification of the key itself and the intermediate data related to the key calculation, which results in the inability to guarantee the accuracy of the obtained key (public key and private key) when an error occurs in the key itself or the intermediate data, thus reducing the success rate of data processing and the efficiency of electronic equipment in processing data. Therefore, the present application provides a data processing method and device, in the process of threshold encryption, threshold decryption and threshold signature, the electronic equipment involved in the relevant calculation verifies the key and the intermediate data used before continuing to process the key, thereby ensuring the processing efficiency of the electronic equipment when using the key to process data.
[0058] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, or can also be performed separately, and the same or similar concepts or processes may not be repeated in some embodiments.
[0059] Embodiment 1
[0060] Embodiment 1 Overview: This embodiment provides a method for calculating and generating a public key of a first electronic device by n participating devices, which can be applied to Figure 1 In the scenario shown, n electronic devices 21 jointly generate the public key of electronic device 2 (in this case, Figure 1 The electronic device 2 in the figure is referred to as the first electronic device), or the same as the following may be applied: Figure 2 In the scenario shown, n electronic devices 31 jointly generate the public key of electronic device 3 (in this case, Figure 2 The electronic device 3 in n is denoted as the first electronic device). Among them, it is assumed that there are a total of n participating device parties that can participate in calculating the public keys of the participating device parties, and they are labeled as P1, P2, …, P n . The IDs of these n participating device parties are denoted as ID1, ID2, …, ID
[0061] Specifically, Figure 3 is a schematic flowchart of a data processing method provided by this application. The method provided in the first embodiment of this application includes:
[0062] S101: The target participating device determines the calculation parameters of the public key of the first electronic device, and the calculation parameters can be the first commitment information.
[0063] Among them, when n participating device parties jointly generate the public key of the first electronic device, the target participating device can be any one of the n participating device parties. Alternatively, optionally, the first electronic device can also be any one of the n participating device parties.
[0064] Then in S101, the target participating device as the execution subject calculates the public key of the first electronic device. Among them, since it is n participating device parties that jointly determine the public key of the first electronic device, therefore, the n participating device parties first each select a polynomial of degree t - 1. Denote the i-th participating device party among the n participating device parties as P i , then the polynomial selected by the participating device party P i is denoted as f i (x), and the constant term in the polynomial f i (x) is used as the private key shard selected by the i-th participating device party Pi, denoted as setup_sk_i, that is, f i (0) = setup_sk_i.
[0065] Subsequently, for the n participating device parties participating in the calculation, denote ID1, ID2, …, ID n as the IDs of the n participating device parties. Then the i-th (0 < i ≤ n) participating device party P i, n private key shards can be calculated using the IDs of n participating devices, denoted as f i (ID1),f i (ID2),…,f i (ID n ), and f i (ID j ) is sent to the corresponding j-th (0<j≤n, i≠j) participant device P j .
[0066] Then, for each participating device, after obtaining n private key shards f i (ID1),f i (ID2),…,f i (ID n ) (including the slice f calculated by itself i (ID i )), add these n private key shards together to get a joint shard p(ID i )=f1(ID i )+f2(ID i )+…+f n (ID i ). Since each f i (x) are all from the i-th participant device P i The selected polynomial is t-1, so p(x) is also a t-1 polynomial. Therefore, the i-th participant device P i It can be obtained by formula T i =p(ID i )*G, calculate the point multiplication result T of the total private key shard and the elliptic curve base point i , and T i It is sent to other participants by broadcasting. i It can also be called “first commitment.” In this embodiment, the first commitment can also be called first commitment information, which can be used as a public key calculation parameter for calculating a public key.
[0067] S102: The target participant device calculates the public key of the first electronic device and verifies the public key of the first electronic device.
[0068] Among them, when the i-th participant device P among the n participating devices participating in the calculation i will obtain the first commitments of all n participating devices (including the first commitment of the i-th participating device itself). At this time, for any one of the n participating devices (referred to as the target participating device in this embodiment and the i-th participating device P among the n participating devices), i), can be obtained by any t number of participant device IDs, ID1, ID2, …, ID t Calculate the Lagrange coefficient m 11 ,m 12 ,…,m 1t , and then through the formula PK1 = m 11 *T1+m 12 *T2+…,+m 1t *T t , calculate and obtain the public key of the first electronic device, recorded as PK1. Wherein, t≤n, and the t participating devices can be used together to perform threshold signing and threshold decryption of data of the first electronic device (see the description of Embodiment 2 and Embodiment 3 for details).
[0069] Specifically, in this embodiment, after the target participant device generates the public key of the first electronic device in S101, it is also necessary to verify the generated public key before actually outputting the public key of the first electronic device in S103.
[0070] In a specific implementation, the target participant device can calculate the Lagrange coefficient and the public key of the second device through the IDs of t different participant devices. For example, the target participant device also uses the IDs of any t participant devices among the n participant devices, ID2, ID3, ..., ID t+1 Calculate the Lagrange coefficient m 21 ,m 22 ,…,m 2t Calculate PK2 = m 21 *T2+m 22 *T3+…,+m 2t *T t+1 .
[0071] The target participant device follows the same method as above, and so on, using the IDs of any t participant devices among the n participant devices, ID n-t+1 ,ID n-t+2 ,…,ID n Calculate PK n-t+1 After that, it is determined whether the calculated public keys of the n-t+1 first electronic devices are the same, that is, whether PK1, PK2, ...PK n-t+1 Does PK1=PK2=…=PK satisfy n-t+1 .
[0072] Optionally, in the above example, the calculation of the public key of the first electronic device using the IDs of any t participating devices is used as an example. It can be understood that when calculating the public key of the first electronic device, the IDs of other m participating devices can also be used to calculate the public key of the first electronic device, t<m≤n, and it is determined whether all calculated public keys of the first electronic device are the same.
[0073] S103: If the verification is successful, the target participant device outputs the public key of the first electronic device.
[0074] Specifically, when the target participant device determines that the public keys of all the first electronic devices obtained in S102 are the same, it is determined that the verification is successful and the public key of the first electronic device is output; on the contrary, if the public keys of all the first electronic devices obtained in S102 are not exactly the same, the verification is different and the target participant device will not output the public key of the first electronic device.
[0075] For example, in Figure 1 In the scenario shown, after the target participant device in the multiple electronic devices 21 obtains the public key of the electronic device 2 and passes the verification, the public key of the electronic device 2 is sent to the electronic device 1 and the electronic device 2. For example, in Figure 2 In the scenario shown, after the target participant device among multiple devices 31 calculates and verifies the public key of electronic device 3, it sends the public key of electronic device 3 to electronic device 3 and electronic device 4.
[0076] In summary, in the method provided in the first embodiment of the present application, when multiple participating devices jointly calculate the public key of the first electronic device, the target participating device among the multiple participating devices does not output the public key of the first electronic device immediately after obtaining it, but verifies whether the generated public key of the first electronic device is accurate, and outputs it for subsequent calculation only when the verification is passed, otherwise the obtained public key will not be output. In this embodiment, through the above-mentioned verification process after the public key of the first electronic device is generated, if the verification is passed, it means that the private key fragments provided by the multiple participating devices participating in the calculation of the public key of the first electronic device are correct, so that the calculated public key is also correct; if the verification fails, it means that among the multiple participating devices participating in the calculation of the public key of the first electronic device, there may be errors in the private key fragments provided by the participating devices, and the subsequent calculated public key is also wrong. Therefore, in this embodiment, the target participant device verifies the public key after obtaining the public key of the first electronic device, and outputs it only after the verification is passed, to prevent a participant device from calculating an erroneous public key after providing erroneous data due to attack, theft, etc. when multiple participant devices jointly calculate the public key of the first electronic device, thereby ensuring the accuracy of the calculated public key, and further ensuring the accuracy of the first electronic device when using its public key to process data, so that other devices can also obtain the correct public key, thereby improving the efficiency of the first electronic device in processing data.
[0077] Embodiment 2
[0078] Embodiment 2 Overview: This embodiment provides a method for signing data sent by a first electronic device to a second electronic device by t participating devices among n participating devices (based on the number of participating devices, it can also be called a tn threshold signature method), which can be applied to Figure 2 In the scenario shown, t electronic devices 31 (referred to as participant devices) among n electronic devices 31 jointly digitally sign data C sent by electronic device 3 (referred to as the first electronic device) to electronic device 4 (referred to as the second electronic device). It is assumed that there are n participant devices that can participate in signing the data of the first electronic device, and they are marked as P1, P2, ..., P n , the IDs of these n participating devices are recorded as ID1, ID2, ..., ID n , and any t (t≤n) of the n participant devices can be jointly used to generate a threshold signature sigma=(r,s). If there are less than t participant devices, the signature cannot be completed.
[0079] In addition, in the embodiments of the present application, t participating device parties may perform digital signature on the data of the first electronic device based on the national cryptography SM2 signature algorithm. The national cryptography SM2 algorithm is an algorithm based on elliptic curves. The parameters used in the calculation process at least include: G is the generator of the elliptic curve cyclic group, which is called the base point of the elliptic curve. q is the order of G, q*G is equal to the infinite point O, and it satisfies O+P = P, where P is any point in the elliptic curve cyclic group. 0 < k < q, and k*P represents the elliptic curve point multiplication. At the same time, in order to implement this embodiment, the following three mathematical concepts are also utilized: ①. Multi-party multiplication protocol: When t participating device parties P1, P2,..., Pt execute the multi-party multiplication protocol, for the {ai, bi} input by the i-th participating device party Pi, the multiplication protocol is executed, so that the output ci obtained by each of the t participating device parties satisfies c1 + c2 +... + ct = (a1 + a2 +... + at) * (b1 + b2 +... + bt). ②. Discrete logarithm zero-knowledge proof: The prover P can prove to the verifier that P knows k of R = k*G without exposing k. ③. DHtuple zero-knowledge proof: The prover P can prove to the verifier that {G, P, U, V} satisfies P = w*G and V = w*G without exposing w.
[0080] Specifically, Figure 4 As shown in the flowchart of an embodiment of the data processing method provided by the present application, the data processing method provided in the second embodiment of the present application includes:
[0081] S201: The target participating device party determines at least two calculation parameters, and the at least two calculation parameters are used to obtain the signature information of the first electronic device.
[0082] Among them, when t participating device parties jointly calculate and generate the public key of the first electronic device, the target participating device party may be any one of the t participating device parties. Alternatively, optionally, the first electronic device may also be any one of the t participating device parties. In a specific implementation manner of S201, the target participating device party as the execution subject calculates the signature information of the first electronic device. Since it is t participating device parties that jointly determine at least two calculation parameters to calculate the signature information of the first electronic device, these t participating device parties will jointly execute the following steps in S201:
[0083] Step a: Each of the t participating device parties among the t participating device parties calculates the parameter M respectively. For the i-th participating device party Pi among the t participating device parties P i , first randomly select ro i , and then through the formula M i = ro i *G calculates M i, recorded as the second commitment, and the calculated second commitment M i Perform discrete logarithm zero-knowledge proof. Then the i-th participant device P i The calculated second commitment and proof are broadcast to the other t participating devices. When each participating device collects the second commitments M1, M2, ..., M broadcasted by all t participating devices, t (including the M generated by itself i ) and the corresponding discrete logarithm zero-knowledge proof, verify the validity of all zero-knowledge proofs. If the verification is valid, continue with the formula M=M1+M2+…+M t , the calculated parameter M is used for subsequent verification calculations.
[0084] Step b: Each of the t participant devices calculates parameters R and e. For the i-th participant device P among the t participant devices, i , first randomly select k i , through the formula R i =k i *G calculates R i , recorded as the third commitment, and calculate the third commitment R i The discrete logarithm zero-knowledge proof. Then the i-th participant device P i The calculated third commitment R i The proof is broadcast to the other t participating devices. When each participant has collected the third commitment R1, R2, …, R broadcasted by all t participating devices t (including self-generated R i ) and the corresponding discrete logarithm zero-knowledge proof, verify the validity of all zero-knowledge proofs. If the verification is valid, continue with the formula R = R1 + ... + R t Calculate the parameter R, and calculate the parameter e through the formula e=Hash(message||Z). Where message is the message, and Z is the public string. Convert e to integer type. R=(x1,y1), P i Extract x1. The calculated parameters R and e are used for subsequent verification calculations. After calculating the parameter e, each participant device also calculates the first part r of the signature sigma = [r, s] of the first electronic device by the formula r = e + x1 (mod q).
[0085] Step c: Each of the t participating devices calculates the parameter N i =ro i *PK, where for the ith participant device P among the t participant devices i , calculate the M obtained in step a i, the public key PK of the first electronic device, and the calculated N i DHTuple zero-knowledge proof, denoted as proof_M i _PK_N i _DH. Then, the i-th participant device P i M i ,N i and proof_M i _PK_N i _DH is sent to the other t participating devices. Then when each participant collects the DHTuple zero-knowledge proof proof_M sent by all t participating devices i _PK_N i _DH and all are verified, the parameter N is calculated using the formula N=N1+N2+…+Nt, and the calculated parameter N is used for subsequent verification calculations.
[0086] Step d: Each of the t participant devices calculates the parameter L i =ro i *R, where for the ith participant device P among the t participant devices i , calculate {G,M i ,R,L i}DHtuple zero-knowledge proof, denoted as proof_M i _R_L i _DH. Then, the i-th participant device P i L i and proof_M i _R_L i _DH is sent to the other t participating devices. Then when each participant collects the DHTuple zero-knowledge proof proof_M sent by all t participating devices i _R_L i _DH and all are verified, then continue to use the formula L=L1+L2+…+L t The parameter L is calculated and used for subsequent verification calculations.
[0087] Step e: Each of the t participant devices uses the IDs of all t participant devices, ID1, ID2, ..., ID t Calculate the Lagrange coefficient lambda i , and by the formula sign_sk i =lambda i *p(ID i )(mod q) Calculate parameter sign_sk i, where (mod q) represents the modulo operation.
[0088] In step f, t participant devices execute the multi-party multiplication protocol twice, so that the target participant device determines two calculation parameters, denoted as Beta and Tao. The calculated two calculation parameters are used to obtain the signature information of the first electronic device.
[0089] Specifically, the calculation parameter obtained by the first multi-party multiplication protocol is recorded as Beta=ro*(1+sk). Then for the i-th participant device P among the t participant devices i Respectively with their own ro i and 1 / t+sign_sk i (mod q) is used as the input of the multi-party multiplication protocol, and the t participating devices jointly perform the multi-party multiplication protocol calculation, and the output result is recorded as w i , then each i-th participant device P i The calculated w i Then, when the target device among the t participating devices collects the output results w1, w2…w of the multi-party multiplication protocol sent by all t participating devices, t Then, through the formula Beta = w1 + w2 + ... + w t (mod q) calculates the parameter Beta, and the obtained parameter Beta is used for the subsequent calculation of signature information.
[0090] The calculation parameter obtained by the second multi-party multiplication protocol is recorded as Tao = ro*(k–r*sk). Then for the i-th participant device P among the t participant devices i Respectively with their own ro i and k i –r*sign_sk i (mod q) is used as the input of the multi-party multiplication protocol, and the t participating devices jointly perform the multi-party multiplication protocol calculation, and the output result is recorded as v i , then each i-th participant device P i The calculated v i Then, when the target device among the t participating devices collects the output results v1, v2…v1 of the multi-party multiplication protocol sent by all t participating devices, t Then, through the formula Tao = v1 + v2 + ... + v t (mod q) calculates the parameter Tao, and the obtained parameter Tao is used for the subsequent calculation of signature information.
[0091] It should be noted that, since the parameters used in the two multi-party multiplication protocols designed in this embodiment are different, the two multi-party multiplication protocols are independent of each other and do not interfere with each other. Therefore, in the specific implementation process of this embodiment, t participating devices can simultaneously execute the two multi-party multiplication protocols in parallel. Compared with the method in the prior art in which the parameters of the two multi-party multiplication protocols are the same and the parameters are interactive, it can also improve the computing efficiency, save the time required for computing, and can also be equivalent to further improving the efficiency of electronic devices in processing data.
[0092] S202: The target participant device verifies at least two calculation parameters.
[0093] Specifically, for the target participant device among the t participant devices, after determining the two calculation parameters Beta and Tao in S201, the two calculation parameters are not directly used to calculate the signature information of the first electronic device, but the two calculation parameters are verified.
[0094] In a specific implementation method, the target participant device verifies the two calculation parameters through the formula Beta*G=M+N and the formula Tao*G=L–r*N. Only when the above two formulas are simultaneously established, the verification is successful and the subsequent step S203 can be continued; otherwise, when the above two formulas cannot be simultaneously established, the verification fails and the subsequent step S203 will not be executed.
[0095] Among them, since M is provided by each participant’s device i =ro i *G is calculated, and N is provided by each participant. i =ro i *PK is calculated, and Beta=ro*(1+sk), so after adding M and N on the right side of the equation Beta*G=M+N, Beta*G on the left side can be obtained. Similarly, since L is L provided by each participating device i =ro i *R is calculated, and N is the N provided by each participant i =ro i *PK is calculated, and Tao=ro*(k–r*sk), so after subtracting L and r*N on the right side of the equation Tao*G=L–r*N, we can get Tao*G on the left side.
[0096] That is, when each participant device provides M i 、N i , L iWhen the intermediate calculation data are accurate, the calculated calculation parameters Beta and Tao are also correct. i 、N i , L i When the intermediate calculation data is inaccurate, the calculated calculation parameters Beta and Tao will also be wrong, and the subsequent accurate signature of the first electronic device cannot be calculated. Therefore, in S202, the two calculation parameters used to calculate the signature information of the first electronic device can be verified by the above two formulas. If the two calculation parameters are verified, it means that the intermediate calculation data provided by each participating device is also accurate, so that the subsequent step S203 can be continued.
[0097] S203: If the verification is successful, the target participant device calculates the signature information of the first electronic device based on at least two calculation parameters.
[0098] Specifically, if the target participant device verifies the calculated parameters Beta and Tao through S202, it will continue to calculate the second part s of the signature information of the first electronic device through the formula r=e+x1(mod q) and the formula s=Tao / Beta(mod q), and combine it with the first part s of the signature information of the first electronic device that has been calculated, and finally obtain the signature sigma=[r,s] of the first electronic device. For example, in Figure 2 In the scenario shown, after the target participant device among the t electronic devices 21 calculates the signature information of the electronic device 3 through the above steps, the obtained signature information is sent to the electronic device 3.
[0099] Optionally, after calculating the signature information sigma = [r, s], the target participant device can also verify the validity of the signature information sigma through the SM2 public key signature algorithm, message message and PK, etc. If the signature information sigma is verified to be valid again, the signature information sigma of the first electronic device is finally output.
[0100] In summary, in the method provided in the second embodiment of the present application, when multiple participating devices jointly calculate the signature information of the first electronic device, the target participating device among the multiple participating devices does not immediately calculate the signature information after obtaining the calculation information of the signature information of the first electronic device, but verifies whether the obtained calculation information is accurate, and continues to calculate the signature information only if the verification is passed, otherwise the signature information will not be calculated. In this embodiment, through the above-mentioned verification process after obtaining the calculation information of the signature information, if the verification is passed, it means that the intermediate calculation data provided by the multiple participating devices that obtain the calculation information is correct, so that the obtained calculation information is also correct, and the subsequent calculation of the correct signature information of the first electronic device can be guaranteed; if the verification fails, it means that among the multiple participating devices that obtain the calculation information, there may be errors in the intermediate data provided by the participating devices, and the signature information of the first electronic device obtained by the subsequent calculation will also be wrong. Therefore, in this embodiment, the target participant device verifies the calculation information of the signature information of the first electronic device after obtaining the calculation information of the signature information of the first electronic device, and calculates the signature information of the first electronic device only after the verification is passed, to prevent the situation where a participant device provides incorrect data due to attack, theft, etc. when multiple participant devices jointly calculate the signature information of the first electronic device, resulting in incorrect signature information. This ensures the accuracy of the calculated signature information of the first electronic device, and further ensures the accuracy of the digital signature of the data of the first electronic device used by multiple participant devices, so that other devices that receive the data can successfully verify the signature information of the first electronic device, thereby improving the efficiency of the first electronic device in processing data.
[0101] Embodiment 3
[0102] Embodiment 3 Overview: This embodiment provides a method for decrypting data sent from a third electronic device to a first electronic device by t participating devices among n participating devices (based on the number of participating devices, it can also be called a tn threshold decryption method), which can be applied to Figure 1 In the scenario shown, when electronic device 1 (referred to as the third electronic device) sends data A to electronic device 2 (referred to as the first electronic device), the third electronic device uses the public key of the first electronic device to encrypt data A into data B and then sends it to the first electronic device. When the first electronic device receives data B, t electronic devices 21 (referred to as participating devices) among n electronic devices 21 jointly decrypt data B and obtain data A. It is assumed that there are n participating devices that can participate in decrypting the data of the first electronic device, and they are marked as P1, P2, ..., P n , the IDs of these n participating devices are recorded as ID1, ID2, ..., ID n, and any t (t ≤ n) of these n participating device can be jointly used to decrypt the data of the first electronic device, and less than t participating devices cannot decrypt it.
[0103] In addition, in the embodiments of the present application, t participating devices can decrypt the data of the first electronic device based on the national cryptographic SM2 decryption algorithm. Among them, the national cryptographic SM2 algorithm is an algorithm based on elliptic curves. The parameters used in the calculation process at least include: G is the generator of the elliptic curve cyclic group, which is called the base point of the elliptic curve. q is the order of G, q*G is equal to the infinite point O, and it satisfies O + P = P, where P is any point in the elliptic curve cyclic group. 0 < k < q, and k*P represents the elliptic curve point multiplication. At the same time, in order to implement this embodiment, the following three mathematical concepts are also used: ①. Multi-party multiplication protocol: When t participating devices P1, P2,..., Pt execute the multi-party multiplication protocol, for the {ai, bi} input by the i-th participating device Pi, execute the multiplication protocol so that the output ci obtained by each of the t participating devices satisfies c1 + c2 +... + ct = (a1 + a2 +... + at) * (b1 + b2 +... + bt). ②. Discrete logarithm zero-knowledge proof: The prover P can prove to the verifier that P knows k of R = k*G without exposing k. ③. DHtuple zero-knowledge proof: The prover P can prove to the verifier that {G, P, U, V} satisfies P = w*G, V = w*G without exposing w.
[0104] In addition, in this embodiment, based on the fact that the third electronic device has encrypted the data through the public key PK of the first electronic device, the encryption method can be carried out through the SM2 public key encryption algorithm, and the public key PK used can be generated in Embodiment 1. For example, the third electronic device encrypts the data data to obtain the ciphertext C through the following steps: (1) Select a random number k and calculate C1 = k*G, where G is the elliptic curve base point. (2) (x1, y1) = k*PK. Calculate e = KDF(x1||y1||parameters), where KDF is the key generation function and can be replaced by a hash function. In addition, parameters are public parameters. (3) Calculate C2 = data XOR e. (4) C3 = Hash(x1||M||y1). (5) Set the ciphertext C = {C1||C2||C3}. The implementation of the third electronic device using the public key PK to encrypt the data in this embodiment is not limited.
[0105] Then the method provided in Embodiment 3 of the present application is a process in which the first electronic device receives the ciphertext C and then jointly decrypts the ciphertext C by t participating devices to obtain the plaintext data. Figure 5This is a flow chart of an embodiment of a data processing method provided by the present application, the method comprising:
[0106] S301: The target participant device obtains multiple decryption parameters, where the decryption parameters are used to decrypt data received by the first electronic device.
[0107] Among them, when t participant devices jointly decrypt the data received by the first electronic device, the target participant device can be any one of the t participant devices. Or, optionally, the first electronic device can also be any one of the t participant devices. In a specific implementation of S301, the t participant devices first jointly determine multiple decryption parameters for subsequent decryption of the data of the first electronic device, so the t participant devices will jointly perform the following steps in S301:
[0108] First, for each of the t participant devices, record the i-th participant device P i Using the IDs of t participating devices, ID1, ID2, …, ID t Calculate the respective Lagrange coefficient lambda i , then calculate decrypt_sk i =lambda i *p(ID i ), and extract C1 from the received ciphertext C, and calculate R i =decrypt_sk i *C1, and calculate Q i =decrypt_sk_i*G. Then, each participant device P i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof proof_i, and Q i ,R i and proof i The calculated commitment is broadcasted to all other t participating devices. After each participating device has collected the commitments of all other t-1 participating devices, each participating device P i Q i ,R i and proof i Send to the target participant device and record the target participant device as P0.
[0109] S302: The target participant device verifies multiple decryption parameters.
[0110] The target participant device receives R1, R2, ..., R of all t participant devices received in S301.t ,Q1,Q2,…,Q t and proof1,proof2,…,proof t Verification is performed. The verification includes: verifying the correctness of the received commitment, verifying the validity of each DHTuple zero-knowledge proof, and verifying PK=Q1+Q2+…+Q t If the verification is passed, the subsequent step S303 can be executed. Otherwise, if any of the above verifications fails, the subsequent step S303 will not be executed.
[0111] That is, when each participant device provides i ,R i When the decryption parameters are all accurate, the t participating devices can jointly and accurately decrypt the data of the first electronic device to ensure successful decryption; and when the Q provided by any one or more of the t participating devices is i ,R i When the decryption parameters are inaccurate, t participating devices may not be able to accurately decrypt the data received by the first electronic device. Therefore, after the decryption parameters are determined in S301 and before the data is actually decrypted in S303, the target participating device in this embodiment also verifies the determined decryption parameters. Only when the verification is passed to ensure that the decryption parameters are accurate, the subsequent decryption steps are performed.
[0112] S303: If the verification is successful, the target participant device decrypts the data received by the first electronic device according to multiple decryption parameters.
[0113] Specifically, if the target participant device verifies the obtained decryption parameters in S302, the data ciphertext C received by the first electronic device can be decrypted by the following specific formula. Wherein, by the formula R=R1+R2+…+R t =(x1,y1) calculates parameters x1, y1 and R, and calculates parameter e by formula e=KDF(x1||y1||parameters). Then calculate M' by formula M'=C2 XOR e. Finally, calculate C3' by formula C3'=Hash(x1||M||y1). If C3'=C3, then M' is the correct plaintext, and output M'. Otherwise, output False. Thus, the data ciphertext C received by the first electronic device is decrypted to obtain the encrypted signed data data.
[0114] In summary, in the method provided in the third embodiment of the present application, when multiple participating devices jointly decrypt the data received by the first electronic device, the target participating device among the multiple participating devices does not immediately decrypt the data after obtaining the decryption parameters of the first electronic device, but verifies whether the obtained decryption parameters are accurate, and continues to decrypt the data only when the verification is passed, otherwise the data will not be decrypted. In this embodiment, through the above-mentioned verification process after obtaining the decryption parameters, if the verification is passed, it means that the intermediate calculation data, i.e., the decryption parameters, provided by the multiple participating devices are correct, so that the correct decryption can be guaranteed when the data received by the first electronic device is decrypted by the decryption parameters; if the verification fails, it means that among the multiple participating devices, there may be errors in the intermediate data provided by the participating devices, and the subsequent decryption of the data of the first electronic device will also be wrong. Therefore, in this embodiment, the target participant device also verifies the decryption parameters after obtaining the decryption parameters of the first electronic device, so as to prevent the decryption parameters from being incorrect due to a participant device providing erroneous data due to attack, theft, etc. when multiple participant devices jointly decrypt the data received by the first electronic device. This ensures the accuracy of the calculated decryption parameters of the first electronic device, thereby further ensuring the accuracy of decryption of the data of the first electronic device by multiple participant electronic devices and improving the efficiency of data processing by the first electronic device.
[0115] Embodiment 4
[0116] Embodiment 4 Overview: This embodiment provides a method for calculating and generating a public key of a first electronic device by n participating devices, which can be applied to Figure 1 In the scenario shown, n electronic devices 21 jointly generate the public key of electronic device 2, or the same method as in Figure 2 In the scenario shown, n electronic devices 31 jointly generate the public key of electronic device 3. It is assumed that there are n participating devices that can participate in calculating the public key of the participating device, and they are marked as P1, P2, ..., P n , the IDs of these n participating devices are recorded as ID1, ID2, ..., ID nIn addition, in the embodiments of the present application, n participating device parties may generate the public key of the first electronic device based on the national cryptographic SM2 algorithm (specifically, it can be further divided into the SM2 encryption algorithm, the SM2 decryption algorithm, the SM2 signature algorithm, etc.). Among them, the national cryptographic SM2 algorithm is an algorithm based on elliptic curves. The parameters used in the calculation process at least include: G is the generator of the elliptic curve cyclic group, which is called the base point of the elliptic curve. q is the order of G, q*G is equal to the infinite point O, and it satisfies O + P = P, where P is any point in the elliptic curve cyclic group. 0 < k < q, and k*P represents the elliptic curve point multiplication. Among them, the difference between this embodiment and Embodiment 1 is that these n participating device parties (in Embodiment 1, t participating device parties among the n participating device parties) can be jointly used for subsequent processing such as threshold signature and threshold decryption of the data of the first electronic device (see the descriptions of Embodiment 5 and Embodiment 6 for details).
[0117] Specifically, Figure 6 FIG. 5 is a schematic flowchart of an embodiment of the data processing method provided by the present application. The method provided in Embodiment 4 of the present application includes:
[0118] S401: The target participating device determines the calculation parameters of the public key of the first electronic device and calculates the participation for obtaining the public key of the first electronic device.
[0119] Among them, when n participating device parties jointly generate the public key of the first electronic device, the target participating device can be any one of the n participating device parties. Alternatively, optionally, the first electronic device can also be any one of the n participating device parties.
[0120] Then in S101, any i-th participating device party P among the n participating device parties i obtains the private key sk_i, and calculates the corresponding public key pk_i of the i-th participating device party P through the formula pk_i = sk_i * G, and the zero-knowledge proof of the discrete logarithm for calculating the public key pk_i is denoted as proof_i. Subsequently, after calculating the commitments of pk_i and proof_i, the commitments are broadcast to the other n - 1 participating device parties. i
[0121] S402: The target participating device verifies the calculation parameters of the public key of the first electronic device.
[0122] Subsequently, for the target participating device among the n participating device parties, it can be the i-th participating device party P i , and can verify the calculation parameter pk_i received in S401. For example, the i-th participating device party P iVerify all collected sub-public keys (pk_i) and their discrete logarithm zero-knowledge proofs (proof_i) sent by other participating devices. If the target participating device successfully verifies the calculation parameters through the above verification method, it can continue to execute the subsequent step S403; otherwise, if the above verification fails, the subsequent step S403 will not be executed.
[0123] S403: The target participant device determines the public key of the first electronic device according to the calculation parameters.
[0124] Specifically, after the target participant device verifies the calculation parameters pk_1, pk_2 ... pk_n in S402, it substitutes the obtained calculation parameters into the formula PK=pk_1+pk_2+ ...+pk_n to calculate the public key PK of the first electronic device.
[0125] In summary, in the method provided in this embodiment, when multiple participating devices jointly calculate the public key of the first electronic device, after obtaining the calculation parameters of the public key of the first electronic device, it is also verified whether the calculation parameters are accurate, and the public key of the first electronic device is calculated according to the calculation parameters only when the verification is passed, otherwise the public key output will not be calculated. In this embodiment, through the above-mentioned verification process after generating the calculation parameters of the first electronic device, if the verification is passed, it means that the calculation parameters provided by the multiple participating devices participating in the calculation of the public key of the first electronic device are correct, so that the calculated public key is also correct; if the verification fails, it means that among the multiple participating devices participating in the calculation of the public key of the first electronic device, there may be errors in the calculation parameters provided by the participating devices, and the subsequent calculated public key is also wrong. Therefore, in this embodiment, the target participant device verifies the calculation parameters after obtaining the calculation parameters of the first electronic device, and calculates the public key only after the verification is passed, so as to prevent the situation where a participant device provides wrong data and calculates an erroneous public key due to attacks, theft, etc. when multiple participant devices jointly calculate the public key of the first electronic device, thereby ensuring the accuracy of the calculated public key, and further ensuring the accuracy of the first electronic device when using its public key to process data, so that other devices can also obtain the correct public key, thereby improving the efficiency of the first electronic device in processing data.
[0126] Embodiment 5
[0127] Embodiment 5 Overview: This embodiment provides a method for signing data sent by a first electronic device to a second electronic device by n participating devices among n participating devices (based on the number of participating devices, it can also be called n threshold signature method), which can be applied to Figure 2In the scenario shown, in the scenario where n electronic devices 31 (denoted as participating device) jointly perform digital signature on the data C sent by the electronic device 3 (denoted as the first electronic device) to the electronic device 4 (denoted as the second electronic device). Among them, it is assumed that there are a total of n participating devices that can participate in signing the data of the first electronic device, and they are marked as P1, P2, …, P n , and the IDs of these n participating devices are denoted as ID1, ID2, …, ID n , and these n participating devices can be jointly used to generate the threshold signature sigma=(r, s), and less than n participating devices cannot complete the signature.
[0128] In addition, in the embodiments of the present application, the n participating devices can perform digital signature on the data of the first electronic device based on the national cryptographic SM2 signature algorithm. Among them, the national cryptographic SM2 algorithm is an algorithm based on elliptic curves, and the parameters used in the calculation process at least include: G is the generator of the elliptic curve cyclic group, which is called the base point of the elliptic curve. q is the order of G, q*G is equal to the infinite point O, and it satisfies O+P = P, where P is any point in the elliptic curve cyclic group. 0 < k < q, and k*P represents the elliptic curve point multiplication. At the same time, in order to implement this embodiment, the following three mathematical concepts are also used: ①. Multi-party multiplication protocol: When n participating devices P1, P2, …, Pt execute the multi-party multiplication protocol, for the {a_i, b_i} input by the i-th participating device Pi, execute the multiplication protocol, so that the output c_i obtained by each of the n participating devices satisfies c_1 + c_2 + … + c_t = (a_1 + a_2 + … + a_t) * (b_1 + b_2 + … + b_t). ②. Discrete logarithm zero-knowledge proof: The prover P can prove to the verifier that P knows k of R = k*G without exposing k. ③. DHtuple zero-knowledge proof: The prover P can prove to the verifier that {G, P, U, V} satisfies P = w*G, V = w*G without exposing w.
[0129] Among them, in the threshold signature method provided in this embodiment, the logical order is the same as that of the method S201 - S203 provided in Embodiment 2. The difference is that t is changed to n, and sign_ski is changed to sk_i. Other specific implementation manners, principles, and technical effects of this embodiment are the same as those of Embodiment 2 and will not be elaborated. For example, the data processing method provided in this embodiment includes:
[0130] S501: The target participating device determines at least two calculation parameters, and the at least two calculation parameters are used to obtain the signature information of the first electronic device.
[0131] Among them, when n participating devices jointly calculate and generate the public key of the first electronic device, the target participating device can be any one of the n participating devices. Or, optionally, the first electronic device can also be any one of the n participating devices. In a specific implementation of S501, the target participating device as the execution subject calculates the signature information of the first electronic device, wherein, since the n participating devices jointly determine at least two calculation parameters to calculate the signature information of the first electronic device, the n participating devices will jointly execute the following steps in S501:
[0132] Step a: Each of the n participating devices calculates parameter M. For the i-th participating device P among the n participating devices, i , first randomly select ro i Then, through the formula M i =ro i *G calculates M i , recorded as the second commitment, and the calculated second commitment M i Perform discrete logarithm zero-knowledge proof. Then the i-th participant device P i The calculated second commitment and proof are broadcast to the other n-1 participating devices. When each participating device has collected the second commitments M1, M2, …, M broadcasted by all n participating devices, t (including the M generated by itself i ) and the corresponding discrete logarithm zero-knowledge proof, verify the validity of all zero-knowledge proofs. If the verification is valid, continue with the formula M=M1+M2+…+M t , the calculated parameter M is used for subsequent verification calculations.
[0133] Step b: Each of the n participating devices calculates parameters R and e. For the i-th participating device P among the n participating devices, i , first randomly select k i , through the formula R i =k i *G calculates R i , recorded as the third commitment, and calculate the third commitment R i The discrete logarithm zero-knowledge proof. Then the i-th participant device P i The calculated third commitment R i The proof is broadcast to the other n-1 participating devices. When each participant has collected the third commitment R1, R2, …, R broadcasted by all n participating devices t (including self-generated R i) and the corresponding discrete logarithm zero-knowledge proof, verify the validity of all zero-knowledge proofs. If the verification is valid, continue with the formula R = R1 + ... + R t Calculate the parameter R, and calculate the parameter e through the formula e=Hash(message||Z). Where message is the message, and Z is the public string. Convert e to integer type. R=(x1,y1), P i Extract x1. The calculated parameters R and e are used for subsequent verification calculations.
[0134] Step c: Each of the n participating devices calculates parameter N i =ro i *PK, where for the ith participant device P among the n participant devices i , calculate the M obtained in step a i , the public key PK of the first electronic device, and the calculated N i DHTuple zero-knowledge proof, denoted as proof_M i _PK_N i _DH. Then, the i-th participant device P i M i ,N i and proof_M i _PK_N i _DH is sent to the other n-1 participating devices. Then when each participant collects the DHTuple zero-knowledge proof proof_M sent by all n participating devices i _PK_N i _DH and all are verified, the parameter N is calculated using the formula N=N1+N2+…+Nt, and the calculated parameter N is used for subsequent verification calculations.
[0135] Step d: Each of the n participating devices calculates the parameter L i =ro i *R, where for the i-th participant device P among the n participant devices i , calculate {G,M i ,R,L i}DHtuple zero-knowledge proof, denoted as proof_M i _R_L i _DH. Then, the i-th participant device P i L i and proof_M i _R_L i_DH is sent to the other n-1 participating devices. Then when each participant collects the DHTuple zero-knowledge proof proof_M sent by all n participating devices i _R_L i _DH and all are verified, then continue to use the formula L=L1+L2+…+L t The parameter L is calculated and used for subsequent verification calculations.
[0136] Step e: Each of the n participating devices uses the IDs of all the n participating devices, ID1, ID2, ..., ID t Calculate the Lagrange coefficient lambda i , and by the formula sk_i = lambda i *p(ID i )(mod q) calculates the parameter sk_i, where (mod q) represents the modulo operation.
[0137] In step f, the n participating devices execute the multi-party multiplication protocol twice, so that the target participating device determines two calculation parameters, which are denoted as Beta and Tao. The calculated two calculation parameters are used to obtain the signature information of the first electronic device.
[0138] Specifically, the calculation parameter obtained by the first multi-party multiplication protocol is recorded as Beta = ro*(1+sk). Then for the i-th participant device P among the n participant devices i Respectively with their own ro i and 1 / t+sk_i(mod q) as the input of the multi-party multiplication protocol, then the n participating devices jointly perform the multi-party multiplication protocol calculation, and the output result is recorded as w i , then each i-th participant device P i The calculated w i Then, when the target device among the n participating devices collects the output results w1, w2…w1 of the multi-party multiplication protocol sent by all the n participating devices, t Then, through the formula Beta = w1 + w2 + ... + w t (mod q) calculates the parameter Beta, and the obtained parameter Beta is used for the subsequent calculation of signature information.
[0139] The calculation parameter obtained by the second multi-party multiplication protocol is recorded as Tao = ro*(k–r*sk). Then for the i-th participant device P among the n participant devices i Respectively with their own ro i and k i–r*sk_i(mod q) is used as the input of the multi-party multiplication protocol, and the n participating devices jointly perform the multi-party multiplication protocol calculation, and the output result is recorded as v i , then each i-th participant device P i The calculated v i Then, when the target device among the n participating devices collects the output results v1, v2…v1 of the multi-party multiplication protocol sent by all the n participating devices, t Then, through the formula Tao = v1 + v2 + ... + v t (mod q) calculates the parameter Tao, and the obtained parameter Tao is used for the subsequent calculation of signature information.
[0140] It should be noted that, since the parameters used in the two multi-party multiplication protocols designed in this embodiment are different, the two multi-party multiplication protocols are independent of each other and do not interfere with each other. Therefore, in the specific implementation process of this embodiment, the n participating devices can simultaneously execute the two multi-party multiplication protocols in parallel. Compared with the method in the prior art where the parameters of the two multi-party multiplication protocols are the same and the parameters are interactive, it can also improve the computing efficiency, save the time required for computing, and can also be equivalent to further improving the efficiency of electronic devices in processing data.
[0141] S502: The target participant device verifies at least two calculation parameters.
[0142] Specifically, for the target participant device among the n participant devices, after determining the two calculation parameters Beta and Tao in S501, the two calculation parameters are not directly used to calculate the signature information of the first electronic device, but the two calculation parameters are verified.
[0143] In a specific implementation, the target participant device verifies the two calculation parameters through the formula Beta*G=M+N and the formula Tao*G=L–r*N. Only when the above two formulas are simultaneously established, the verification is successful and the subsequent step S503 can be continued; otherwise, when the above two formulas cannot be simultaneously established, the verification fails and the subsequent step S503 will not be executed.
[0144] Among them, since M is provided by each participant’s device i =ro i *G is calculated, and N is provided by each participant. i =ro i*PK is calculated, and Beta=ro*(1+sk), so after adding M and N on the right side of the equation Beta*G=M+N, Beta*G on the left side can be obtained. Similarly, since L is L provided by each participant's device i =ro i *R is calculated, and N is the N provided by each participant i =ro i *PK is calculated, and Tao=ro*(k–r*sk), so after subtracting L and r*N on the right side of the equation Tao*G=L–r*N, we can get Tao*G on the left side.
[0145] That is, when each participant device provides M i 、N i , L i When the intermediate calculation data are accurate, the calculated calculation parameters Beta and Tao are also correct. i 、N i , L i When the intermediate calculation data is inaccurate, the calculated calculation parameters Beta and Tao will also be wrong, and the subsequent accurate signature of the first electronic device cannot be calculated. Therefore, in S502, the two calculation parameters used to calculate the signature information of the first electronic device can be verified by the above two formulas. If the two calculation parameters are verified, it means that the intermediate calculation data provided by each participating device is also accurate, so that the subsequent step S503 can be continued.
[0146] S503: If the verification is successful, the target participant device calculates the signature information of the first electronic device based on at least two calculation parameters.
[0147] Specifically, if the target participant device verifies the obtained calculation parameters Beta and Tao through S502, it will continue to calculate the signature information sigma=[r,s] of the first electronic device through the formula r=e+x1(mod q) and the formula s=Tao / Beta(mod q). Figure 2 In the scenario shown, after the target participant device among the n electronic devices 21 calculates the signature information of the electronic device 3 through the above steps, the obtained signature information is sent to the electronic device 3.
[0148] Optionally, after calculating the signature information sigma = [r, s], the target participant device can also verify the validity of the signature information sigma through the SM2 public key signature algorithm, message message and PK, etc. If the signature information sigma is verified to be valid again, the signature information sigma of the first electronic device is finally output.
[0149] Embodiment 6
[0150] Embodiment 6 Overview: This embodiment provides a method for decrypting data sent from a third electronic device to a first electronic device by n participating devices among n participating devices (based on the number of participating devices, it can also be called an n threshold decryption method), which can be applied to Figure 1 In the scenario shown, when electronic device 1 (referred to as the third electronic device) sends data A to electronic device 2 (referred to as the first electronic device), the third electronic device uses the public key of the first electronic device to encrypt data A into data B and then sends it to the first electronic device. When the first electronic device receives data B, n electronic devices 21 (referred to as participating devices) jointly decrypt data B and obtain data A. It is assumed that there are n participating devices that can participate in decrypting the data of the first electronic device, and they are marked as P1, P2, ..., P n , the IDs of these n participating devices are recorded as ID1, ID2, ..., ID n , and these n participating devices can be jointly used to complete the decryption of the data of the first electronic device, and less than n participating devices cannot decrypt.
[0151] In addition, in the embodiments of the present application, the n participating device can decrypt the data of the first electronic device based on the national cryptographic SM2 decryption algorithm. The national cryptographic SM2 algorithm is an algorithm based on elliptic curves. The parameters used in the calculation process at least include: G is the generator of the elliptic curve cyclic group, which is called the base point of the elliptic curve. q is the order of G, q*G is equal to the infinite point O, and it satisfies O + P = P, where P is any point in the elliptic curve cyclic group. 0 < k < q, and k*P represents the elliptic curve point multiplication. At the same time, in order to implement this embodiment, the following three mathematical concepts are also used: ①. Multi-party multiplication protocol: When the n participating devices P1, P2,..., Pt execute the multi-party multiplication protocol, for the {ai, bi} input by the i-th participating device Pi, the multiplication protocol is executed, so that the output ci obtained by each of the n participating devices satisfies c1 + c2 +... + ct = (a1 + a2 +... + at) * (b1 + b2 +... + bt). ②. Discrete logarithm zero-knowledge proof: The prover P can prove to the verifier that P knows k of R = k*G without exposing k. ③. DHtuple zero-knowledge proof: The prover P can prove to the verifier that {G, P, U, V} satisfies P = w*G and V = w*G without exposing w.
[0152] In addition, in this embodiment, there is no limitation on the implementation of encrypting data using the public key PK for the third electronic device. It is recorded that the third electronic device has encrypted the data using the public key PK of the first electronic device and obtained the ciphertext. Set the ciphertext C = {C1||C2||C3}. Then the method provided in the third embodiment of the present application is the process in which the first electronic device receives the ciphertext C and then jointly decrypts the ciphertext C by n participating devices to obtain the plaintext data. In the threshold decryption method provided in this embodiment, the logical order is the same as that of the method S301 - S303 provided in the third embodiment, but the difference is that t is changed to n and decrypt_ski is changed to sk_i. Other specific implementation manners, principles, and technical effects of this embodiment are the same as those of the third embodiment and will not be elaborated. For example, the data processing method provided in this embodiment includes:
[0153] S601: The target participating device obtains a plurality of decryption parameters, which are used to decrypt the data received by the first electronic device.
[0154] Among them, when n participating devices jointly decrypt the data received by the first electronic device, the target participating device can be any one of the n participating devices. Or, optionally, the first electronic device can also be any one of the n participating devices. In a specific implementation of S601, the n participating devices first jointly determine multiple decryption parameters for subsequent decryption of the data of the first electronic device, so the n participating devices will jointly perform the following steps in S601:
[0155] First, for each of the n participating devices, record the i-th participating device P i Using the IDs of n participating devices, ID1, ID2, ..., ID t Calculate the respective Lagrange coefficient lambda i , then calculate sk_i = lambda i *p(ID i ), and extract C1 from the received ciphertext C, and calculate R i =sk_i*C1, and calculate Q i =decrypt_sk_i*G. Then, each participant device P i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof proof_i, and Q i ,R i and proof i The calculated commitment is broadcasted to all other n participating devices. After each participating device has collected the commitments of all other n-1 participating devices, each participating device P i Q i ,R i and proof i Send to the target participant device and record the target participant device as P0.
[0156] S602: The target participant device verifies multiple decryption parameters.
[0157] The target participant device receives R1, R2, ..., R of all n participant devices received in S601. n ,Q1,Q2,…,Q n and proof1,proof2,…,proof n Verification is performed. The verification includes: verifying the correctness of the received commitment, verifying the validity of each DHTuple zero-knowledge proof, and verifying PK=Q1+Q2+…+Q nIf the verification is successful, the subsequent step S603 can be executed. Otherwise, if any of the above verifications fails, the subsequent step S603 will not be executed.
[0158] That is, when each participant device provides i ,R i When the decryption parameters are all accurate, the n participating devices can jointly and accurately decrypt the data of the first electronic device to ensure successful decryption; and when the Q provided by any one or more of the n participating devices is i ,R i When the decryption parameters are inaccurate, the n participating devices may not be able to accurately decrypt the data received by the first electronic device. Therefore, after the decryption parameters are determined in S601 and before the data is actually decrypted in S603, the target participating device in this embodiment also verifies the determined decryption parameters. Only when the verification is passed to ensure that the decryption parameters are accurate, the subsequent decryption steps are performed.
[0159] S603: If the verification is successful, the target participant device decrypts the data received by the first electronic device according to multiple decryption parameters.
[0160] Specifically, if the target participant device verifies the obtained decryption parameters in S602, the data ciphertext C received by the first electronic device can be decrypted by the following specific formula. t =(x1,y1) calculates parameters x1, y1 and R, and calculates parameter e by formula e=KDF(x1||y1||parameters). Then calculate M' by formula M'=C2XORe. Finally, calculate C3' by formula C3'=Hash(x1||M||y1). If C3'=C3, then M' is the correct plaintext, and output M'. Otherwise, output False. Thus, the data ciphertext C received by the first electronic device is decrypted to obtain the encrypted signed data data.
[0161] Embodiment 7
[0162] In the above-mentioned embodiments 1 to 3, a threshold signature and threshold decryption method is provided in a decentralized "tn" manner, and in the embodiment 7 of the present application, a centralized threshold signature and threshold decryption method is also provided. Among them, in the scenarios where t of the n participating devices jointly perform threshold decryption on the data sent by the third electronic device to the first electronic device, and t of the n participating devices jointly perform threshold signature on the data sent by the first electronic device to the second electronic device, a central node device D can be set to generate the public key of the first electronic device.
[0163] Specifically, the central node device D randomly selects the total private key SK, calculates the total public key PK = SK*G, and then publishes PK. The central node device D also randomly selects a t-1 degree polynomial p(x), calculates p(ID1), p(ID2), …, p(ID t ), p(ID i )Send to P i .
[0164] Optionally, in this embodiment seven, after the central node device D generates the public key and private key fragment of the first electronic device, subsequently t of the n participating devices can jointly perform threshold decryption on the data sent by the third electronic device to the first electronic device, and t of the n participating devices can jointly perform threshold signing on the data sent by the first electronic device to the second electronic device. The implementation of the above methods is the same as that of embodiments two and three, and will not be repeated here.
[0165] Embodiment 8
[0166] In the above-mentioned embodiments 4 to 6, a threshold signature and threshold decryption method is provided in a decentralized "nn" manner, and in the embodiment 8 of the present application, a centralized threshold signature and threshold decryption method is also provided. Among them, in the scenarios where the n participating devices jointly perform threshold decryption on the data sent by the third electronic device to the first electronic device, and the n participating devices jointly perform threshold signature on the data sent by the first electronic device to the second electronic device, a central node device D can be set to generate the public key of the first electronic device.
[0167] Specifically, the central node device D randomly selects the total private key SK, calculates the total public key PK = SK*G, and then publishes PK. The central node device D also randomly selects n-1 random numbers sk1, sk2, ..., sk n-1 , calculate sk n =sk–(sk1+sk2+…+sk n-1 ), the central node will sk i Send to P i .
[0168] Optionally, in this eighth embodiment, after the central node device D generates the public key and private key fragment of the first electronic device, n participating devices can subsequently jointly perform threshold decryption on the data sent by the third electronic device to the first electronic device, and n participating devices can jointly perform threshold signing on the data sent by the first electronic device to the second electronic device. The implementation of the above methods is the same as that of embodiments five and six and will not be repeated here.
[0169] In the foregoing embodiments, the methods provided by the embodiments of the present application are introduced, and in order to implement the functions of the methods provided by the embodiments of the present application, the target participant device as the execution subject may include a hardware structure and / or a software module, and implement the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether one of the above functions is executed in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.
[0170] For example, Figure 7 This is a schematic diagram of the structure of an embodiment of a data transmission device provided by the present application, such as Figure 7 The device shown can be the target participant device in any of the above embodiments of the present application, and performs the functions performed by the target participant device. The data transmission device 700 includes: a determination module 701, a verification module 702 and a processing module 703.
[0171] For example, when Figure 7 When the data transmission device shown is used as the target participant device and executes the method in Example 1 of the present application, the determination module 701 is used to receive public key calculation parameters sent by other n-1 participant devices; wherein the public key calculation parameters are used to calculate the public key of the first electronic device, and the public key of the first electronic device is calculated based on the received n-1 public key calculation parameters and its own 1 public key calculation parameter; the verification module 702 is used to verify the public key of the first electronic device; and the processing module 703 is used to output the public key of the first electronic device if the verification module passes the verification.
[0172] Optionally, when the public key calculation parameters include: a first commitment information; the determination module 701 is specifically used to randomly select t first commitment information from the received n-1 first commitment information and its own 1 first commitment information, calculate the public key to be verified of the first electronic device, and repeat multiple times to obtain multiple public keys to be verified; the verification module 702 is specifically used to verify whether the multiple public keys to be verified are the same; wherein, when the multiple public keys to be verified are the same, the verification passes, and the determination module determines that the public key of the first electronic device is any one of the multiple public keys to be verified.
[0173] Optionally, the determination module 701 is specifically used to determine the private key shard, and send the determined private key shard to the other n-1 participant devices; receive the private key shards sent by the other n-1 participant devices; add the received n-1 private key shards and the 1 private key shard determined by itself to obtain a joint shard; determine the first commitment information based on the joint shard and the base point of the elliptic curve, and send the determined first commitment information to the other n-1 participant devices; receive the first commitment information sent by the other n-1 participant devices, and the other n-1 participant devices calculate the first commitment information in the same way as the target participant device.
[0174] For example, when Figure 7 When the data transmission device shown is used as the target participant device and executes the method in Example 2 of the present application, the determination module 701 is used to determine at least two signature parameters; wherein the at least two signature parameters are used to obtain the signature information of the first electronic device; the verification module 702 is also used to verify the at least two signature parameters; the processing module 703 is also used to calculate the signature information of the first electronic device based on the at least two signature parameters if the verification module 702 passes the verification.
[0175] Optionally, the determination module 701 is specifically used to calculate the parameter M, the parameter N, the parameter L, the parameter R and the parameter sign_sk i ; Where t≤n, parameter M is the parameter M provided by t participating devices i The sum, M i The i-th participant device among the t participant devices uses the formula M i =ro i *G is calculated, G is the base point of the elliptic curve, ro i is a random number; parameter R is the parameter R provided by t participating devices i The sum, R i The i-th participant device among the t participant devices uses the formula R i =k i *G is calculated; parameter N is the parameter N provided by t participating devices i sum, N i The i-th participant device among the t participant devices uses the formula N i =ro i *PK is calculated, where PK is the public key of the first electronic device; parameter L is the parameter L provided by t participating devices i The sum of L i =ro i *R; parameter sign_sk i By formula sign_sk i =lambda i*p(ID i ) is calculated, where lambda i Obtained from the IDs of t participating devices; with parameter ro i and parameter 1 / t+sign_sk i (mod q) is used as the input of the first multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter w i After that, the calculated w i Sent to the other t-1 participating devices among the t participating devices; with parameter ro i and k i –r*sign_sk i (mod q) is used as the input of the second multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter v i After that, the calculated v i Send to the other t-1 participant devices among the t participant devices; r is the first part of the signature sigma=[r,s] of the first electronic device; receive the parameter w sent by the other t-1 participant devices among the t participant devices i , and the received t-1 parameters w i And a parameter w determined by itself i Calculate the signature parameter Beta; receive the parameter v sent by the other t-1 participating devices among the t participating devices i , and the received t-1 parameters v i And a parameter v determined by itself i The signature parameter Tao is calculated.
[0176] Optionally, the verification module 702 is specifically used for the target participant device to verify whether the formula Beta*G=M+N and the formula Tao*G=L–r*N are established; wherein, if both formulas are established, the verification is passed.
[0177] Optionally, the processing module 703 is specifically used to calculate the first part r of the signature sigma=[r,s] of the first electronic device through the formula r=e+x1(mod q), where e=Hash(message||Z), message is the message, and Z is the public string; calculate the second part s of the signature sigma=[r,s] of the first electronic device through the formula s=Tao / Beta; and obtain the signature sigma=[r,s] of the first electronic device according to the first part r and the second part s.
[0178] When Figure 7When the data transmission device shown is used as the target participant device and executes the method in Example 3 of the present application, the determination module 701 is also used to determine multiple decryption parameters; wherein the decryption parameters are used to decrypt the data received by the first electronic device; the verification module 702 is also used to verify the multiple decryption parameters; the processing module 703 is also used to decrypt the data received by the first electronic device based on the multiple decryption parameters.
[0179] Optionally, the determination module 701 is specifically used to calculate the parameter R i , parameter Q i And parameter proof i ; Among them, the parameter R i =decrypt_sk i *C1,decrypt_sk i =lambda i *p(ID i ), ID i Used to represent the ID of the i-th participant device among the t participant devices, the Lagrangian coefficient lambda i Obtained from the IDs of t participating devices; parameter Q i =decrypt_sk_i*G, G is the base point of the elliptic curve; parameter proof_i is the device P of the participant i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof; C1 is the first part of the ciphertext C={C1||C2||C3} for the data received by the first electronic device; the parameter R i , parameter Q i And parameter proof i Send to other t-1 participating devices; receive parameter R sent by other t-1 participating devices i , parameter Q i And parameter proof i , combined with the target participant's parameter R i , parameter Q i And parameter proof i , and obtain the decryption parameters R1, R2, …, R of t participating devices t and the decryption parameters Q1, Q2, …, Q of the t participating devices t As multiple decryption parameters.
[0180] Optionally, the verification module 702 is specifically configured to verify the decryption parameters R1, R2, ..., R t and the decryption parameters Q1, Q2, …, Q of the t participating devices tThe correctness of the decryption parameters proof1, proof2, …, proof t The validity of the DHTuple zero-knowledge proof is verified, and the formula PK=Q1+Q2+…+Q t Whether it is established; among them, when the correctness, validity and formula are all established, the verification is passed.
[0181] Optionally, the processing module 703 is specifically configured to: t =(x1,y1) calculates parameters x1 and y1, and calculates parameter e through formula e=KDF(x1||y1||parameters), where parameters are public parameters and KDF is a key generation function; calculates the plaintext data M' to be verified through formula M'=C2 XOR e; where C2 is the second part of the ciphertext C={C1||C2||C3} set for the data received by the first electronic device; calculates parameter C3' according to formula C3'=Hash(x1||M||y1), and determines whether C3' is equal to C3, where C3 is the third part of the ciphertext C={C1||C2||C3} set for the data received by the first electronic device; when it is determined that C3'=C3, determines to output the plaintext data M'.
[0182] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the determination module, the verification module, and the processing module can all be separately established processing elements, or they can be integrated in a chip of the above device for implementation. In addition, they can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0183] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0184] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0185] Figure 8 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. The electronic device can be used as the target participant device described in any of the above embodiments of the present application and execute the method executed by the target participant device. Figure 8As shown, the communication device 1100 may include: a processor 111 (such as a CPU), a transceiver 113; wherein the transceiver 113 is coupled to the processor 111, and the processor 111 controls the transceiver 113. Optionally, the communication device 1100 also includes a memory 112, and the memory 112 may store various instructions for completing various processing functions and implementing the method steps executed by the target participant device in the embodiment of the present application.
[0186] Optionally, the electronic device involved in the embodiment of the present application may further include: a power supply 114, a system bus 115 and a communication interface 116. The transceiver 113 may be integrated in the transceiver of the electronic device, or may be an independent transceiver antenna on the electronic device. The system bus 115 is used to realize the communication connection between components. The above-mentioned communication interface 116 is used to realize the connection and communication between the electronic device and other peripherals.
[0187] In the embodiment of the present application, the processor 111 is used to couple with the memory 112, read and execute the instructions in the memory 112, so as to implement the method steps performed by the target participant device in the above method embodiment. The transceiver 113 is coupled with the processor 111, and the processor 111 controls the transceiver 113 to send and receive messages. The implementation principle and technical effect are similar, and will not be repeated here.
[0188] Should Figure 8 The system bus mentioned in the specification may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as a client, a read-write library, and a read-only library). The memory may include RAM, and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage.
[0189] Should Figure 8 The processor mentioned in the specification may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0190] Optionally, an embodiment of the present application further provides a readable storage medium, in which instructions are stored, and when the storage medium is run on a computer, the computer executes a method performed by the target participant device in any of the aforementioned embodiments of the present application.
[0191] Optionally, an embodiment of the present application further provides a chip for running instructions, wherein the chip is used to execute a method performed by a target participant device in any of the foregoing embodiments of the present application.
[0192] An embodiment of the present application also provides a program product, which includes a computer program, which is stored in a storage medium. At least one processor can read the computer program from the storage medium, and when the at least one processor executes the computer program, it can implement the method performed by the target participant device in any of the aforementioned embodiments of the present application.
[0193] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship; in the formula, the character " / " indicates that the previous and next associated objects are in a "division" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple. At the same time, the various digital numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application. Furthermore, in the embodiments of the present application, the sequence numbers of the above processes do not imply the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0195] In addition, in order to provide a more detailed description of the various embodiments provided in the present application, a more detailed explanation of the aforementioned embodiments of the present application is provided below by way of example, which can be used to compare and explain the aforementioned embodiments of the present application.
[0196] Among them, several concepts can be expressed as a multi-party multiplication protocol: t Each participant P1, P2, ..., Pt executes the multi-party multiplication protocol, and Pi's input {a_i, b_i} executes the multiplication protocol, and each obtains an output c_i, satisfying c_1+c_2+...+c_t=(a_1+a_2+...+a_t)*(b_1+b_2+...+b_t). Discrete logarithm zero-knowledge proof: The prover P can prove to the verifier that P knows k of R=k*G without exposing k. DH tuple zero-knowledge proof: The prover P can prove to the verifier that {G, P, U, V} satisfies P=w*G, V=w*G without exposing w.
[0197] This application designs a secure and efficient threshold SM2 public key signature algorithm and threshold SM2 public key encryption algorithm based on a multi-party multiplication protocol (which can be but not limited to an OTe multi-party multiplication protocol and a homomorphic encryption-based multi-party multiplication protocol). It can be applied to scenarios such as device collaborative authentication, joint payment, anonymous voting, device collaborative decryption, and sensitive data backup and recovery. It can be used in devices such as mobile phones, IoT devices, computers, and servers.
[0198] The key points provided in the above embodiments of the present application can be briefly summarized as follows:
[0199] 1. Verify the correctness of the total public key and the first private key shard. Specifically: (1) The first private key shard is the tn secret sharing shard of the total private key. (2) Each participant calculates the product of its first private key shard and the elliptic curve base point to obtain the first commitment, and broadcasts this commitment to other participants. Each participant collects its own first commitment and the first commitment sent by other participants. (3) Randomly select t first commitments, and use the identity of the corresponding participant of these t first commitments to calculate a set of Lagrange interpolation coefficients (containing t numbers), and use these t first commitments and this set of Lagrange interpolation coefficients to multiply and add them to obtain a verification public key. Repeat the above process to obtain multiple verification public keys. If all verification public keys are equal, the verification is successful, which means that the first private key shards of each party are correct, and the verification public key is the correct total public key. Otherwise, terminate the protocol.
[0200] 2. Execute the multi-party multiplication protocol twice to generate the first multiplication value and the second multiplication value, and obtain the second part of the signature by dividing the second multiplication value by the first multiplication value. Specifically: (1) The t participants convert the first private key shard into the total private key to obtain the second private key shard, and the second private key shard is the addition shard of the total private key. Specifically, each participant uses the identity identifiers of the t participants to calculate its own Lagrange interpolation coefficient, and multiplies its own Lagrange interpolation coefficient with its first private key shard to obtain the second private key shard. (2) When executing the first multiplication protocol, each participant calculates the inverse element of t, calculates the inverse element of t and adds it to the second private key shard to obtain the first multiplication input shard, selects the first random number, and each participant executes the first multi-party multiplication protocol with the first random number and the first multiplication input shard to obtain the first multiplication value shard. Each participant sends the first multiplication value slice to the signature aggregator (the signature aggregator can be one participant or multiple participants, and the signature aggregator can be a participant among the t participants or a participant outside the t participants). The signature aggregator adds the collected t first multiplication value slices to obtain the first multiplication value. (3) When executing the second multiplication protocol, each participant uses the first part of the signature that has been obtained, the second random number selected when generating the first part of the signature, and the second private key slice to calculate the second multiplication input slice. Each participant executes the second multiplication protocol with the first random number and the second multiplication input slice to obtain the second multiplication value slice. Each participant sends the second multiplication value slice to the signature aggregator to add the collected t second multiplication value slices to obtain the second multiplication value. (4) The signature aggregator calculates the second multiplication value and divides it by the first multiplication value to obtain the second part of the signature.
[0201] 3. Through the discrete logarithm zero-knowledge proof and the DH Tuple zero-knowledge proof, prove the correctness of the two multi-party multiplication values. Specifically, suppose t participants want to generate a signature. Let's assume that these t participants are P1, P2, ..., P t , their identities are ID1, ID2, ..., ID t. (1) When generating the first part of the signature, each participant has calculated the commitment using the second random number and the elliptic curve point multiplication, and superimposed these commitments to obtain the second commitment. (2) Each participant calculates the first random number and the elliptic curve base point to obtain the third commitment, and calculates the discrete logarithm zero-knowledge proof of the third commitment. Each participant calculates the point product of the first random number and the total public key to obtain the fourth commitment, and uses the first random number to calculate the DH tuple zero-knowledge proof of the third commitment and the fourth commitment. Each participant calculates the point product of the first random number and the second commitment to obtain the fifth commitment, and uses the first random number to calculate the DH tuple zero-knowledge proof of the third commitment and the fifth commitment. Broadcast the third commitment, fourth commitment, fifth commitment and all zero-knowledge proofs to other participants. Without loss of generality, let the sixth, seventh, and eighth commitments be M, N, and L respectively, the first multiplication value is Beta, the second multiplication value is Tao, the elliptic curve base point is G, and the first part of the signature is r. If the following equation holds, it means that both multiplication output values are correct. Beta*G=M+NTao*G=L–r*N
[0202] 4. In the decryption phase of the threshold SM2 public key encryption scheme, the discrete logarithm zero-knowledge proof and the DH Tuple zero-knowledge proof are used to verify the correctness of the decryption fragment. Let P1, P2, ..., P t , their identities are ID1, ID2, …, ID t The specific process is as follows: (1) In the startup phase, each participant uses ID1, ID2, …, ID t Calculate t Lagrange interpolation coefficients, and use these t Lagrange interpolation coefficients and the collected data from P1, P2, …, P t (2) Each participant calculates the dot product of the second private key shard and the first part of the ciphertext to obtain the tenth commitment, and uses the second private key shard, the ninth commitment and the tenth commitment to calculate the DH tuple zero-knowledge proof. After that, the ninth commitment, the tenth commitment and the DH tuple zero-knowledge proof are sent to the decryptor (the decryptor can be one of the t participants, or a node or device other than the t participants). (3) After obtaining all t ninth commitments, t tenth commitments and t DH tuple Lingzhi proofs, the decryptor verifies the validity of the DH tuple zero-knowledge proof. If the verification passes, it means that all tenth commitments are correct and the protocol continues. Otherwise, the protocol is terminated. (4) The tenth commitment that has passed the verification is superimposed to obtain the decryption commitment. The decryption string is calculated using the decryption commitment and the public parameters, and the decryption string is subjected to a bit-by-bit operation with the second part of the ciphertext to obtain the plaintext. If the hash value calculated by the plaintext and the decryption commitment is equal to the third part of the ciphertext, the plaintext is correct. Otherwise, the plaintext is incorrect.
[0203] For the participant devices that perform threshold SM2 signature calculations, the modules included in each participant are: public and private key generation module, verification module, zero-knowledge proof module, and multi-party multiplication module. (1) Public and private key pair generation module: Generates public and private keys. (2) Zero-knowledge proof module: Calculates and verifies zero-knowledge proof. (3) Verification module: Verifies the correctness of received data. (4) Shard calculation module: Each participant uses the random number and private key selected by itself to perform joint calculations.
[0204] For the participant devices that perform threshold SM2 encryption calculations, each participant includes the following modules: encryption key generation module, encryption module, decryption key generation module, and decryption module. (1) Encryption key generation module: Generates encryption keys using multiple public keys of the decryption party. (2) Encryption module: Encrypts data using encryption keys. (3) Decryption key generation module: Multiple decryption parties generate decryption keys using their own private keys and auxiliary data in the ciphertext. (4) Decryption module: Decrypts ciphertext using decryption keys. (5) Verification module: Determines the honesty of the data provided by the sender by combining zero-knowledge proof and verification algorithm.
[0205] In a specific implementation, in order to implement the threshold SM2 signature algorithm, the system contains the following roles: n participants, of which t participants can generate valid signatures (t can be any number less than or equal to n). Participants can be mobile phones, people, or other electronic devices with signing capabilities. The total public key, total private key, and total private key fragments can be jointly generated by n participants, or generated by a centralized node and sent to n participants.
[0206] The system consists of two phases: the startup phase and the signature phase. In the startup phase, n participants jointly generate a total public key; in the signature phase, t of the n participants can jointly generate a digital signature, and this digital signature can be verified by the total public key.
[0207] Alternative solutions: (1) This application can be a decentralized solution or a centralized solution. The main difference between the two situations lies in the startup phase. The following is an introduction to the workflow of the decentralized solution. For the centralized solution, the startup phase only needs to be changed to a centralized node generating a total private key, total private key shards and total public key, and distributing the total private key shards to the participants. (2) If it is an nn threshold signature (or encryption) scheme, the nn threshold Shamir secret sharing shards can be replaced by the addition shards of the total private key. These two types of shards have the same effect on the nn threshold scheme. (3) To facilitate understanding of the algorithm workflow, the details of generating zero-knowledge proofs and commitments are omitted in the signature phase process described below. The corresponding zero-knowledge proofs, commitments and the process of verifying intermediate data using commitments are described in detail in the subsequent embodiments. This application can adjust the number of zero-knowledge proofs and commitments used according to actual usage requirements to seek a balance between security and performance.
[0208] During the startup phase, (1) each party randomly selects a t-1 degree polynomial, and the constant term is used as its first private key shard setup_sk_i. (2) Each party calculates the shared shards for all participants based on the polynomial it selects and the IDs of all participants, and sends the shared shards to the corresponding participants. (3) After receiving the shared shards sent by all participants, these shared shards are added together to obtain the total private key shard, and the point product of the total private key shard and the elliptic curve base point is calculated to obtain the first commitment, and the first commitment is broadcast to other participants. (4) After collecting the first commitments broadcast by all participants, multiple groups of t participant IDs are used to generate Lagrangian coefficients, and the total public key is calculated using these Lagrangian coefficients and the corresponding first commitments. If the public keys calculated for each group of IDs are the same, the public key is valid and the public key is output. Otherwise, the protocol is terminated.
[0209] In the signing phase, (1) t parties participate in the signing phase, let these t parties be P1, P2,…, Pt. Each participant uses their t IDs to calculate their own Lagrange coefficient lgr_i, and calculates the second private key shard sk_i = lgr_i*setup_sk_i. (2) Each party randomly selects a random number k_i, calculates R_i = k_i*G, and broadcasts R_i to other participants. (3) After receiving R_i broadcast by all participants, calculate R = R_1+R_2+…+R_t = (x1, y1). According to the SM2 signature algorithm, r is calculated using the message M, public parameters and x1. (4) Each party selects a random number ro_i, and executes two multi-party multiplication protocols with {ro_i, 1 / t+sk_i} and {ro_i, k_i–r*sk_i} as input to obtain two addition shards beta_i and tao_i,
[0210] Satisfies beta_1+beta_2+…+beta_t=ro*(sk+1) and tao_1+tao_2+…+tao_t=ro*(k–r*sk). (5) Each participant sends its own beta_i and tao_i to the aggregator (the aggregator can be a participant or someone other than all the participants). The aggregator calculates Beta=beta_1+beta_2+…+beta_t, Tao=tao_1+tao_2+…+tao_t, calculates s=1 / beta*tao, synthesizes the signature sig={r,s}, and uses pk and SM2 signature verification algorithms to verify the validity of sig. If the verification is successful, sig is output, otherwise the protocol is terminated.
[0211] In a specific implementation, in order to implement the threshold SM2 encryption algorithm, the system contains the roles of: encryptor, decryptor and n participants, of which t participants can jointly complete the decryption (t can be any number less than or equal to n). In this article, we take the encryptor and decryptor as members of the n participants as an example to introduce the solution workflow, but in fact the encryptor and decryptor can be people or devices other than the n participants, and the specific situation can be adjusted according to the actual application. The participants can be mobile phones, people or other electronic devices with signing capabilities. The total public key, total private key and total private key shards can be jointly generated by n participants, or they can be generated by a centralized node and sent to n participants.
[0212] The system consists of two phases: startup phase, encryption phase and decryption phase. In the startup phase, n participants jointly generate a total public key; in the signature phase, t of the n participants can jointly generate a digital signature, and this digital signature can be verified by the total public key.
[0213] Alternative solutions: (1) This application can be a decentralized solution, or it can be adjusted to a centralized solution as needed. The main difference between the two situations lies in the startup phase. The following is the workflow of the decentralized solution. For the centralized solution, the startup phase only needs to be changed to a centralized node generating a total private key, a total private key shard, and a total public key, and distributing the total private key shard to the participants. (2) If it is an nn threshold encryption scheme, the nn threshold Shamir secret sharing shard can be replaced by an additive shard of the total private key. These two types of shards have the same threshold effect on the nn threshold scheme, but have significant differences in the performance of the startup phase, that is, the computational complexity and communication complexity of the startup phase based on additive sharding are significantly less than those of the startup phase based on Shamir secret sharing. (3) To facilitate understanding of the algorithm workflow, the details of generating zero-knowledge proofs and commitments are omitted in the process described below. The corresponding zero-knowledge proofs, commitments, and the process of verifying intermediate data using commitments are described in detail in the subsequent embodiments. This application can adjust the number of zero-knowledge proofs and commitments used according to actual usage needs to strike a balance between security and performance.
[0214] During the startup phase, (1) each party randomly selects a t-1 degree polynomial, and the constant term is used as its first private key shard setup_sk_i. (2) Each party calculates the shared shards for all participants based on the polynomial it selects and the IDs of all participants, and sends the shared shards to the corresponding participants. (3) After receiving the shared shards sent by all participants, these shared shards are added together to obtain the total private key shard, and the point product of the total private key shard and the elliptic curve base point is calculated to obtain the first commitment, and the first commitment is broadcast to other participants. (4) After collecting the first commitments broadcast by all participants, multiple groups of t participant IDs are used to generate Lagrangian coefficients, and the total public key is calculated using these Lagrangian coefficients and the corresponding first commitments. If the public keys calculated for each group of IDs are the same, the public key is valid and the public key is output. Otherwise, the protocol is terminated.
[0215] In the encryption phase, (1) the encryptor uses the decryptor's multiple public keys to generate a total public key, and uses the total public key to encrypt the plaintext to obtain the ciphertext. The ciphertext C = {C1, C2, C3} is obtained.
[0216] In the decryption phase, (1) t parties participate in the decryption phase. Without loss of generality, let these t parties be P1, P2, …, Pt. Each party calculates its own Lagrange coefficient lgr_i using their t IDs, and calculates the second private key fragment sk_i = lgr_i * setup_sk_i. (2) The parties calculate R_i = sk_i * C1 using sk_i and C1, and send R_i to the aggregator (the aggregator can be a certain party or someone other than all parties). (3) The aggregator superimposes the received R_1, R_2, …, R_t to obtain R = R_1 + R_2 + … + R_t. The aggregator uses the function specified by the SM2 encryption algorithm, and calculates e using R and the public parameters. Calculate the exclusive OR of e and C2 to obtain the plaintext M. (4) The aggregator calculates the hash value using R and M. If this hash value is equal to C3, it means that M is a valid plaintext. Otherwise, it means that an error occurred in this decryption (the ciphertext may have been tampered with, a certain party may have provided incorrect data, the ciphertext itself may have an error, etc.).
[0217] More specifically, in a specific implementation of the SM2 threshold signature, let all parties be P1, P2, …, P n , any t parties (t ≤ n) can jointly generate the threshold signature sigma = (r, s). Without loss of generality, let the parties participating in generating the threshold signature be P1, P2, …, P t , and their IDs are ID1, ID2, …, ID t . G is the generator of the elliptic curve cyclic group, which is called the base point of the elliptic curve. q is the order of G, q * G is equal to the infinite point O, satisfying O + P = P, where P is any point in the elliptic curve cyclic group. 0 < k < q, k * P represents the elliptic curve point multiplication.
[0218] Then in 1, the startup phase, (1) Each party obtains the private key setup_sk_i in the startup phase. Each party randomly selects a polynomial f i (x) of degree t - 1, and the constant term of the polynomial is P i The selected setup_sk_i, that is, f i (0) = setup_sk i . ID1, ID2, …, ID n are the IDs of n parties. P i uses the IDs of n parties to calculate n fragments, that is, f i (ID1), f i (ID2), …, f i (ID n ), and sends f i (ID j ) to P jAfter everyone receives n shards (including the shards they calculated for themselves), they add these shards together to get a joint shard p (ID i )=f1(ID i )+f2(ID i )+…+f n (ID i ), since each f i (x) are all from the participant P i The chosen polynomial is t-1, so p(x) is also a t-1 polynomial. i Calculate T i =p(ID i )*G, and T i Send to other participants. (2) When n T1, T2, …, T n Time (including self-generated T i ), using ID1, ID2,…,ID t Calculate the Lagrange coefficient m 11 ,m 12 ,…,m 1t Calculate PK1 = m 11 *T1+m 12 *T2+…,+m 1t *T t . Use ID2, ID3,…,ID t+1 Calculate the Lagrange coefficient m 21 ,m 22 ,…,m 2t Calculate PK2 = m 21 *T2+m 22 *T3+…,+m 2t *T t+1 . And so on, using ID n-t+1 ,ID n-t+2 ,…,ID n Calculate PK n-t+1 If PK1=PK2=…=PK n-t+1 , then let PK = PK1. Otherwise, terminate the protocol. i Output: p(ID i ),PK.
[0219] In 2, the signing phase, suppose t participants want to generate a signature sigma = (r, s). Let's assume they are the first t participants, and their IDs are ID1, ID2, ..., ID t a)P i Randomly select ro i , calculate M i =ro i *G, calculate Mi Zero-knowledge proof of discrete logarithm. Calculate M i and M i The commitment of the discrete logarithm zero-knowledge proof is broadcast to other participants. After each participant has collected the commitments broadcast by all participants, P i M i and M i The discrete logarithm zero-knowledge proof is sent to other participants. i Collect M1, M2, …, M t (including the M generated by itself i ) and the corresponding zero-knowledge proof, verify whether it is consistent with the previously received commitment and the validity of all zero-knowledge proofs. If the verification is valid, continue to execute the protocol. Calculate M = M1 + M2 + ... + M t b)P i Randomly select k i , calculate R i =k i *G, calculate R i Zero-knowledge proof of discrete logarithm, calculate R i and R i The commitment of the discrete logarithm zero-knowledge proof is broadcast to other participants. After each participant has collected the commitments broadcast by all participants, P i R i and R i The discrete logarithm zero-knowledge proof is sent to other participants. i Receive R1, R2, …, R t (including self-generated R i ) and the corresponding zero-knowledge proof, verify whether it is consistent with the previously received commitment and the validity of all zero-knowledge proofs. If the verification is valid, continue to execute the protocol. Calculate R = R1 + ... + R t Note: R = k*G, k = k1+…+k t (mod q). R=(x1,y1),P i Extract x1. Calculate e = Hash (message||Z), where message is the message and Z is a public string. Convert e to integer type. Calculate r = e + x1 (mod q). c) P i Calculate N i =ro i *PK, calculate M i ,PK,N i DH Tuple zero-knowledge proof proof_M i _PK_N i _DH. i ,Ni and proof_M i _PK_N i _DH is sent to other participants. If all proof_M i _PK_N i _If DH verification is successful, continue. Calculate N = N1 + N2 + ... + N t d) P i Calculate L i =ro i *R, and calculate {G,M i ,R,L i}DH tuple zero-knowledge proof proof_M i _R_L i _DH, L i and the corresponding proof_M i _R_L i _DH is sent to other participants. If all proof_M i _R_L i _If DH verification is successful, continue. Calculate L = L1 + L2 + ... + L t .
[0220] e) Each party uses ID1, ID2, ..., ID t Calculate your own Lagrange coefficient, lambda i , calculate sign_sk i =lambda i *p(ID i )(mod q).
[0221] f) Execute two multi-party multiplication protocols to calculate Beta and Tao (Beta = ro*(1+sk), Tao = ro*(k–r*sk)). The first multi-party multiplication protocol: P i (i=1,2,…,t) with ro i and 1 / t+sign_sk i (mod q) is the input of the multi-party multiplication protocol. The multiplication protocol P i The output is w i .P i Send w to other participants i q is the order of the elliptic curve base point G. Collect w1,w2,…,w t Afterwards, P i Calculate Beta = w1 + w2 + ... + w t (mod q). The second multi-party multiplication protocol: P i with ro i and k i –r*sign_ski (mod q) is the input of the multi-party multiplication protocol. The multiplication protocol P i The output is v i .P i Send v to other participants i . Collect v1, v2, …, v t Afterwards, P i Calculate Tao = v1 + v2 + ... + v t (mod q). Note that here Beta=ro*(1+sk)(mod q), Tao=ro*(k–r*sk)(mod q). g) Verification process If the following verification equations are all true, the verification is successful. Otherwise, the protocol is terminated. Beta*G=M+N and Tao*G=L–r*N. If the verification is successful, the protocol continues to execute. Otherwise, the protocol is terminated. h) Output signature sigma. Calculate s=Tao / Beta(mod q), let sigma=[r,s]. Use SM2 public key signature algorithm, message message and PK to verify the validity of sigma. If sigma is valid, output sigma.
[0222] In this embodiment, (1) in the startup phase, the correctness of the private key shards and the total public key is solved by using the elliptic curve point multiplication commitment and Lagrange interpolation coefficients of the total private key shards. Specifically, each participant calculates the elliptic curve point multiplication commitment of the total private key shards and broadcasts it to other participants. After receiving n-1 commitments sent by other participants, each participant can use the Lagrange interpolation coefficients and these commitments to verify whether any t commitments can use the Lagrange interpolation coefficients to combine the same total public key. If the verification is successful, continue. Otherwise, terminate the protocol. Through the above process, if the verification is successful, it means that the total private key shards in the hands of each participant are correct, and the total public key is also correct. Otherwise, it is possible that a participant provides an incorrect private key shard, causing other participants to obtain an incorrect total private key shard and fail to obtain the correct total public key. (2) The correctness of the intermediate numbers in the protocol process is solved by combining discrete logarithm zero-knowledge proof, DH tuple zero-knowledge proof and elliptic curve point multiplication commitment. Through this method, if the verification is passed, it means that the intermediate result of this stage is correct, and the data provided by each participant for this intermediate result is also correct. Otherwise, there is a situation where wrong data is provided, and it can be determined which participant provided the wrong data. (3) The design allows two multi-party multiplication protocols to be executed in parallel. The reason is that in this application, the output of any multi-party multiplication protocol is independent of the input of another multi-party multiplication protocol. Since the communication volume and number of communication rounds of the multi-party multiplication protocol are large, if the multi-party multiplication protocol can be executed in parallel, the efficiency of the algorithm will be significantly improved. In particular, (1) in the startup phase, the correctness of the private key shard and the total public key is solved by using the elliptic curve point multiplication commitment of the total private key shard and the Lagrange interpolation coefficient. However, in the prior art, the correctness verification of the total shard and the total public key is missing or insufficient. (2) By combining discrete logarithm zero-knowledge proof, DH tuple zero-knowledge proof and elliptic curve point multiplication commitment, the correctness of the algorithm intermediate data and the correctness of the data provided by each participant for this intermediate data are solved. In the prior art, the work on the correctness of intermediate data and the correctness verification of intermediate data related shards is missing or insufficient. (3) The two multi-party multiplication protocols can be executed in parallel by design. In the prior art, the two multi-party multiplication protocols can only be executed serially, which limits the performance of their algorithms to a certain extent.
[0223] In a specific implementation, in order to implement the threshold SM2 decryption algorithm, assume that all participants are P1, P2, ..., P n . t participants (t is less than or equal to n) can complete the decryption, and less than t participants cannot decrypt. Let's assume that these t participants are P1, P2, ..., P t , their IDs are ID1, ID2, …, ID tThe person responsible for decrypting the message can be P1, P2, ..., P t As long as one or more people among them repeatedly send the information needed to be sent to multiple people, multiple people can have the ability to decrypt the message M. Suppose a user P0 is P1, P2, ..., P t Taking P0 as an example, the process of P0 decrypting C to obtain plaintext M is as follows:
[0224] In the startup phase, (1) each party obtains the private key setup_sk_i of the startup phase. Each participant randomly selects a t-1 degree polynomial f i (x), the constant term of the polynomial is P i The selected setup_sk_i, i.e. f i (0) = setup_sk i ID1, ID2, …, ID n is the ID of n participants. i Use the IDs of n participants to calculate n shards, that is, f i (ID1),f i (ID2),…,f i (ID n ), and f i (ID j )Send to P j After everyone receives n shards (including the shards they calculated for themselves), they add these shards together to get a joint shard p (ID i )=f1(ID i )+f2(ID i )+…+f n (ID i ), since each f i (x) are all from the participant P i The chosen polynomial is t-1, so p(x) is also a t-1 polynomial. i Calculate T i =p(ID i )*G, and T i Send to other participants. (2) When n T1, T2, …, T n Time (including self-generated T i ), using ID1, ID2,…,ID t Calculate the Lagrange coefficient m 11 ,m 12 ,…,m 1t Calculate PK1 = m 11 *T1+m 12 *T2+…,+m 1t *Tt . Use ID2, ID3,…,ID t+1 Calculate the Lagrange coefficient m 21 ,m 22 ,…,m 2t Calculate PK2 = m 21 *T2+m 22 *T3+…,+m 2t *T t+1 . And so on, using ID n-t+1 ,ID n-t+2 ,…,ID n Calculate PK n-t+1 If PK1=PK2=…=PK n-t+1 , then let PK = PK1. Otherwise, terminate the protocol. i Output: p(ID i ),PK.
[0225] In 2, the encryption phase, the data holder uses the public key PK to encrypt the data M. The encryption method is consistent with the SM2 public key encryption algorithm. The process is as follows: (1) Select a random number k and calculate C1 = k*G, where G is the base point of the elliptic curve. (2) (x1, y1) = k*PK. Calculate e = KDF(x1||y1||parameters), where KDF is the key generation function, which can be replaced by a hash function, and parameters are public parameters. (3) Calculate C2 = data XOR e. (4) C3 = Hash(x1||M||y1). (5) Set the ciphertext C = {C1||C2||C3}.
[0226] In 3, the decryption phase, a) each participant P i Use ID1,ID2,…,ID t Calculate your own Lagrange coefficient lambda i , calculate decrypt_sk i =lambda i *p(ID i ). b) Extract C1, P from C i Calculate R i =decrypt_sk i *C1, and calculate Q i =decrypt_sk_i*G. i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof proof_i. Calculate Q i ,R i and proof it-1 participants. i Q i ,R i and proof i Send to P0. c) When P0 collects all R1, R2, …, R t ,Q1,Q2,…,Q t and proof1,proof2,…,proof t Then verify the correctness of the commitment received previously, and verify the validity of each zero-knowledge proof, and verify PK = Q1 + Q2 + ... + Q t If all verifications pass, the protocol continues. If any proof i If it fails to pass the verification, it means that P i Wrong data is provided and the protocol is terminated. d) Calculate R = R1 + R2 + ... + R t =(x1,y1), e = KDF(x1||y1||parameters). e) Calculate M' = C2 XOR e. f) Calculate C3' = Hash(x1||M||y1). If C3' = C3, then M' is the correct plaintext, output M'. Otherwise, output False.
[0227] In this embodiment, (1) in the startup phase, the correctness of the private key shards and the total public key is solved by using the elliptic curve point multiplication commitment and Lagrange interpolation coefficients of the total private key shards. In the prior art, the correctness verification of the total shards and the total public key is missing or insufficient. (2) By combining the discrete logarithm zero-knowledge proof, the DH tuple zero-knowledge proof and the elliptic curve point multiplication commitment, the correctness of the algorithm intermediate data and the correctness of the data provided by each participant for this intermediate data are solved. In the prior art, the work on the correctness of the intermediate data and the correctness verification of the intermediate data related shards is missing or insufficient. In particular, (1) in the startup phase, the correctness of the private key shards and the total public key is solved by using the elliptic curve point multiplication commitment and Lagrange interpolation coefficients of the total private key shards. In the prior art, the correctness verification of the total shards and the total public key is missing or insufficient. (2) By combining discrete logarithm zero-knowledge proof, DH tuple zero-knowledge proof and elliptic curve point multiplication commitment, the correctness of the algorithm's intermediate data and the correctness of the data provided by each participant for this intermediate data are solved. In the prior art, the work on the correctness of intermediate data and the correctness verification of intermediate data-related shards is missing or insufficient.
[0228] In another specific implementation, 1. Verify the correctness of the total public key and the first private key shard. The specific summary is as follows: 1.1: The first private key shard is the tn secret sharing shard of the total private key. 1.2: The total public key is the public key corresponding to the total private key. 1.3: Each participant calculates the product of its first private key shard and the elliptic curve base point to obtain the first commitment, and broadcasts this commitment to other participants. Each participant collects its first commitment and the first commitment sent by other participants. 1.4: Randomly select t first commitments, and use the identity of the corresponding participant of these t first commitments to calculate a set of Lagrange interpolation coefficients (containing t numbers), and use these t first commitments and this set of Lagrange interpolation coefficients to multiply and add them to obtain a verification public key. Repeat the above process to obtain multiple verification public keys. If all verification public keys are equal, the verification is passed, which means that the first private key shards of each party are correct, and the verification public key is the correct total public key. Otherwise, terminate the protocol.
[0229] 2. Execute the multi-party multiplication protocol twice to generate the first multiplication value and the second multiplication value, and obtain the second part of the signature by dividing the second multiplication value by the first multiplication value. Specifically as follows: 2.1: The t participants convert the first private key shard into the total private key to obtain the second private key shard, and the second private key shard is the addition shard of the total private key. Specifically, each participant uses the identity identifiers of the t participants to calculate its own Lagrange interpolation coefficient, and multiplies its own Lagrange interpolation coefficient with its first private key shard to obtain the second private key shard. 2.2: When executing the first multiplication protocol, each participant calculates the inverse element of t, calculates the inverse element of t and adds it to the second private key shard to obtain the first multiplication input shard, selects the first random number, and each participant executes the first multiplication protocol with the first random number and the first multiplication input shard to obtain the first multiplication value shard. Each participant sends the first multiplication value shard to the signature aggregator (the signature aggregator can be one participant or multiple participants, and the signature aggregator can be a participant among the t participants or a participant outside the t participants). The signature aggregator adds the collected t first multiplication value shards to obtain the first multiplication value. 2.3: When executing the second multiplication protocol, each participant uses the first part of the signature that has been obtained, the second random number selected in generating the first part of the signature, and the second private key shard to calculate the second multiplication input shard. Each participant executes the second multiplication protocol with the first random number and the second multiplication input shard to obtain the second multiplication value shard. Each participant sends the second multiplication value shard to the signature aggregator to add the collected t second multiplication value shards to obtain the second multiplication value. 2.4: The signature aggregator calculates the second multiplication value and divides it by the first multiplication value to obtain the second part of the signature.
[0230] 3. Through the discrete logarithm zero-knowledge proof and DH Tuple zero-knowledge proof, prove the correctness of the two multi-party multiplication values. Specifically, suppose t participants want to generate a signature. Let's assume that these t participants are P1, P2, ..., P t , their identities are ID1, ID2, ..., ID t . 3.1: When generating the first part of the signature, each participant has calculated the commitment using the second random number and the elliptic curve point multiplication, and superimposed these commitments to obtain the second commitment. 3.2: Each participant calculates the third commitment by multiplying the first random number and the elliptic curve base point, and calculates the discrete logarithm zero-knowledge proof of the third commitment. Each participant calculates the point multiplication of the first random number and the total public key to obtain the fourth commitment, and uses the first random number to calculate the DH tuple zero-knowledge proof of the third commitment and the fourth commitment. Each participant calculates the point multiplication of the first random number and the second commitment to obtain the fifth commitment, and uses the first random number to calculate the DH tuple zero-knowledge proof of the third commitment and the fifth commitment. Broadcast the third commitment, the fourth commitment, the fifth commitment and all zero-knowledge proofs to other participants. Without loss of generality, let the sixth, seventh, and eighth commitments be M, N, and L respectively, the first multiplication value is Beta, the second multiplication value is Tao, the elliptic curve base point is G, and the first part of the signature is r. If the following equation holds, it means that both multiplication output values are correct. Beta*G=M+N and Tao*G=L–r*N
[0231] 4. In the decryption phase of the threshold SM2 public key encryption scheme, the discrete logarithm zero-knowledge proof and the DH Tuple zero-knowledge proof are used to verify the correctness of the decryption fragment. Let P1, P2, ..., P t , their identities are ID1, ID2, …, ID t , the specific process is as follows: 4.1: In the startup phase, each participant uses ID1, ID2, ..., ID t Calculate t Lagrange interpolation coefficients, and use these t Lagrange interpolation coefficients and the collected data from P1, P2, …, P t4.2: Each participant calculates the dot product of the second private key shard and the first part of the ciphertext to obtain the tenth commitment, and uses the second private key shard, the ninth commitment and the tenth commitment to calculate the DH tuple zero-knowledge proof. After that, the ninth commitment, the tenth commitment and the DH tuple zero-knowledge proof are sent to the decryptor (the decryptor can be one of the t participants, or a node or device other than the t participants). 4.3: After obtaining all t ninth commitments, t tenth commitments and t DH tuple Lingzhi proofs, the decryptor verifies the validity of the DH tuple zero-knowledge proof. If the verification passes, it means that all tenth commitments are correct and the protocol continues. Otherwise, the protocol is terminated. 4.4: The tenth commitment that has passed the verification is superimposed to obtain the decryption commitment. The decryption string is calculated using the decryption commitment and the public parameters, and the decryption string is subjected to bit-by-bit confusion operation with the second part of the ciphertext to obtain the plaintext. If the hash value calculated by the plaintext and the decryption commitment is equal to the third part of the ciphertext, the plaintext is correct. Otherwise, the plaintext is wrong.
[0232] Therefore, in the above example, (1) the correctness of the total public key and the total private key shard is the cornerstone of the correctness of the entire scheme, so if the correctness of the total public key and the total private key shard cannot be guaranteed, the correctness of the scheme is out of the question. If the total public key is wrong, then the correctness of the signature cannot be verified; if the total private key shard is wrong, then a valid signature cannot be generated. Therefore, ensuring the correctness of the total public key and the total private key shard is of utmost importance. The problem of correctness verification of the total public key and the total private key shard is solved. If the verification is passed, it means that the total private key shard in the hands of each participant is correct, and the total public key is also correct. In this way, a solid foundation is provided for the correct execution of the algorithm. (2) Since the threshold cipher requires multiple participants to interact with data shards to complete the calculation of each intermediate link, when the aggregator uses the data shards provided by each participant to calculate the intermediate data, if the correctness of the intermediate data and the correctness of the data shards cannot be distinguished, then the correctness of the final result of the algorithm will be seriously affected. Specifically, if the correctness of the intermediate data cannot be determined, then the correctness of the algorithm execution cannot be guaranteed; if the correctness of the data shards provided by the participants cannot be identified, then the malicious participants will be able to provide erroneous data without fear, and no one will be able to detect who provided the erroneous data. Therefore, the correctness verification of the intermediate data and data shards will play an important role in the correct execution of the algorithm and in resisting malicious participants. (3) The present application is designed so that two multi-party multiplication protocols can be executed in parallel. The reason is that in the present application, the output of any multi-party multiplication protocol is independent of the input of another multi-party multiplication protocol. Since the multi-party multiplication protocol has a large amount of communication volume and a large number of communication rounds, if the multi-party multiplication protocol can be executed in parallel, the efficiency of the algorithm will be significantly improved. Therefore, the present application can optimize the performance of the algorithm by executing the multi-party multiplication protocol in parallel.
[0233] In addition, the present application can be applied to scenarios such as joint payment, collaborative authentication, collaborative decryption, blockchain consensus, data backup and recovery. The multi-party multiplication protocol used in the present application can be any multi-party multiplication protocol (for example, a multi-party multiplication protocol based on oblivious transmission, a multi-party multiplication protocol based on homomorphic encryption, etc.), and the form of sharding can be converted by algorithm, such as from Shamir secret sharing sharding to addition sharding, from addition sharding to Shamir secret sharing sharding, etc. The core innovation of the present application can be applied to other threshold signature and threshold encryption and decryption algorithms.
Claims
1. A data processing method, characterized in that: Applied to a data processing system, the data processing system comprises: a first electronic device and n participant devices, where n is an integer greater than 1, the method comprises: The target participant device among the n participant devices receives the public key calculation parameters sent by the other n-1 participant devices; wherein the public key calculation parameters are used to calculate the public key of the first electronic device; the public key calculation parameters include: first commitment information; The target participant device randomly selects t first commitment information from the received n-1 first commitment information and its own 1 first commitment information, calculates and obtains the public key to be verified of the first electronic device, and repeats the process multiple times to obtain multiple public keys to be verified; The target participant device verifies whether the multiple public keys to be verified are the same; When the multiple public keys to be verified are all the same, the verification is successful, and it is determined that the public key of the first electronic device is any one of the multiple public keys to be verified; If the verification is successful, the target participant device outputs the public key of the first electronic device.
2. The method according to claim 1, characterized in that Before the target participant device among the n participant devices receives the public key calculation parameters sent by the other n-1 participant devices, the method further includes: The target participant device determines a private key shard, and sends the determined private key shard to the other n-1 participant devices; The target participant device receives the private key fragments sent by the other n-1 participant devices; The target participant device adds the received n-1 private key fragments and the 1 private key fragment determined by itself to obtain a joint fragment; The target participant device determines the first commitment information according to the joint shard and the base point of the elliptic curve, and sends the determined first commitment information to the other n-1 participant devices; The target participant device receives the first commitment information sent by the other n-1 participant devices, and the other n-1 participant devices calculate the first commitment information in the same manner as the target participant device.
3. The method according to claim 1 or 2, characterized in that: Also includes: The target participant device determines at least two signature parameters; wherein the at least two signature parameters are used to obtain signature information of the first electronic device; The target participant device verifies the at least two signature parameters; If the verification is successful, the target participant device calculates the signature information of the first electronic device based on the at least two signature parameters.
4. The method according to claim 3, characterized in that The target participant device determines at least two signature parameters, including: The target participant device calculates parameters M, N, L, R and sign_sk i ; Among them, parameter M is the parameter M provided by t participating devices i The sum of t≤n, M i The i-th participant device among the t participant devices uses the formula M i =ro i *G is calculated, G is the base point of the elliptic curve, ro i is a random number; parameter R is the parameter R provided by t participating devices i The sum, R i The i-th participant device among the t participant devices uses the formula R i =k i *G is calculated, k i is a random number; parameter N is the parameter N provided by t participating devices i sum, N i The i-th participant device among the t participant devices uses the formula N i =ro i *PK is calculated, where PK is the public key of the first electronic device; parameter L is the parameter L provided by t participating devices i The sum of L i =ro i *R; parameter sign_sk i By formula sign_sk i =lambda i *p(ID i )(mod q) is calculated, where ID i Used to represent the ID of the i-th participant device among the t participant devices, the Lagrangian coefficient lambda i It is obtained from the IDs of t participating devices; (mod q) represents the modulo operation, q is the order of G, and G is the base point of the elliptic curve; p(ID i ) is a t-1 degree polynomial; The target participant device is configured with parameter ro i and parameter 1 / t+sign_sk i (mod q) is used as the input of the first multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter w i After that, the calculated w i Send to other t-1 participating devices among t participating devices; The target participant device is configured with parameter ro i and k i –r*sign_sk i (mod q) is used as the input of the second multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter v i After that, the calculated v i Send to other t-1 participant devices among the t participant devices; the r is the first part of the signature sigma=[r,s] of the first electronic device; The target participant device receives the parameter w sent by the other t-1 participant devices among the t participant devices. i , and the received t-1 parameters w i And a parameter w determined by itself i Calculate the signature parameter Beta; The target participant device receives the parameter v sent by the other t-1 participant devices among the t participant devices. i , and the received t-1 parameters v i And a parameter v determined by itself i The signature parameter Tao is calculated.
5. The method according to claim 4, characterized in that The target participant device verifies the at least two signature parameters, including: The target participant device verifies whether the formula Beta*G=M+N and the formula Tao*G=L–r*N are established; if both formulas are established, the verification is successful.
6. The method according to claim 5, characterized in that If the verification is successful, the target participant device calculates the signature information of the first electronic device according to the at least two signature parameters, including: The target participant device calculates the first part r of the signature sigma=[r,s] of the first electronic device by the formula r=e+x1(mod q), wherein e=Hash(message||Z), message is the message, Z is the public string; (mod q) represents the modulus operation, q is the order of G, and G is the base point of the elliptic curve; The target participant device calculates the second part s of the signature sigma=[r,s] of the first electronic device by using the formula s=Tao / Beta; The target participant device obtains the signature sigma=[r, s] of the first electronic device according to the first part r and the second part s.
7. The method according to any one of claims 1-2, 4-6, characterized in that: Also includes: The target participant device determines a plurality of decryption parameters; wherein the decryption parameters are used to decrypt the data received by the first electronic device; The target participant device verifies the multiple decryption parameters; If the verification is successful, the target participant device decrypts the data received by the first electronic device according to the multiple decryption parameters.
8. The method according to claim 7, characterized in that The target participant device determines a plurality of decryption parameters, including: The target participant device calculates the parameter R i , parameter Q i And parameter proof i ; Among them, the parameter R i =decrypt_sk i *C1,decrypt_sk i =lambda i *p(ID i ), ID i Used to represent the ID of the i-th participant device among the t participant devices, the Lagrangian coefficient lambda i Obtained from the IDs of t participating devices; parameter Q i =decrypt_sk_i*G, G is the base point of the elliptic curve; parameter proof_i is the device P of the participant i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof; C1 is the first part of the ciphertext C={C1||C2||C3} in the data received by the first electronic device; p(ID i ) is a t-1 degree polynomial; The target participant device sets the parameter R i , parameter Q i And parameter proof i Send to other t-1 participants’ devices; The target participant device receives the parameter R sent by the other t-1 participant devices. i , parameter Q i And parameter proof i , combined with the target participant's parameter R i , parameter Q i And parameter proof i , and obtain the decryption parameters R1, R2, …, R of t participating devices t and the decryption parameters Q1, Q2, …, Q of the t participating devices t as the multiple decryption parameters.
9. The method according to claim 8, characterized in that The target participant device verifies multiple decryption parameters, including: The target participant device decrypts the parameters R1, R2, ..., R of all t participant devices. t and the decryption parameters Q1, Q2, …, Q of the t participating devices t The correctness of the decryption parameters proof1, proof2, …, proof t The DH Tuple zero-knowledge proof is verified, and the formula PK=Q1+Q2+…+Q t Whether it is established; among them, when the correctness, validity and formula are all established, the verification is passed.
10. The method according to claim 9, characterized in that If the verification is successful, the target participant device decrypts the data received by the first electronic device according to the multiple decryption parameters, including: The target participant device is calculated by the formula R=R1+R2+…+R t =(x1,y1) calculates parameters x1 and y1, and calculates parameter e by formula e=KDF(x1||y1||parameters), where parameters are public parameters and KDF is a key generation function; The target participant device calculates the plaintext data M' to be verified by the formula M'=C2 XORe; wherein C2 is the second part of the ciphertext C={C1||C2||C3} of the data received by the first electronic device; The target participant device calculates parameter C3' according to the formula C3'=Hash(x1||M||y1), and determines whether C3' is equal to C3, wherein C3 is the third part of the ciphertext C={C1||C2||C3} of the data received by the first electronic device; When C3'=C3, the target participant device determines to output plaintext data M'.
11. A data processing device, characterized in that: Applied to a data processing system, the data processing system comprises: a first electronic device and n participant devices, n is an integer greater than 1, the data processing device is a target participant device among the n participant devices, and the data processing device comprises: A determination module, configured to receive public key calculation parameters sent by other n-1 participating devices; wherein the public key calculation parameters are used to calculate the public key of the first electronic device, and the public key of the first electronic device is calculated based on the received n-1 public key calculation parameters and its own 1 public key calculation parameter; the public key calculation parameters include: first commitment information; A verification module, configured to randomly select t first commitment information from the received n-1 first commitment information and its own 1 first commitment information, calculate and obtain the public key to be verified of the first electronic device, and repeat the process multiple times to obtain multiple public keys to be verified; Verifying whether the multiple public keys to be verified are the same; wherein, when the multiple public keys to be verified are the same, the verification is passed, and the determination module determines that the public key of the first electronic device is any one of the multiple public keys to be verified; The processing module is used to output the public key of the first electronic device if the verification by the verification module is successful.
12. The device according to claim 11, characterized in that The determination module is specifically used to: Determine a private key shard, and send the determined private key shard to the other n-1 participant devices; Receiving the private key fragments sent by the other n-1 participating devices; Add the received n-1 private key shards and the 1 private key shard determined by itself to obtain a joint shard; Determine first commitment information according to the joint shard and the base point of the elliptic curve, and send the determined first commitment information to the other n-1 participant devices; The first commitment information sent by the other n-1 participant devices is received, and the other n-1 participant devices calculate the first commitment information in the same manner as the target participant device.
13. The device according to any one of claims 11 or 12, characterized in that The determination module is further used to determine at least two signature parameters; wherein the at least two signature parameters are used to obtain signature information of the first electronic device; The verification module is also used to verify the at least two signature parameters; The processing module is further configured to, if the verification by the verification module passes, calculate signature information of the first electronic device according to the at least two signature parameters.
14. The device according to claim 13, characterized in that The determination module is specifically used to: Calculate parameters M, N, L, R and sign_sk i ; Among them, parameter M is the parameter M provided by t participating devices i The sum of t≤n, M i The i-th participant device among the t participant devices uses the formula M i =ro i *G is calculated, G is the base point of the elliptic curve, ro i is a random number; parameter R is the parameter R provided by t participating devices i The sum, R i The i-th participant device among the t participant devices uses the formula R i =k i *G is calculated, k i is a random number; parameter N is the parameter N provided by t participating devices i sum, N i The i-th participant device among the t participant devices uses the formula N i =ro i *PK is calculated, where PK is the public key of the first electronic device; parameter L is the parameter L provided by t participating devices i The sum of L i =ro i *R; parameter sign_sk i By formula sign_sk i =lambda i *p(ID i )(mod q) is calculated, where ID i Used to represent the ID of the i-th participant device among the t participant devices, the Lagrangian coefficient lambda i It is obtained from the IDs of t participating devices; (mod q) represents the modulo operation, q is the order of G, and G is the base point of the elliptic curve; p(ID i ) is a t-1 degree polynomial; With parameter ro i and parameter 1 / t+sign_sk i (mod q) is used as the input of the first multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter w i After that, the calculated w i Send to other t-1 participating devices among t participating devices; With parameter ro i and k i –r*sign_sk i (mod q) is used as the input of the second multi-party multiplication protocol, and is used together with other t-1 participating devices to perform multi-party multiplication protocol calculations and obtain the output parameter v i After that, the calculated v i Send to other t-1 participant devices among the t participant devices; the r is the first part of the signature sigma=[r,s] of the first electronic device; Receive the parameter w sent by the other t-1 participating devices among the t participating devices i , and the received t-1 parameters w i And a parameter w determined by itself i Calculate the signature parameter Beta; Receive the parameter v sent by the other t-1 participating devices among the t participating devices i , and the received t-1 parameters v i And a parameter v determined by itself i The signature parameter Tao is calculated.
15. The device according to claim 14, characterized in that The verification module is specifically used to: Verify whether the formula Beta*G=M+N and the formula Tao*G=L–r*N are valid; if both formulas are valid, the verification is successful.
16. The device according to claim 15, characterized in that The processing module is specifically used for: Calculate the first part r of the signature sigma=[r,s] of the first electronic device by the formula r=e+x1(mod q), wherein e=Hash(message||Z), message is the message, Z is the public string; (mod q) represents the modulus operation, q is the order of G, and G is the base point of the elliptic curve; Calculate the second part s of the signature sigma=[r,s] of the first electronic device by the formula s=Tao / Beta; A signature sigma=[r, s] of the first electronic device is obtained according to the first part r and the second part s.
17. The device according to any one of claims 11-12, 14-16, characterized in that: The determination module is further used to determine a plurality of decryption parameters; wherein the decryption parameters are used to decrypt the data received by the first electronic device; The verification module is also used to verify the multiple decryption parameters; The processing module is further configured to decrypt the data received by the first electronic device according to the multiple decryption parameters.
18. The device according to claim 17, characterized in that The determination module is specifically used to: Calculation parameter R i , parameter Q i And parameter proof i ; Among them, the parameter R i =decrypt_sk i *C1,decrypt_sk i =lambda i *p(ID i ), ID i Used to represent the ID of the i-th participant device among the t participant devices, the Lagrangian coefficient lambda i Obtained from the IDs of t participating devices; parameter Q i =decrypt_sk_i*G, G is the base point of the elliptic curve; parameter proof_i is the device P of the participant i Calculate G,Q i ,C1,R i DH Tuple zero-knowledge proof; C1 is the first part of the ciphertext C={C1||C2||C3} in the data received by the first electronic device; p(ID i ) is a t-1 degree polynomial; The parameter R i , parameter Q i And parameter proof i Send to other t-1 participants’ devices; Receive the parameter R sent by the other t-1 participating devices i , parameter Q i And parameter proof i , combined with the target participant's parameter R i , parameter Q i And parameter proof i , and obtain the decryption parameters R1, R2, …, R of t participating devices t and the decryption parameters Q1, Q2, …, Q of the t participating devices t as the multiple decryption parameters.
19. The device according to claim 18, characterized in that The verification module is specifically used to: Decryption parameters R1, R2, …, R of all t participants’ devices t and the decryption parameters Q1, Q2, …, Q of the t participating devices t The correctness of the decryption parameters proof1, proof2, …, proof t The validity of the DHTuple zero-knowledge proof is verified, and the formula PK=Q1+Q2+…+Q t Whether it is established; among them, when the correctness, validity and formula are all established, the verification is passed.
20. The device according to claim 19, characterized in that The processing module is specifically used for: By the formula R=R1+R2+…+R t =(x1,y1) calculates parameters x1 and y1, and calculates parameter e by formula e=KDF(x1||y1||parameters), where parameters are public parameters and KDF is a key generation function; The plaintext data M' to be verified is calculated by the formula M'=C2 XORe; wherein C2 is the second part of the ciphertext C={C1||C2||C3} of the data received by the first electronic device; Calculate parameter C3' according to formula C3'=Hash(x1||M||y1), and determine whether C3' is equal to C3, wherein C3 is the third part of the data set ciphertext C={C1||C2||C3} received by the first electronic device; When it is determined that C3'=C3, the plaintext data M' is determined to be output.
21. A data processing system, characterized in that: include: A first electronic device and n participant devices, where n is an integer greater than 1, and the n participant devices include a target participant device, and the target participant device is a data processing device as described in any one of claims 11-20.
