CN112822026A - Digital signature method, device and system - Google Patents
Digital signature method, device and system Download PDFInfo
- Publication number
- CN112822026A CN112822026A CN202110437436.7A CN202110437436A CN112822026A CN 112822026 A CN112822026 A CN 112822026A CN 202110437436 A CN202110437436 A CN 202110437436A CN 112822026 A CN112822026 A CN 112822026A
- Authority
- CN
- China
- Prior art keywords
- signature
- parameter
- random number
- algorithm
- private key
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3247—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
Abstract
The embodiment of the application provides a digital signature method, a digital signature device and a digital signature system. Acquiring a private key generated by encrypting based on a first random number, a second random number and a third random number, and a first signature parameter generated by encrypting based on a fourth random number and a fifth random number; converting the private key and the first signature parameters into standard parameters matched with a signature algorithm; and based on the signature algorithm, performing digital signature on the data to be signed by using the standard parameters. The technical scheme provided by the embodiment of the application reduces the memory occupation on the basis of ensuring the security of the digital signature.
Description
Technical Field
The embodiment of the application relates to the technical field of computer application, in particular to a digital signature method, device and system.
Background
The digital signature is a security guarantee technology which appears along with the development of an information network technology, and can verify whether data changes in the transmission process and ensure the integrity, authenticity and non-repudiation of the transmitted data.
Taking SM2 (elliptic curve public key cryptography) signature algorithm as an example, the digital signature is obtained by encrypting data to be signed by a private key, wherein the private key used for signature can be generally implemented as a random number. At this time, an attacker may steal the private key of the signature by a certain technical means, thereby forging the signature of the false data and affecting the security of data transmission.
In order to improve the security of data transmission, a lookup table is usually used in the conventional scheme to confuse the signed private key, so that an attacker cannot obtain the correct private key. However, the lookup table occupies a relatively large memory, which is not favorable for practical use. Therefore, how to realize on the basis of guaranteeing the data transmission security, reduce the digital signature that occupies memory is used for the problem that awaits solution.
Disclosure of Invention
The embodiment of the application provides a digital signature method, a digital signature device and a digital signature system, which are used for reducing the memory occupation on the basis of ensuring the security of digital signatures.
In a first aspect, an embodiment of the present application provides a digital signature method, including:
acquiring a private key generated by encryption based on the first random number, the second random number and the third random number, and a first signature parameter generated by encryption based on the fourth random number and the fifth random number;
converting the private key and the first signature parameters into standard parameters matched with a signature algorithm;
and based on the signature algorithm, performing digital signature on the data to be signed by using the standard parameters.
In a second aspect, an embodiment of the present application provides a digital signature apparatus, including:
the acquisition module is used for acquiring a private key generated by encryption based on the first random number, the second random number and the third random number and a first signature parameter generated by encryption based on the fourth random number and the fifth random number;
the conversion module is used for converting the private key and the first signature parameter into a standard parameter matched with a signature algorithm;
and the signature module is used for carrying out digital signature on the data to be signed by utilizing the standard parameters based on the signature algorithm.
In a third aspect, an embodiment of the present application provides a digital signature system, including a storage component and a processing component;
the storage component stores one or more computer instructions; the one or more computer instructions for execution invoked by the processing component;
the processing component is to:
acquiring a private key generated by encryption based on the first random number, the second random number and the third random number, and a first signature parameter generated by encryption based on the fourth random number and the fifth random number;
converting the private key and the first signature parameters into standard parameters matched with a signature algorithm;
and based on the signature algorithm, performing digital signature on the data to be signed by using the standard parameters.
According to the scheme, the private key and the first signature parameter generated based on random number encryption are obtained, the private key and the first signature parameter are converted into the standard parameter matched with the signature algorithm, then digital signature is carried out based on the signature algorithm by using the standard parameter, the private key and the first signature parameter used for signature are encrypted, the situation that the private key and the first signature parameter directly appear in the digital signature process in the form of random numbers is avoided, an attacker cannot obtain the real private key, and the safety of the digital signature is improved. In addition, a lookup table is not introduced in the scheme, so that the occupation of the memory is reduced, and the digital signature of the memory is reduced on the basis of ensuring the data transmission safety.
These and other aspects of the present application will be more readily apparent from the following description of the embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart illustrating one embodiment of a digital signature method provided herein;
FIG. 2 is a schematic diagram illustrating an embodiment of a digital signature apparatus provided in the present application;
fig. 3 is a schematic structural diagram illustrating an embodiment of a digital signature system provided in the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
In some of the flows described in the specification and claims of this application and in the above-described figures, a number of operations are included that occur in a particular order, but it should be clearly understood that these operations may be performed out of order or in parallel as they occur herein, the number of operations, e.g., 101, 102, etc., merely being used to distinguish between various operations, and the number itself does not represent any order of performance. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
The technical scheme of the application is applied to a digital signature scene, and the digital signature can verify whether the data changes in the transmission process, so that the integrity, authenticity and non-repudiation of the transmitted data are ensured.
Taking SM2 (elliptic curve public key cryptography) signature algorithm as an example, the digital signature is obtained by encrypting data to be signed by a private key, wherein the private key used for signature can be generally implemented as a random number. At this time, an attacker may steal the private key of the signature by a certain technical means, thereby forging the signature of the false data and affecting the security of data transmission.
In the conventional scheme, in order to improve the security of the digital signature, a lookup table is usually used to confuse the private key of the signature, so that an attacker cannot obtain the correct private key. However, the lookup table has a large scale, occupies a large memory, and is not beneficial to practical use. Therefore, in order to reduce the occupation of the memory on the basis of ensuring the security of the digital signature, the inventor provides the technical scheme of the application through a series of researches, namely, a private key generated by encrypting based on the first random number, the second random number and the third random number is obtained; and a first signature parameter generated by encrypting based on the fourth random number and the fifth random number; converting the private key and the first signature parameters into standard parameters matched with a signature algorithm; and based on the signature algorithm, performing digital signature on the data to be signed by using the standard parameters.
By encrypting the private key and the first signature parameter used for signature, the private key and the first signature parameter are prevented from directly appearing in the digital signature process in the form of random numbers, an attacker cannot obtain the real private key, and the security of the digital signature is improved. In addition, a lookup table is not introduced in the scheme, so that the occupation of the memory is reduced, and the digital signature of the memory is reduced on the basis of ensuring the data transmission safety.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As shown in fig. 1, a flowchart of an embodiment of a digital signature method provided in the embodiment of the present application may include the following steps:
101: and acquiring a private key generated by encryption based on the first random number, the second random number and the third random number, and a first signature parameter generated by encryption based on the fourth random number and the fifth random number.
In this embodiment, a private key, signature parameters, and the like for signature are generated in advance before the digital signature is performed. The process of generating the private key and the signature parameter in advance may be an initialization process, which is performed before the signature process and does not occur in the signature process.
Specifically, the initialization process may be implemented by generating a first random number between (0, n), which may be denoted by c1, and generating a second random number between (0, n), which may be denoted by m1, and generating a third random number between (0, n), which may be denoted by r1, and generating a fourth random number between (0, n), which may be denoted by f1, and generating a fifth random number between (0, n), which may be denoted by m 2.
A private key may be cryptographically generated based on the first random number, the second random number, and the third random number, and a first signature parameter may be cryptographically generated based on the fourth random number and the fifth random number. The private key and the first signature parameter can be output by an initialization process and used for signature, and the random number and the encryption process cannot occur in the signature process, so that the security is high.
Therefore, the private key and the first signature parameter generated by the initialization process described above can be acquired. The private key and the first signature parameter are generated by pre-encryption, and the random number used for encryption and the encryption process have higher security, so the private key used for signature and the first signature parameter also have higher security. Therefore, the problem that the private key is directly realized as the random number in the traditional scheme, which causes the stealing of an attacker can be solved, and the safety of the private key and the digital signature is improved.
102: the private key and the first signature parameters are converted into standard parameters matching the signature algorithm.
In this embodiment, the signature algorithm may be implemented as an SM2 algorithm (elliptic curve public key signature algorithm). Since in the SM2 algorithm, the private key and the signature parameters used for signature are directly implemented as random numbers, and the private key and the first signature parameters obtained in the above initialization process are the private key and the signature parameters obtained by encrypting the random numbers. Therefore, when signing with the private key and the first signature parameter, the private key and the first signature parameter need to be converted into standard parameters matching the signature algorithm in order to match them with the signature algorithm.
103: and based on a signature algorithm, performing digital signature on the data to be signed by using the standard parameters.
After the standard parameters are obtained, the data to be signed can be digitally signed by using the standard parameters based on the signature algorithm. Taking the example that the signature algorithm is the SM2 algorithm, the data to be signed can be digitally signed using standard parameters based on the SM2 algorithm.
In the embodiment, the private key and the first signature parameter generated based on random number encryption are obtained, the private key and the first signature parameter are converted into the standard parameter matched with the signature algorithm, digital signature is performed by using the standard parameter based on the signature algorithm, and the private key and the first signature parameter used for signature are encrypted, so that the situation that the private key and the first signature parameter directly appear in the digital signature process in the form of random numbers is avoided, an attacker cannot obtain the real private key, and the safety of the digital signature is improved. In addition, a lookup table is not introduced in the scheme, so that the occupation of the memory is reduced, and the digital signature of the memory is reduced on the basis of ensuring the data transmission safety.
In practical applications, taking the signature algorithm as an example of the SM2 algorithm, the SM2 algorithm may include elliptic curve parameters e (fq), G, and n. Where E may represent an elliptic curve over a finite field Fq, G may represent a base point of an order n on the elliptic curve E, n is a positive integer, and G and n belong to parameters of the elliptic curve. In some embodiments, before performing the digital signature based on the signature algorithm, the method may further include:
and acquiring a second signature parameter generated based on the fourth random number and the elliptic curve parameter.
During initialization, the second signature parameter may be generated from the fourth random number and the elliptic curve parameter according to the second signature parameter as shown below.
The second signature parameter generation formula may be: p = [ f1 ] G.
Where P denotes a second signature parameter, f1 denotes a fourth random number, and G denotes an elliptic curve parameter.
After the initialization process generates the second signature parameters, the second signature parameters may be output. Wherein the second signature parameter may be used for signing.
Optionally, the data to be signed may be digitally signed by using the second signature parameter and the sixth random number, so as to obtain the first signature. Wherein the first signature may be a partial signature and the first signature may also be used to generate a second signature.
The method of converting the private key and the first signature parameters into standard parameters matching the signature algorithm may comprise:
and converting the private key and the first signature parameter by using the first signature to obtain a standard parameter matched with the signature algorithm.
Optionally, based on the signature algorithm, the method for digitally signing the data to be signed by using the standard parameter may include:
based on a signature algorithm, performing digital signature by using standard parameters to obtain a second signature; the signature is composed of the first signature and the second signature.
In practical applications, the signature algorithm is implemented as the SM2 algorithm, and the complete signature of the SM2 algorithm may be composed of two parts, which may be referred to as a first signature and a second signature, respectively. After the private key, the first signature parameter and the second signature parameter are obtained, the first signature can be preferentially obtained by the second signature parameter. Specifically, a sixth random number may be generated which is located between (0, n), and may be represented by r 2. Wherein n represents a positive integer.
Then, the method for digitally signing the data to be signed by using the second signature parameter and the sixth random number to obtain the first signature may be:
the third signature parameter is generated based on the second signature parameter and the sixth random number according to a third signature parameter generation formula shown below.
The third signature parameter generation formula may be: q1= [ r2 ] P = (Qx, Qy).
Where Q1 denotes a third signature parameter, r2 denotes a sixth random number, P denotes a second signature parameter, Qx denotes the abscissa of Q1, and Qy denotes the ordinate of Q1.
After the third signature parameter is obtained, optionally, the data to be signed may be digitally signed by using the third signature parameter according to a first signature generation formula shown below, so as to obtain a first signature.
The first signature generation formula may be: r = hash (m) + Qx modn;
wherein r represents a first signature, hash represents a hash function, M represents data to be signed, Qx represents the abscissa of a third signature parameter, mod represents a remainder operation, and n is a positive integer and represents the private key of the SM2 algorithm.
After the first signature is obtained, the private key and the first signature parameter may be converted by using the first signature to obtain a standard parameter matched with a signature algorithm, and a digital signature is performed by using the standard parameter based on the signature algorithm to obtain a second signature. The complete signature can be obtained from the first signature and the second signature obtained as described above.
In practical application, when a complete signature is obtained, a first signature is preferentially obtained through calculation, and the first signature is used for obtaining a second signature through calculation. At this time, if the first signature is calculated in error, the calculation of the second signature will be affected, and the generation of the complete signature will be affected. Therefore, after the first signature is obtained, the first signature can be verified, the first signature is prevented from being mistaken, the influence on the calculation and generation of other parts of the signature is avoided, or unnecessary time is occupied for calculating the signature and outputting an error result, the generation time of the signature is shortened, and the generation efficiency of the signature is improved. Therefore, in some embodiments, after digitally signing the data to be signed by using the second signature parameter and the sixth random number and obtaining the first signature, the method may further include:
verifying whether the first signature is equal to 0 or whether the sum of the first signature and the sixth random number is a private key of the SM2 algorithm;
if the first signature is equal to 0 or the sum of the first signature and the sixth random number is equal to the private key of the SM2 algorithm, returning to use the second signature parameter and the sixth random number, and re-executing the step of digitally signing the data to be signed;
and if the first signature is not equal to 0 and the sum of the first signature and the sixth random number is not equal to the private key of the SM2 algorithm, continuing to execute the step of converting the private key and the first signature parameters by using the first signature to obtain the standard parameters matched with the signature algorithm.
After the first signature is verified to be correct, the private key and the first signature parameter can be converted by using the first signature to obtain a standard parameter matched with a signature algorithm, and digital signature is carried out by using the standard parameter based on the signature algorithm to obtain a second signature.
In practical applications, the method for encrypting the random number during the initialization process may be a homomorphic encryption algorithm. Homomorphic encryption is a cryptographic technique based on the computational complexity theory of mathematical problems, processes homomorphic encrypted data to obtain an output, decrypts the output, and has the same result as the output obtained by processing unencrypted original data in the same method. Thus, in some embodiments, a private key generated based on the first random number, the second random number, and the third random number encryption is obtained; and the method of encrypting the generated first signature parameter based on the fourth random number and the fifth random number may include:
acquiring a private key generated by encrypting the first random number, the second random number and the third random number based on a homomorphic encryption algorithm; and encrypting the generated first signature parameter for the fourth random number and the fifth random number based on a homomorphic encryption algorithm.
Wherein the homomorphic encryption algorithm may include a plurality of algorithms. In this embodiment, the homomorphic encryption algorithm may be implemented as a paillier algorithm. Optionally, the method for generating the private key based on the encryption of the first random number, the second random number, and the third random number may be that the first random number and the second random number are encrypted to obtain a first encrypted number by using a paillier algorithm according to a first encrypted number generation formula shown below; and generating a private key by the first encrypted number and the third random number according to a private key generation formula shown below.
The first encrypted number generation formula may be:;k1represents a first encrypted number satisfying。
Wherein enc represents an encryption function of the paillier algorithm, dec represents a decryption function of the paillier algorithm, and c1Denotes a first random number, m1Which represents the second random number, is,representing positive integer moduloN is a positive integer representing the private key of the SM2 algorithm, n1Is a positive integer representing the private key of the paillier algorithm.
wherein d is1Represents the private key, k1Representing a first encrypted number, r1Representing a third random number, mod representing a remainder operation, n1Is a positive integer representing the private key of the paillier algorithm.
Optionally, the method for generating the first signature parameter based on the fourth random number and the fifth random number through encryption may be to encrypt the fourth random number and the fifth random number according to a first signature parameter generation formula shown below by using a paillier algorithm to obtain the first signature parameter.
The first signature parameter generation formula may be:;e1representing a first signature parameter, the first signature parameter satisfying;
Wherein enc represents an encryption function of the paillier algorithm, dec represents a decryption function of the paillier algorithm, and f1Denotes a fourth random number, m2A fifth random number is represented by a fifth random number,representing positive integer moduloN is a positive integer representing the private key of the SM2 algorithm, n1Is a positive integer representing the private key of the paillier algorithm.
In some embodiments, in addition to generating the private key and the first signature parameter, the initialization process further generates a fourth signature parameter based on a value 1 encryption, and outputs the fourth signature parameter and a third random number, where the third random number and the fourth signature parameter may participate in signature generation. Therefore, before the private key and the first signature parameter are converted by using the first signature, the third random number and the fourth signature parameter generated by encrypting the value 1 can be obtained.
Specifically, in the initialization process, the paillier algorithm may be utilized to encrypt the value 1 according to a fourth signature parameter generation formula shown below to generate a fourth signature parameter.
The fourth signature parameter generation formula may be:;l1represents a fourth signature parameter, the fourth signature parameter satisfying。
Wherein enc represents an encryption function of the paillier algorithm, dec represents a decryption function of the paillier algorithm,representing positive integer moduloN is a positive integer representing the private key of the SM2 algorithm, n1Is a positive integer representing the private key of the paillier algorithm.
Optionally, the method for converting the private key and the first signature parameter by using the first signature to obtain the standard parameter matched with the signature algorithm may include:
converting the private key by using the first signature, the third random number and the seventh random number to obtain a first conversion parameter;
decrypting the first conversion parameter by using a homomorphic decryption algorithm to obtain a first standard sub-parameter;
converting the first signature parameter by using a third random number, a sixth random number and a seventh random number to obtain a second conversion parameter;
decrypting the second conversion parameter by using a homomorphic decryption algorithm to obtain a second standard sub-parameter;
converting the private key and the fourth signature parameter by using a third random number to obtain a third conversion parameter;
decrypting the third conversion parameter by using a homomorphic decryption algorithm to obtain a third standard sub-parameter; and the first standard sub-parameter, the second standard sub-parameter and the third standard sub-parameter form a standard parameter.
During the signing process, a seventh random number between (0, n), which may be denoted by z, may be generated. The private key may be converted by using the first signature, the third random number, and the seventh random number to obtain a first conversion parameter, the first signature parameter may be converted by using the third random number, the sixth random number, and the seventh random number to obtain a second conversion parameter, and the private key and the fourth signature parameter may be converted by using the third random number to obtain a third conversion parameter. Since the private key, the first signature parameter and the fourth signature parameter are obtained by a homomorphic encryption algorithm, if the paillier algorithm encrypts the random number in advance, the first conversion parameter, the second conversion parameter and the third conversion parameter obtained by converting the private key, the first signature parameter and the fourth signature parameter also contain the encryption process of the homomorphic encryption algorithm, and at this time, the conversion parameters can be decrypted by using a homomorphic decryption algorithm corresponding to the homomorphic encryption algorithm to obtain the standard sub-parameters matched with the signature algorithm.
Optionally, the first conversion parameter may be decrypted by using a homomorphic decryption algorithm according to a first decryption formula shown below, so as to obtain the first standard sub-parameter.
The first decryption formula may be: w1= dec (v 1) modn;
wherein w1 represents a first standard subparameter, dec represents a decryption function of the paillier algorithm, v1 represents a first conversion parameter, mod represents a remainder operation, and n is a positive integer and represents a private key of the SM2 algorithm.
Similarly, the second conversion parameter v1 may be decrypted by a homomorphic decryption algorithm according to a second decryption formula shown below, so as to obtain a second standard sub-parameter w 1.
The second decryption formula may be: w2= dec (v 1) modn;
wherein w2 represents a second standard subparameter, dec represents a decryption function of the paillier algorithm, v2 represents a second conversion parameter, mod represents a remainder operation, and n is a positive integer and represents a private key of the SM2 algorithm.
Similarly, the third conversion parameter v3 may be decrypted by a homomorphic decryption algorithm according to a third decryption formula shown below, so as to obtain a third standard sub-parameter w 3.
The third decryption formula may be: w3= dec (v 3) modn;
wherein w3 represents a third standard sub-parameter, dec represents a decryption function of the paillier algorithm, v3 represents a third conversion parameter, mod represents a remainder operation, and n is a positive integer and represents a private key of the SM2 algorithm.
The first standard sub-parameter, the second standard sub-parameter, and the third standard sub-parameter may constitute a standard parameter, and therefore, based on a signature algorithm, the method for obtaining a second signature by performing digital signature using the standard parameter may include:
and based on a signature algorithm, performing digital signature by using the first standard subparameter, the second standard subparameter, the third standard subparameter and the seventh random number to obtain a second signature.
In some embodiments, the first intermediate parameter may be generated by using the first signature, the third random number and the seventh random number according to a first intermediate parameter generation formula shown below, and the private key may be converted by using the first intermediate parameter according to a first conversion formula shown below to obtain the first conversion parameter.
The first intermediate parameter generation formula may be: r' = (n-r) · z · m1 modn;
where r' represents a first intermediate parameter, r represents a first signature, z represents a seventh random number, m1 represents a third random number, mod represents a remainder operation, and n is a positive integer representing the private key of the SM2 algorithm.
wherein v is1Representing a first conversion parameter, d1Represents the private key r1Representing a first intermediate parameter, mod representing a remainder operation, n1Is a positive integer representing the private key of the paillier algorithm.
Similarly, the second intermediate parameter may be generated by converting the first signature parameter by the sixth random number according to a second intermediate parameter generation formula shown below, and the third intermediate parameter may be generated by generating the third intermediate parameter by the third random number and the seventh random number according to a third intermediate parameter generation formula shown below, and converting the second intermediate parameter by the third intermediate parameter to obtain the second conversion parameter.
wherein u is1Denotes a second intermediate parameter, e1Representing a first signature parameter, r2Representing a sixth random number, mod TableRemainder of display operation, n1Is a positive integer representing the private key of the paillier algorithm.
The third intermediate parameter generation formula may be: z1= z · m1 modn;
where z1 denotes a third intermediate parameter, z denotes a seventh random number, m1 denotes a third random number, mod denotes a remainder operation, and n is a positive integer, denotes a private key of the SM2 algorithm.
wherein v is2Denotes a second transformation parameter, u1Denotes a second intermediate parameter, z1Representing a third intermediate parameter, mod representing a remainder operation, n1Is a positive integer representing the private key of the paillier algorithm.
Similarly, the private key and the fourth signature parameter may be converted by using a third random number according to a third conversion formula shown below, so as to obtain a third conversion parameter.
wherein v is3Representing a third transformation parameter, d1Represents the private key, m1Represents a third random number,/1Denotes a fourth signature parameter, mod denotes a modulo operation, n1Is a positive integer representing the private key of the paillier algorithm.
After the first conversion parameter, the second conversion parameter and the third conversion parameter are obtained, the first conversion parameter, the second conversion parameter and the third conversion parameter can be decrypted by using a homomorphic decryption algorithm respectively to obtain a corresponding first standard sub-parameter, a corresponding second standard sub-parameter and a corresponding third standard sub-parameter. The decryption process is described in detail in the foregoing embodiments, and will not be described herein again.
In practical applications, the second partial signature of the SM2 algorithm in the conventional scheme can be implemented as:
(ii) a Where s denotes a second signature, dADenotes a private key, k denotes a signature parameter, r denotes a first signature, mod denotes a remainder operation, n is a positive integer, and denotes the private key of the SM2 algorithm (the above parameters are parameters in the SM2 algorithm in the conventional scheme, and do not refer to parameters in the present embodiment). Then, by using the addition homomorphism property of the paillier algorithm, after the first conversion parameter, the second conversion parameter and the third conversion parameter are decrypted, the obtained first standard sub-parameter, the second standard sub-parameter and the third standard sub-parameter can be matched with the traditional scheme SM2 algorithm. Then in some embodiments, the method for digitally signing with the first standard subparameter, the second standard subparameter, the third standard subparameter and the seventh random number based on the signature algorithm may include:
and based on a signature algorithm, performing addition calculation on the first standard sub-parameter and the second standard sub-parameter to obtain a first calculation result, performing multiplication calculation on the first calculation result and the third standard sub-parameter to obtain a second calculation result, and performing division calculation on the second calculation result and the seventh random number to obtain a second signature.
Specifically, the second signature may be generated according to a second signature generation formula as shown below.
The second signature generation formula may be: s = w3 · (w 1+ w 2) · z-1modn;
Where s denotes a second signature, w1 denotes a first standard subparameter, w2 denotes a second standard subparameter, w3 denotes a third standard subparameter, z denotes a seventh random number, mod denotes a remainder operation, and n is a positive integer, and denotes a private key of the SM2 algorithm.
In the embodiment of the application, the property of a homomorphic encryption algorithm is utilized to encrypt the private key and the signature parameters for signature, so that the private key and the signature parameters are prevented from directly appearing in the signature process in the form of random numbers, and the problems of elliptic curve discrete logarithm and difficulty in resultant residue are still required to be solved even if an attacker obtains a source code of the signature to perform reverse analysis, so that the attacker can not obtain the real private key, and the security of the digital signature is improved. In addition, a lookup table is not introduced in the scheme, so that the occupation of the memory is reduced, and the digital signature of the memory is reduced on the basis of ensuring the safety.
In practical applications, the initialization process may further generate a public key corresponding to the private key for signature verification. In some embodiments, the method may further comprise:
and acquiring a public key generated based on the first random number, the third random number and the elliptic curve parameter.
Specifically, the fourth intermediate parameter may be generated based on the first random number and the elliptic curve parameter according to a fourth intermediate parameter generation formula shown below, and the public key may be generated based on the fourth intermediate parameter and the third random number according to a public key generation formula shown below.
The fourth intermediate parameter generation formula may be: k1= [ c1 ] G;
where k1 denotes the fourth intermediate parameter, c1 denotes the first random number, and G denotes the elliptic curve parameter.
The public key generation formula may be: q = [ r1 ] K1;
where Q denotes a public key, r1 denotes a third random number, and K1 denotes a fourth intermediate parameter.
The public key may be exported by an initialization process to verify the signature. Since the signature obtained in this embodiment is matched with a signature algorithm, such as the SM2 algorithm, the process of verifying the signature by using the public key is also the same as the signature verification process of the SM2 algorithm, which can be referred to as the signature verification process of the SM2 algorithm, and details are not described here.
As shown in fig. 2, a digital signature apparatus provided for the embodiment of the present application may include the following modules:
an obtaining module 201, configured to obtain a private key generated by encrypting based on the first random number, the second random number, and the third random number, and a first signature parameter generated by encrypting based on the fourth random number and the fifth random number;
a conversion module 202, configured to convert the private key and the first signature parameter into a standard parameter matching a signature algorithm;
and the signature module 203 is configured to perform digital signature on the data to be signed by using the standard parameter based on the signature algorithm.
In the embodiment, the private key and the first signature parameter generated based on random number encryption are obtained, the private key and the first signature parameter are converted into the standard parameter matched with the signature algorithm, digital signature is performed by using the standard parameter based on the signature algorithm, and the private key and the first signature parameter used for signature are encrypted, so that the situation that the private key and the first signature parameter directly appear in the digital signature process in the form of random numbers is avoided, an attacker cannot obtain the real private key, and the safety of the digital signature is improved. In addition, a lookup table is not introduced in the scheme, so that the occupation of the memory is reduced, and the digital signature of the memory is reduced on the basis of ensuring the data transmission safety.
In some embodiments, the obtaining module 201 may be further configured to obtain a second signature parameter generated based on the fourth random number and the elliptic curve parameter;
the apparatus may further include:
the first signature unit is used for carrying out digital signature on the data to be signed by utilizing the second signature parameter and the sixth random number to obtain a first signature;
the conversion module 202 may include:
the conversion unit is used for converting the private key and the first signature parameter by using the first signature to obtain a standard parameter matched with a signature algorithm;
the signature module 203 may include:
and the second signature unit is used for carrying out digital signature by using the standard parameters based on a signature algorithm to obtain a second signature.
In some embodiments, the apparatus may further comprise:
the verification module is used for verifying whether the first signature is equal to 0 or whether the sum of the first signature and the sixth random number is a private key of an elliptic curve public key signature algorithm; if the first signature is equal to 0 or the sum of the first signature and the sixth random number is equal to the private key of the elliptic curve public key signature algorithm, returning to use the second signature parameter and the sixth random number, and digitally signing the data to be signed to obtain the first signature; if the first signature is not equal to 0 and the sum of the first signature and the sixth random number is not equal to the private key of the elliptic curve public key signature algorithm, converting the private key and the first signature parameter by using the first signature to obtain a standard parameter matched with the signature algorithm.
In some embodiments, the obtaining module 201 may be further configured to obtain a third random number and a fourth signature parameter generated based on the value 1 encryption;
the conversion unit may include:
the first conversion subunit is configured to convert the private key by using the first signature, the third random number, and the seventh random number to obtain a first conversion parameter;
the first decryption subunit is used for decrypting the first conversion parameter by using a homomorphic decryption algorithm to obtain a first standard subparameter;
a second conversion subunit, configured to convert the first signature parameter by using the third random number, the sixth random number, and the seventh random number to obtain a second conversion parameter;
the second decryption subunit is used for decrypting the second conversion parameter by using a homomorphic decryption algorithm to obtain a second standard sub-parameter;
the third conversion subunit is configured to convert the private key and the fourth signature parameter by using the third random number to obtain a third conversion parameter;
the third decryption subunit is configured to decrypt the third conversion parameter by using a homomorphic decryption algorithm to obtain a third standard sub-parameter;
the second signature unit may include:
and the signature subunit is used for carrying out digital signature by utilizing the first standard subparameter, the second standard subparameter, the third standard subparameter and the seventh random number based on the signature algorithm to obtain a second signature.
In some embodiments, the obtaining module 201 may be further configured to obtain a public key generated based on the first random number, the third random number, and the elliptic curve parameter.
As shown in fig. 3, a digital signature system provided for the embodiment of the present application includes a storage component 301 and a processing component 302;
the storage component 301 is used to store one or more computer instructions for the processing component 302 to invoke for execution.
The processing component 302 is to:
acquiring a private key generated by encryption based on the first random number, the second random number and the third random number, and a first signature parameter generated by encryption based on the fourth random number and the fifth random number;
converting the private key and the first signature parameters into standard parameters matched with a signature algorithm;
and based on the signature algorithm, performing digital signature on the data to be signed by using the standard parameters.
In the embodiment, the private key and the first signature parameter generated based on random number encryption are obtained, the private key and the first signature parameter are converted into the standard parameter matched with the signature algorithm, digital signature is performed by using the standard parameter based on the signature algorithm, and the private key and the first signature parameter used for signature are encrypted, so that the situation that the private key and the first signature parameter directly appear in the digital signature process in the form of random numbers is avoided, an attacker cannot obtain the real private key, and the safety of the digital signature is improved. In addition, a lookup table is not introduced in the scheme, so that the occupation of the memory is reduced, and the digital signature of the memory is reduced on the basis of ensuring the data transmission safety.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that the embodiments may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
Claims (11)
1. A digital signature method, comprising:
acquiring a private key generated by encryption based on the first random number, the second random number and the third random number, and a first signature parameter generated by encryption based on the fourth random number and the fifth random number;
converting the private key and the first signature parameters into standard parameters matched with a signature algorithm;
and based on the signature algorithm, performing digital signature on the data to be signed by using the standard parameters.
2. The method of claim 1, wherein the signature algorithm is an elliptic curve public key signature algorithm, the method further comprising:
acquiring a second signature parameter generated based on the fourth random number and the elliptic curve parameter;
performing digital signature on the data to be signed by using the second signature parameter and the sixth random number to obtain a first signature;
the converting the private key and the first signature parameters into standard parameters matching a signature algorithm comprises:
converting the private key and the first signature parameter by using the first signature to obtain a standard parameter matched with a signature algorithm;
the digital signature of the data to be signed by using the standard parameters based on the signature algorithm comprises the following steps:
based on the signature algorithm, performing digital signature by using the standard parameters to obtain a second signature; the signature is composed of the first signature and the second signature.
3. The method according to claim 2, wherein the digitally signing the data to be signed by using the second signature parameter and the sixth random number to obtain the first signature comprises:
generating a third signature parameter based on the first signature parameter and a sixth random number;
according to a first signature generation formula, performing digital signature on the data to be signed by using the third signature parameter to obtain a first signature:
the first signature generation formula is: r = hash (m) + Qx modn;
wherein r represents a first signature, hash represents a hash function, M represents data to be signed, Qx represents the abscissa of a third signature parameter, mod represents a remainder operation, and n is a positive integer and represents a private key of an elliptic curve public key signature algorithm.
4. The method of claim 2, further comprising:
verifying whether the first signature is equal to 0 or whether the sum of the first signature and the sixth random number is a private key of an elliptic curve public key signature algorithm;
if the first signature is equal to 0 or the sum of the first signature and the sixth random number is equal to a private key of an elliptic curve public key signature algorithm, returning to use the second signature parameter and the sixth random number to digitally sign the data to be signed, and executing the step of obtaining the first signature again;
if the first signature is not equal to 0 and the sum of the first signature and the sixth random number is not equal to the private key of the elliptic curve public key signature algorithm, converting the private key and the first signature parameter by using the first signature to obtain a standard parameter matched with the signature algorithm.
5. The method of claim 2, wherein obtaining the private key generated based on the first random number, the second random number, and the third random number, and the first signature parameter generated based on the fourth random number and the fifth random number comprises:
and acquiring a private key generated by encrypting the first random number, the second random number and the third random number based on a homomorphic encryption algorithm, and a first signature parameter generated by encrypting the fourth random number and the fifth random number based on the homomorphic encryption algorithm.
6. The method of claim 5, further comprising:
acquiring a third random number and a fourth signature parameter generated by encryption based on the value 1;
the converting the private key and the first signature parameters into standard parameters matched with a signature algorithm by using the first signature comprises:
converting the private key by using the first signature, the third random number and the seventh random number to obtain a first conversion parameter;
decrypting the first conversion parameter by using a homomorphic decryption algorithm to obtain a first standard sub-parameter;
converting the first signature parameter by using the third random number, the sixth random number and the seventh random number to obtain a second conversion parameter;
decrypting the second conversion parameter by using a homomorphic decryption algorithm to obtain a second standard sub-parameter;
converting the private key and the fourth signature parameter by using the third random number to obtain a third conversion parameter;
decrypting the third conversion parameter by using a homomorphic decryption algorithm to obtain a third standard sub-parameter; forming a standard parameter by the first standard sub-parameter, the second standard sub-parameter and the third standard sub-parameter;
the step of performing digital signature by using the standard parameter based on the signature algorithm to obtain a second signature comprises:
and based on the signature algorithm, performing digital signature by using the first standard subparameter, the second standard subparameter, the third standard subparameter and the seventh random number to obtain a second signature.
7. The method of claim 6, wherein the transforming the private key with the first signature, the third random number, and a seventh random number to obtain a first transformation parameter comprises:
generating a first intermediate parameter by using the first signature, the third random number and the seventh random number according to a first intermediate parameter generation formula, and converting the private key by using the first intermediate parameter according to a first conversion formula to obtain a first conversion parameter:
the first intermediate parameter generation formula is as follows: r' = (n-r) · z · m1 modn;
wherein r' represents a first intermediate parameter, r represents a first signature, z represents a seventh random number, m1 represents a third random number, mod represents a remainder operation, n is a positive integer, represents a private key of the SM2 algorithm;
wherein v is1Representing a first conversion parameter, d1Represents the private key r1Denotes a first intermediate parameter, n1Is a positive integer representing the private key of the paillier algorithm;
the converting the first signature parameter by using the third random number, the sixth random number, and the seventh random number to obtain a second conversion parameter includes:
according to a second intermediate parameter generation formula, converting the first signature parameter by using the sixth random number to generate a second intermediate parameter, according to a third intermediate parameter generation formula, generating a third intermediate parameter by using the third random number and the seventh random number, and according to a second conversion formula, converting the second intermediate parameter by using the third intermediate parameter to obtain a second conversion parameter:
wherein u is1Denotes a second intermediate parameter, e1Representing a first signature parameter, r2Represents a sixth random number;
the third intermediate parameter generation formula is as follows: z1= z · m1 modn;
wherein z1 represents a third intermediate parameter;
wherein v is2Representing a second conversion parameter;
the converting the private key and the fourth signature parameter by using the third random number to obtain a third conversion parameter includes:
converting the private key and the fourth signature parameter by using the third random number according to a third conversion formula to obtain a third conversion parameter:
wherein v is3Denotes a third conversion parameter,/1Representing a fourth signature parameter.
8. The method of claim 6, wherein digitally signing the first standard subparameter, the second standard subparameter, the third standard subparameter and the seventh random number based on the signature algorithm comprises:
and based on the signature algorithm, performing addition calculation on the first standard sub-parameter and the second standard sub-parameter to obtain a first calculation result, performing multiplication calculation on the first calculation result and the third standard sub-parameter to obtain a second calculation result, and performing division calculation on the second calculation result and the seventh random number to obtain a second signature.
9. The method of claim 1, further comprising:
acquiring a public key generated based on the first random number, the third random number and an elliptic curve parameter; the public key is used for verifying the signature.
10. A digital signature apparatus, comprising:
the acquisition module is used for acquiring a private key generated by encryption based on the first random number, the second random number and the third random number and a first signature parameter generated by encryption based on the fourth random number and the fifth random number;
the conversion module is used for converting the private key and the first signature parameter into a standard parameter matched with a signature algorithm;
and the signature module is used for carrying out digital signature on the data to be signed by utilizing the standard parameters based on the signature algorithm.
11. A digital signature system is characterized by comprising a storage component and a processing component;
the storage component stores one or more computer instructions; the one or more computer instructions for execution invoked by the processing component;
the processing component is to:
acquiring a private key generated by encryption based on the first random number, the second random number and the third random number, and a first signature parameter generated by encryption based on the fourth random number and the fifth random number;
converting the private key and the first signature parameters into standard parameters matched with a signature algorithm;
and performing digital signature on the data to be signed by using the standard parameters based on the signature algorithm.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110437436.7A CN112822026B (en) | 2021-04-22 | 2021-04-22 | Digital signature method, device and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110437436.7A CN112822026B (en) | 2021-04-22 | 2021-04-22 | Digital signature method, device and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112822026A true CN112822026A (en) | 2021-05-18 |
CN112822026B CN112822026B (en) | 2021-09-17 |
Family
ID=75862561
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110437436.7A Active CN112822026B (en) | 2021-04-22 | 2021-04-22 | Digital signature method, device and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112822026B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6151676A (en) * | 1997-12-24 | 2000-11-21 | Philips Electronics North America Corporation | Administration and utilization of secret fresh random numbers in a networked environment |
US20150363775A1 (en) * | 2013-01-10 | 2015-12-17 | Tendyron Corporation | Key protection method and system |
CN108055136A (en) * | 2017-12-22 | 2018-05-18 | 上海众人网络安全技术有限公司 | Endorsement method, device, computer equipment and storage medium based on elliptic curve |
CN109672539A (en) * | 2019-03-01 | 2019-04-23 | 深圳市电子商务安全证书管理有限公司 | SM2 algorithm collaboration signature and decryption method, apparatus and system |
CN109687978A (en) * | 2019-01-15 | 2019-04-26 | 如般量子科技有限公司 | Anti- quantum calculation Proxy Digital Signature method and system based on private key pond and Elgamal |
CN111565108A (en) * | 2020-07-15 | 2020-08-21 | 北京信安世纪科技股份有限公司 | Signature processing method, device and system |
CN112417489A (en) * | 2020-12-04 | 2021-02-26 | 矩阵元技术(深圳)有限公司 | Digital signature generation method and device and server |
-
2021
- 2021-04-22 CN CN202110437436.7A patent/CN112822026B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6151676A (en) * | 1997-12-24 | 2000-11-21 | Philips Electronics North America Corporation | Administration and utilization of secret fresh random numbers in a networked environment |
US20150363775A1 (en) * | 2013-01-10 | 2015-12-17 | Tendyron Corporation | Key protection method and system |
CN108055136A (en) * | 2017-12-22 | 2018-05-18 | 上海众人网络安全技术有限公司 | Endorsement method, device, computer equipment and storage medium based on elliptic curve |
CN109687978A (en) * | 2019-01-15 | 2019-04-26 | 如般量子科技有限公司 | Anti- quantum calculation Proxy Digital Signature method and system based on private key pond and Elgamal |
CN109672539A (en) * | 2019-03-01 | 2019-04-23 | 深圳市电子商务安全证书管理有限公司 | SM2 algorithm collaboration signature and decryption method, apparatus and system |
CN111565108A (en) * | 2020-07-15 | 2020-08-21 | 北京信安世纪科技股份有限公司 | Signature processing method, device and system |
CN112417489A (en) * | 2020-12-04 | 2021-02-26 | 矩阵元技术(深圳)有限公司 | Digital signature generation method and device and server |
Also Published As
Publication number | Publication date |
---|---|
CN112822026B (en) | 2021-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3940988B1 (en) | Multi-party threshold authenticated encryption | |
CN107483212B (en) | Method for generating digital signature by cooperation of two parties | |
US11895231B2 (en) | Adaptive attack resistant distributed symmetric encryption | |
CN110545279A (en) | block chain transaction method, device and system with privacy and supervision functions | |
US11804960B2 (en) | Distributed symmetric encryption | |
JP2016114855A (en) | Encryption processing device, encryption processing method, and encryption processing program | |
US20200177380A1 (en) | Seed key expansion method and its uses | |
CN111314050A (en) | Encryption and decryption method and device | |
CN115102688A (en) | Data processing method, polynomial calculation method and electronic equipment | |
CN107104788B (en) | Terminal and non-repudiation encryption signature method and device thereof | |
WO2014030706A1 (en) | Encrypted database system, client device and server, method and program for adding encrypted data | |
CN111565108B (en) | Signature processing method, device and system | |
CN108055134B (en) | Collaborative computing method and system for elliptic curve point multiplication and pairing operation | |
CN107465508B (en) | Method, system and equipment for constructing true random number by combining software and hardware | |
CN110798313B (en) | Secret dynamic sharing-based collaborative generation method and system for number containing secret | |
EP4144042A1 (en) | Adaptive attack resistant distributed symmetric encryption | |
CN110401524B (en) | Method and system for collaborative generation of secret-containing numbers by means of homomorphic encryption | |
CN114362912A (en) | Identification password generation method based on distributed key center, electronic device and medium | |
CN108768634B (en) | Verifiable cryptographic signature generation method and system | |
CN112822026B (en) | Digital signature method, device and system | |
CN116208326A (en) | Data transmission method, device, system, storage medium and electronic equipment | |
WO2023055371A1 (en) | Replicated secret share generation for distributed symmetric cryptography | |
WO2023048711A1 (en) | Threshold secret share generation for distributed symmetric cryptography | |
CN114499845A (en) | Multi-party secure computing method, device and system | |
CN113544998A (en) | White-box elliptic curve cryptography implementation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |