Collaborative signature method, collaborative signature method and device based on SM2 algorithm
Through the synergistic signature method based on the SM2 algorithm, the exchange and joint computing of the signature intermediate value solves the problems of depending on the problem of dedicated hardware and low security of existing digital signatures, and achieve higher security and reduce cost effects.
Patent Information
- Application Number
- CN202211643313.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2042-12-20
AI Technical Summary
The existing digital signature methods rely on dedicated hardware, which is costly and low in security, and cannot effectively ensure the security of mobile user data.
Adopting a synergistic signature method based on the SM2 algorithm, by generating and exchanging the intermediate value of the signature, the communication between the communication between the communication between the two parties to avoid the private key from transmission on the network, improve security, and does not rely on dedicated hardware.
The security of digital signatures has been improved, costs are reduced, and the risk of private keys in the network is avoided, and the problems of dependent hardware and low security have been solved.
Smart Images

Figure CN115811405B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of digital signature technology, and in particular to a collaborative signature method, a collaborative signature method and a device based on an SM2 algorithm. Background Art
[0002] With the rapid development of the national information industry and Internet technology, the important role of information security in daily life and the economic field has gradually emerged. With the continuous development of network attack technology, mobile terminals cannot well guarantee the security of user data. Existing methods such as using security hardware to ensure user data security, providing random number generation, certificate requests, information signatures, etc., but this method requires dedicated hardware and has strong environmental dependence; other methods have low security and pose security risks. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a collaborative signature method, a collaborative signature method and device based on the SM2 algorithm, in which the private key does not need to be transmitted on the network and the signature value requires the intermediate signature values of the communicating parties to be jointly calculated. It has higher security, does not rely on dedicated hardware, reduces costs, and solves the problems of existing methods that rely on dedicated hardware, are high in cost and have low security.
[0004] The embodiment of the present application provides a collaborative signature method, which is applied to a first communication party, and the method includes:
[0005] Generate a first signature value, a first signature intermediate value, and a second signature intermediate value according to the message to be signed, and send the first signature value, the first signature intermediate value, and the second signature intermediate value to the second communication party;
[0006] receiving a third signature intermediate value, a fourth signature intermediate value, and a fifth signature intermediate value returned by the second communication party;
[0007] Generate a second signature value according to the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value;
[0008] A complete signature value is synthesized based on the first signature value and the second signature value and output to a collaborative signature management center.
[0009] In the above implementation process, the user's complete signature private key does not appear during use, and any sensitive information of the key cannot be inferred based on the intermediate result, which greatly improves the security of collaborative signature. The private key does not need to be transmitted on the network, and the signature value requires the intermediate signature value of the communicating parties to jointly calculate it. It has higher security, does not rely on dedicated hardware, reduces costs, and solves the problem that the existing method relies on dedicated hardware, has high cost and low security.
[0010] Further, the generating the first signature value, the first signature intermediate value, and the second signature intermediate value according to the message to be signed includes:
[0011] Performing signature preprocessing on the message to be signed to obtain a first signature value;
[0012] Generate a first random number k1 and use it as a first private key;
[0013] Calculate the first signature intermediate value Q1 and the second signature intermediate value W1 based on the first random number:
[0014] Q1=k1[*]G;
[0015] W1=k1*(D1+1) -1 [*]G;
[0016] Wherein, G represents the base point of order n on the elliptic curve E, D1 represents the first private key and D1∈[1,n-1], and [*] represents the elliptic curve point multiplication operation;
[0017] The first communication party and the second communication party share the elliptic curve parameters E(Fq), G and n of the SM2 algorithm, where the elliptic curve E is an elliptic curve defined on the finite field Fq, and the parameter k is expanded when calculating the signature value based on the SM2 algorithm:
[0018] k=k1 -1 k2(D1+1) -1 +k1 -1 k2(D1+1) -1 (D2+1) -1 +k1 -1 (D2+1) -1 +k2(D2+1) -1 ;
[0019] Among them, k2 represents the second random number generated by the second communication party, (D1+1) represents the inverse element of the private key of the first communication party, and (D2+1) represents the inverse element of the private key of the second communication party.
[0020] In the above implementation process, the parameter k is expanded when the signature value is calculated using the SM2 algorithm, thereby improving security.
[0021] Further, generating a second signature value according to the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value includes:
[0022] The second signature value s is expressed as:
[0023] s=k2*[s1+(D1+1)]+(D1+1)*s2–r mod n;
[0024] Among them, s1 represents the fourth signature intermediate value, s2 represents the fifth signature intermediate value, r represents the third signature intermediate value, and mod represents the modulo operation.
[0025] In the above implementation process, the method adopts the key splitting technology, divides the traditional key into two parts and stores them separately, and can send the signature intermediate value to the first communication party, so that the communication party obtains another part of the signature value based on the signature intermediate value, thereby improving security.
[0026] Further, synthesizing a complete signature value based on the first signature value and the second signature value includes:
[0027] If the second signature value is not equal to 0, and the second signature value is not equal to nr, a complete signature value (r, s) is synthesized based on the first signature value and the second signature value.
[0028] In the above implementation process, a complete signature value can be obtained according to the first signature value and the second signature value, thereby avoiding the transmission of the private key on the network and improving security.
[0029] Furthermore, the method further comprises calculating a public key:
[0030] Receive the public key intermediate value P1 sent by the second communication party, where the public key intermediate value is expressed as:
[0031] P1=(D2+1) -1 [*]G;
[0032] Wherein, D2 represents the second private key generated for the second communication party, and D2∈[1,n-1];
[0033] Calculate the public key P based on the public key intermediate value P1:
[0034] P=(D1+1)[*]P1[-]G;
[0035] Where [-] represents the elliptic curve point subtraction operation.
[0036] In the above implementation process, the public key can be calculated according to the intermediate value of the public key sent by the second communication party, which has high security.
[0037] The embodiment of the present application also provides a collaborative signature method based on the SM2 algorithm, which is applied to the second communication party, and the method includes:
[0038] Generate a second random number and use it as a second private key;
[0039] Calculate a sixth signature intermediate value based on the second random number;
[0040] Receiving a first signature value, a first signature intermediate value, and a second signature intermediate value sent by a first communication party;
[0041] A third signature intermediate value, a fourth signature intermediate value and a fifth signature intermediate value are calculated based on the second random number, the sixth signature intermediate value, the first signature value, the first signature intermediate value and the second signature intermediate value, and the calculation results are sent to the first communication party.
[0042] In the above implementation process, the private keys of the communicating parties are stored separately, and the intermediate signature value is sent to the other communicating party to avoid direct sending of the private key. The real signature value is calculated by the joint signature values of the communicating parties, which is more secure and more difficult to crack. In addition, this method does not require dedicated hardware equipment, which reduces the cost of use.
[0043] The calculating a third signature intermediate value, a fourth signature intermediate value, and a fifth signature intermediate value based on the second random number, the sixth signature intermediate value, the first signature value, the first signature intermediate value, and the second signature intermediate value comprises:
[0044] Based on the first signature intermediate value Q1, the second signature intermediate value W1 and the sixth signature intermediate value Q2, the horizontal coordinate x1 and the vertical coordinate y1 on the elliptic curve are calculated:
[0045] (x1,y1)=k1[*]W1[+]k1[*]W1[*](D2+1)[+](Q1[+]Q2)[*](D2+1);
[0046] The third signature intermediate value r is calculated using the horizontal and vertical coordinates on the elliptic curve:
[0047] r = (x1 + e) mod n;
[0048] Wherein, e represents the first signature value, and [+] represents the elliptic curve point addition operation;
[0049] If the third signature intermediate value r is not equal to 0, the fourth signature intermediate value s1 and the fifth signature intermediate value s2 are respectively expressed as:
[0050] s1=[k1*(D2+1)+k1]mod n;
[0051] s2=[r*(D2+1)+k1]mod n.
[0052] In the above implementation process, the intermediate signature value of the signature itself can be calculated based on the private key and the intermediate signature value sent by the first communication party, thereby avoiding the transmission of the private keys of both parties on the network and having higher security.
[0053] The embodiment of the present application also provides a collaborative signature device, the device comprising:
[0054] A first signature intermediate value generating module, configured to generate a first signature value, a first signature intermediate value, and a second signature intermediate value according to the message to be signed, and send the first signature value, the first signature intermediate value, and the second signature intermediate value to the second communication party;
[0055] A signature value receiving module, used to receive the third signature intermediate value R, the fourth signature intermediate value and the fifth signature intermediate value returned by the second communication party;
[0056] A second signature value generating module, used to generate a second signature value according to the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value;
[0057] A signature value synthesis module is used to synthesize a complete signature value based on the first signature value and the second signature value and output it to a collaborative signature management center.
[0058] In the above implementation process, the user's complete signature private key does not appear during use, and any sensitive information of the key cannot be inferred based on the intermediate result, which greatly improves the security of collaborative signature. The private key does not need to be transmitted on the network, and the signature value requires the intermediate signature value of the communicating parties to jointly calculate it. It has higher security, does not rely on dedicated hardware, reduces costs, and solves the problem that the existing method relies on dedicated hardware, has high cost and low security.
[0059] The embodiment of the present application also provides a collaborative signature device based on the SM2 algorithm, the device comprising:
[0060] A second random number generating module, used to generate a second random number;
[0061] A second signature intermediate value generating module, used to calculate a sixth signature intermediate value based on the second random number;
[0062] A signature intermediate value receiving module, used to receive a first signature value, a first signature intermediate value, and a second signature intermediate value sent by a first communication party;
[0063] A signature intermediate value calculation module is used to calculate a third signature intermediate value, a fourth signature intermediate value and a fifth signature intermediate value based on the second random number, the sixth signature intermediate value, the first signature value, the first signature intermediate value and the second signature intermediate value, and send the calculation results to the first communication party.
[0064] In the above implementation process, the private keys of the communicating parties are stored separately, and the intermediate signature value is sent to the other communicating party to avoid direct sending of the private key. The real signature value is calculated by the joint signature values of the communicating parties, which is more secure and more difficult to crack. In addition, this method does not require dedicated hardware equipment, which reduces the cost of use.
[0065] An embodiment of the present application further provides a readable storage medium, wherein the readable storage medium stores computer program instructions. When the computer program instructions are read and executed by a processor, any of the above-mentioned collaborative signature methods is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0067] Figure 1 A flowchart of a collaborative signature method provided in an embodiment of the present application;
[0068] Figure 2 A specific implementation flow chart of the collaborative signature provided in the embodiment of the present application;
[0069] Figure 3 A specific calculation flow chart of the first signature value, the first signature intermediate value, and the second signature intermediate value provided in the embodiment of the present application;
[0070] Figure 4 A flowchart of the communication parties providing an embodiment of the present application calculating and generating their own private keys and public keys;
[0071] Figure 5 A flowchart of a collaborative signature method based on the SM2 algorithm provided in an embodiment of the present application;
[0072] Figure 6 A specific flow chart for generating a signature provided in an embodiment of the present application;
[0073] Figure 7 A specific calculation flow chart of the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value provided in the embodiment of the present application;
[0074] Figure 8 A structural block diagram of a collaborative signature device provided in an embodiment of the present application;
[0075] Fig. 9 This is a structural block diagram of a collaborative signature device based on the SM2 algorithm provided in an embodiment of the present application.
[0076] icon:
[0077] 100-first signature intermediate value generation module; 200-signature value receiving module; 300-second signature value generation module; 400-signature value synthesis module; 500-second random number generation module; 600-second signature intermediate value generation module; 700-signature intermediate value receiving module; 800-signature intermediate value calculation module. DETAILED DESCRIPTION
[0078] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0079] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0080] Example 1
[0081] Please see Figure 1 , Figure 1 A flowchart of a collaborative signature method provided for an embodiment of the present application. This method is a new collaborative signature method based on the SM2 algorithm, which greatly improves the security of mobile terminal data and the scalability of the collaborative signature algorithm, and does not rely on dedicated hardware, so it is more applicable. In addition, this method improves the confidentiality, integrity, and effectiveness of data transmitted by the mobile terminal, eliminates the potential security risks of key storage, and greatly improves the data security and key security of the mobile terminal.
[0082] At the first communication party, such as the collaborative signing client, the method specifically includes the following steps:
[0083] Step S100: Generate a first signature value e, a first signature intermediate value Q1, and a second signature intermediate value W1 according to the message to be signed, and send the first signature value, the first signature intermediate value, and the second signature intermediate value to the second communication party;
[0084] Step S200: receiving the third signature intermediate value R, the fourth signature intermediate value S1 and the fifth signature intermediate value S2 returned by the second communication party;
[0085] Step S300: Generate a second signature value according to the third signature intermediate value R, the fourth signature intermediate value S1 and the fifth signature intermediate value S2;
[0086] The second signature value s is expressed as:
[0087] s=k2*[s1+(D1+1)]+(D1+1)*s2–r mod n;
[0088] Among them, s1 represents the fourth signature intermediate value, s2 represents the fifth signature intermediate value, r represents the third signature intermediate value, and mod represents the modulo operation.
[0089] Step S400: synthesize a complete signature value based on the first signature value and the second signature value and output it to the collaborative signature management center.
[0090] If the second signature value is not equal to 0, and the second signature value is not equal to nr, a complete signature value (r, s) is synthesized based on the first signature value and the second signature value.
[0091] The collaborative signature security management center records the signature results for easy query and use by external systems.
[0092] like Figure 2 The following is a flowchart of the specific implementation of collaborative signature. Specifically:
[0093] The collaborative signature client (the first communication party, i.e., communication party 1 in the figure) and the collaborative signature server (the second communication party) generate a private key;
[0094] The key storage module uses the password (PIN) entered when logging in to the mobile terminal as the key, and uses the symmetric encryption algorithm SM4 to encrypt and protect the key components of both parties in the communication;
[0095] Communication party 1 generates a signature value e through the message to be signed M, and generates partial signature intermediate values w1 and q1. The values of e, w1, and q1 are sent to communication party 2;
[0096] The second communication party generates signature intermediate values r, s1, s2 based on the above values;
[0097] The first communication party generates a signature value s based on the above values (r, s1, s2, etc.);
[0098] The communication party 1 combines the above values into a completed value (r, s) and outputs it;
[0099] The collaborative signature security management center records the signature results for easy query and use by external systems.
[0100] Specifically, Figure 3 As shown in FIG. 1 , it is a specific calculation flow chart of the first signature value, the first signature intermediate value, and the second signature intermediate value. The implementation process of step S100 may specifically include the following steps:
[0101] Step S101: performing signature preprocessing on the message to be signed to obtain a first signature value;
[0102] Step S102: Generate a first random number k1 and use it as a first private key;
[0103] Step S103: Calculate a first signature intermediate value Q1 and a second signature intermediate value W1 based on the first random number:
[0104] Q1=k1[*]G;
[0105] W1=k1*(D1+1) -1 [*]G;
[0106] Wherein, G represents the base point of order n on the elliptic curve E, D1 represents the first private key and D1∈[1,n-1], and [*] represents the elliptic curve point multiplication operation;
[0107] The first communication party and the second communication party share the elliptic curve parameters E(Fq), G and n of the SM2 algorithm, where the elliptic curve E is an elliptic curve defined on the finite field Fq. The specific values of each parameter are pre-set according to the SM2 algorithm, and the parameter k is expanded when calculating the signature value based on the SM2 algorithm:
[0108] k=k1 -1 k2(D1+1) -1 +k1 -1 k2(D1+1) -1 (D2+1) -1 +k1 -1 (D2+1) -1 +k2(D2+1) -1 ;
[0109] Among them, k2 represents the second random number generated by the second communication party, (D1+1) represents the inverse element of the private key of the first communication party, and (D2+1) represents the inverse element of the private key of the second communication party.
[0110] Unlike traditional private key algorithms or basic SM2 algorithms, the k value is expanded during calculation to improve security.
[0111] The method further comprises:
[0112] The first private key is encrypted using the symmetric algorithm SM4 and saved in the key storage module.
[0113] The key storage module uses the password (PIN) entered when logging into the mobile terminal as the key, and uses the symmetric encryption algorithm SM4 to encrypt and protect the key components of both communicating parties.
[0114] The private key is encrypted and stored using the symmetric algorithm SM4, reducing the risk of key leakage.
[0115] The method also includes calculating a public key, such as Figure 4 As shown in FIG. 1 , it is a flowchart for calculating and generating the private key and public key of each communicating party, specifically:
[0116] Step S111: receiving the public key intermediate value P1 sent by the second communication party, wherein the public key intermediate value is expressed as:
[0117] P1=(D2+1) -1 [*]G;
[0118] Wherein, D2 represents the second private key generated for the second communication party, and D2∈[1,n-1];
[0119] Step S112: Calculate the public key P based on the public key intermediate value P1:
[0120] P=(D1+1)[*]P1[-]G;
[0121] Where [-] represents the elliptic curve point subtraction operation.
[0122] In terms of scalability, this method is provided to the outside in the form of SDK (software development kit), which has strong scalability and reduces system coupling. In terms of security, the user's complete signature private key does not appear at any time during use, and it is impossible to infer any sensitive information of the key based on the intermediate results, which greatly improves the security of collaborative signatures.
[0123] The present application also provides a collaborative signature method based on the SM2 algorithm. Figure 5 FIG. 1 is a flowchart of a collaborative signature method based on the SM2 algorithm, which is applied to a second communication party. The method includes:
[0124] Step S500: Generate a second random number and use it as a second private key;
[0125] Step S600: Calculate a sixth signature intermediate value Q2 based on the second random number;
[0126] Step S700: receiving a first signature value e, a first signature intermediate value Q1, and a second signature intermediate value W1 sent by a first communication party;
[0127] Step S800: Calculate the third signature intermediate value R, the fourth signature intermediate value S1 and the fifth signature intermediate value S2 based on the second random number, the sixth signature intermediate value Q2, the first signature value e, the first signature intermediate value Q1 and the second signature intermediate value W1, and send the calculation results to the first communication party.
[0128] like Figure 6 As shown in FIG. 1 , it is a specific flow chart for generating a signature, where Figure 7 As shown in FIG. 1 , it is a specific calculation flow chart of the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value. The implementation process of step S800 specifically includes the following steps:
[0129] Step S801: Based on the first signature intermediate value Q1, the second signature intermediate value W1 and the sixth signature intermediate value Q2, the horizontal coordinate x1 and the vertical coordinate y1 on the elliptic curve are calculated:
[0130] (x1,y1)=k1[*]W1[+]k1[*]W1[*](D2+1)[+](Q1[+]Q2)[*](D2+1);
[0131] Step S802: Calculate the third signature intermediate value r using the horizontal coordinate and vertical coordinate (x1, y1) on the elliptic curve:
[0132] r = (x1 + e) mod n;
[0133] Wherein, e represents the first signature value, and [+] represents the elliptic curve point addition operation;
[0134] Step S803: If the third signature intermediate value r is not equal to 0, the fourth signature intermediate value s1 and the fifth signature intermediate value s2 can be calculated and expressed as:
[0135] s1=[k1*(D2+1)+k1]mod n;
[0136] s2=[r*(D2+1)+k1]mod n.
[0137] The collaborative signature algorithm is an extension of the SM2 signature algorithm formula, specifically the k value is extended;
[0138] Key splitting is to divide the complete key in traditional applications into the collaborative signature client part signature private key and the collaborative signature server part signature private key and generate and store them independently;
[0139] Distributed collaborative signature is that the collaborative signature client uses the client's partial signature private key to complete the client's digital signature, and the collaborative signature server uses the server's partial signature private key to complete the server's digital signature. The collaborative signature client calculates a compliant digital signature based on the digital signatures of both ends; the key splitting technology is used to divide the traditional key into two parts and store them separately, which improves security.
[0140] This method is a collaborative signature algorithm technology based on the national secret algorithm (SM2), which complies with relevant national secret requirements; the private key does not need to be transmitted on the network, and the communicating parties each generate their own private key to complete the digital signature; the true signature value is calculated by the joint signature value of the communicating parties, which is more secure and more difficult to crack; the collaborative signature system does not require dedicated hardware equipment, reduces the cost of use, and can be quickly deployed and integrated into the user's existing system.
[0141] Example 2
[0142] The embodiment of the present application provides a collaborative signature device, which is applied to a first communication party, such as Figure 8 FIG. 1 is a block diagram of a collaborative signature device, which includes but is not limited to:
[0143] A first signature intermediate value generating module 100 is used to generate a first signature value e, a first signature intermediate value Q1 and a second signature intermediate value W1 according to the message to be signed, and send the first signature value, the first signature intermediate value and the second signature intermediate value to the second communication party;
[0144] The signature value receiving module 200 is used to receive the third signature intermediate value R, the fourth signature intermediate value S1 and the fifth signature intermediate value S2 returned by the second communication party;
[0145] A second signature value generating module 300, configured to generate a second signature value according to the third signature intermediate value R, the fourth signature intermediate value S1 and the fifth signature intermediate value S2;
[0146] The signature value synthesis module 400 is used to synthesize a complete signature value based on the first signature value and the second signature value and output it to the collaborative signature management center.
[0147] The present application also provides a collaborative signature device based on the SM2 algorithm. Fig. 9 As shown, it is a structural block diagram of a collaborative signature device based on the SM2 algorithm, and the device includes but is not limited to:
[0148] A second random number generating module 500, used to generate a second random number;
[0149] A second signature intermediate value generating module 600, configured to calculate a sixth signature intermediate value Q2 based on the second random number;
[0150] The signature intermediate value receiving module 700 is used to receive the first signature value e, the first signature intermediate value Q1 and the second signature intermediate value W1 sent by the first communication party;
[0151] The signature intermediate value calculation module 800 is used to calculate the third signature intermediate value R, the fourth signature intermediate value S1 and the fifth signature intermediate value S2 based on the second random number, the sixth signature intermediate value Q2, the first signature value e, the first signature intermediate value Q1 and the second signature intermediate value W1, and send the calculation results to the first communication party.
[0152] The specific process has been described in detail in Example 1 and will not be repeated here.
[0153] An embodiment of the present application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the collaborative signature method described in Example 1.
[0154] An embodiment of the present application also provides a readable storage medium, characterized in that computer program instructions are stored in the readable storage medium, and when the computer program instructions are read and executed by a processor, the collaborative signature method described in Example 1 is executed.
[0155] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0156] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0157] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0158] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0159] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0160] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A collaborative signature method, characterized in that: Applied to a first communication party, the method comprises: Generate a first signature value, a first signature intermediate value, and a second signature intermediate value according to the message to be signed, and send the first signature value, the first signature intermediate value, and the second signature intermediate value to the second communication party; receiving a third signature intermediate value, a fourth signature intermediate value, and a fifth signature intermediate value returned by the second communication party; Generate a second signature value according to the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value; Synthesize a complete signature value based on the first signature value and the second signature value and output it to a collaborative signature management center; The step of generating a first signature value, a first signature intermediate value, and a second signature intermediate value according to the message to be signed includes: Performing signature preprocessing on the message to be signed to obtain a first signature value; Generate a first random number k1 and use it as a first private key; Calculate the first signature intermediate value Q1 and the second signature intermediate value W1 based on the first random number: Q1=k1[*]G; W1=k1*(D1+1) -1 [*]G; Wherein, G represents the base point of order n on the elliptic curve E, D1 represents the first private key and D1∈[1,n-1], and [*] represents the elliptic curve point multiplication operation; The first communication party and the second communication party share the elliptic curve parameters E(Fq), G and n of the SM2 algorithm, where the elliptic curve E is an elliptic curve defined on the finite field Fq, and the parameter k is expanded when calculating the signature value based on the SM2 algorithm: <h2 style=";text-align:left;direction:ltr">k=k1<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> k2(D1+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> +k1<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> k2(D1+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (D2+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> +k1<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (D2+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> +k2(D2+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> ; Wherein, k2 represents a second random number generated by the second communication party, (D1+1) represents the inverse element of the private key of the first communication party, and (D2+1) represents the inverse element of the private key of the second communication party; The generating a second signature value according to the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value comprises: The second signature value s is expressed as: s=k2*[s1+(D1+1)]+(D1+1)*s2–r mod n; Wherein, s1 represents the fourth signature intermediate value, s2 represents the fifth signature intermediate value, r represents the third signature intermediate value, and mod represents the modulus operation; The synthesizing a complete signature value based on the first signature value and the second signature value includes: If the second signature value is not equal to 0 and the second signature value is not equal to nr, a complete signature value (r, s) is synthesized based on the first signature value and the second signature value.
2. The collaborative signature method according to claim 1, characterized in that: The method further comprises calculating a public key: Receive the public key intermediate value P1 sent by the second communication party, where the public key intermediate value is expressed as: P1=(D2+1) -1 [*]G; Wherein, D2 represents the second private key generated for the second communication party, and D2∈[1,n-1]; Calculate the public key P based on the public key intermediate value P1: P=(D1+1)[*]P1[-]G; Where [-] represents the elliptic curve point subtraction operation.
3. A collaborative signature method based on the SM2 algorithm, characterized in that: Applied to the second communication party, the method comprises: Generate a second random number and use it as a second private key; Calculate a sixth signature intermediate value based on the second random number; Receiving a first signature value, a first signature intermediate value, and a second signature intermediate value sent by a first communication party in the collaborative signature method according to claim 1; Calculate a third signature intermediate value, a fourth signature intermediate value, and a fifth signature intermediate value based on the second random number, the sixth signature intermediate value, the first signature value, the first signature intermediate value, and the second signature intermediate value, and send the calculation results to the first communication party; The calculating a third signature intermediate value, a fourth signature intermediate value, and a fifth signature intermediate value based on the second random number, the sixth signature intermediate value, the first signature value, the first signature intermediate value, and the second signature intermediate value comprises: Based on the first signature intermediate value Q1, the second signature intermediate value W1 and the sixth signature intermediate value Q2, the horizontal coordinate x1 and the vertical coordinate y1 on the elliptic curve are calculated: (x1, y1) = k1 [*] W1 [+] k1 [*] W1 [*] (D2+1) [+] (Q1 [+] Q2) [*] (D2+1); The third signature intermediate value r is calculated using the horizontal and vertical coordinates on the elliptic curve: r = (x1 + e) mod n; Wherein, e represents the first signature value, and [+] represents the elliptic curve point addition operation; If the third signature intermediate value r is not equal to 0, the fourth signature intermediate value s1 and the fifth signature intermediate value s2 are respectively expressed as: s1 = [k1 * (D2+1) + k1 ] mod n; s2 = [ r * (D2+1) + k1 ] mod n.
4. A collaborative signature device, characterized in that: The device comprises: A first signature intermediate value generating module, configured to generate a first signature value, a first signature intermediate value, and a second signature intermediate value according to the message to be signed, and send the first signature value, the first signature intermediate value, and the second signature intermediate value to the second communication party; A signature value receiving module, used to receive the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value returned by the second communication party; A second signature value generating module, used to generate a second signature value according to the third signature intermediate value, the fourth signature intermediate value and the fifth signature intermediate value; A signature value synthesis module, used to synthesize a complete signature value based on the first signature value and the second signature value and output the complete signature value to a collaborative signature management center; Wherein, the first signature intermediate value generation module is specifically used for: Performing signature preprocessing on the message to be signed to obtain a first signature value; Generate a first random number k1 and use it as a first private key; Calculate the first signature intermediate value Q1 and the second signature intermediate value W1 based on the first random number: Q1=k1[*]G; W1=k1*(D1+1) -1 [*]G; Wherein, G represents the base point of order n on the elliptic curve E, D1 represents the first private key and D1∈[1,n-1], and [*] represents the elliptic curve point multiplication operation; The first communication party and the second communication party share the elliptic curve parameters E(Fq), G and n of the SM2 algorithm, where the elliptic curve E is an elliptic curve defined on the finite field Fq, and the parameter k is expanded when calculating the signature value based on the SM2 algorithm: <h2 style=";text-align:left;direction:ltr">k=k1<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> k2(D1+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> +k1<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> k2(D1+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (D2+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> +k1<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (D2+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> +k2(D2+1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> ; Wherein, k2 represents a second random number generated by the second communication party, (D1+1) represents the inverse element of the private key of the first communication party, and (D2+1) represents the inverse element of the private key of the second communication party; The second signature value generating module is specifically used for: The second signature value s is expressed as: s=k2*[s1+(D1+1)]+(D1+1)*s2–r mod n; Wherein, s1 represents the fourth signature intermediate value, s2 represents the fifth signature intermediate value, r represents the third signature intermediate value, and mod represents the modulus operation; The signature value synthesis module is specifically used for: If the second signature value is not equal to 0 and the second signature value is not equal to nr, a complete signature value (r, s) is synthesized based on the first signature value and the second signature value.
5. A collaborative signature device based on the SM2 algorithm, characterized in that: The device comprises: A second random number generating module, used to generate a second random number; A second signature intermediate value generating module, used to calculate a sixth signature intermediate value based on the second random number; A signature intermediate value receiving module, used to receive the first signature value, the first signature intermediate value and the second signature intermediate value sent by the first communication party in the collaborative signature method according to claim 1; a signature intermediate value calculation module, configured to calculate a third signature intermediate value, a fourth signature intermediate value, and a fifth signature intermediate value based on the second random number, the sixth signature intermediate value, the first signature value, the first signature intermediate value, and the second signature intermediate value, and send the calculation results to the first communication party; The signature intermediate value calculation module is specifically used for: Based on the first signature intermediate value Q1, the second signature intermediate value W1 and the sixth signature intermediate value Q2, the horizontal coordinate x1 and the vertical coordinate y1 on the elliptic curve are calculated: (x1, y1) = k1 [*] W1 [+] k1 [*] W1 [*] (D2+1) [+] (Q1 [+] Q2) [*] (D2+1); The third signature intermediate value r is calculated using the horizontal and vertical coordinates on the elliptic curve: r = (x1 + e) mod n; Wherein, e represents the first signature value, and [+] represents the elliptic curve point addition operation; If the third signature intermediate value r is not equal to 0, the fourth signature intermediate value s1 and the fifth signature intermediate value s2 are respectively expressed as: s1 = [k1 * (D2+1) + k1 ] mod n; s2 = [ r * (D2+1) + k1 ] mod n.
6. A readable storage medium, characterized in that: The readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the collaborative signature method according to any one of claims 1 to 2 is executed.
Citation Information
Patent Citations
Collaborative signature and decryption method, apparatus and system of SM2 algorithm
CN107196763A
Verification method and system for network interface information
CN114254391A