A kind of SM2 algorithm secret keys segmentation signature system and method
Technical field
The present invention relates to field of information security technology, specific design key signature method and technology field are more particularly to a kind of
SM2 algorithm secret keys split signature system and method.
Background technology
In recent years, network safety event takes place frequently, network attack from information leakage, fund steal, telecommunication fraud and fishing
The personal event such as fishnet station, rises to the security incident of the whole society, can influence our life, influence servicing, being social for government
Stable even social safety.Cryptographic technique is the core technology of the network information security, under the overall situation of internet globalization, state
Production cryptographic technique has consequence in National Security Strategy, is the basis for realizing that national network information independence is controllable, can
To be widely used in the Industry system that E-Government, the energy, traffic, health, education etc. are related to the people's livelihood and basic information resources.
SM2 algorithms are the ellipse curve public key cipher algorithms that national Password Management office issued on December 17th, 2010, SM2
Algorithm under equal key strength, has the advantages of safe, calculating speed is fast, memory space is small, together compared with RSA Algorithm
When, relative to the ECC algorithm of international standard, SM2 algorithms will be more preferable in original state coding, computations efficiency.
With the development of mobile Internet, mobile device turns into a basic trend for changing traditional calculations, mobile device
Intellectualization times, the popularity rate more and more higher of mobile intelligent terminal are stepped into.People are surfed the Net using the time of fragmentation, are moved
Dynamic office, mobile e-business, mobile e-government have huge development, and the thing followed is safety problem, it is necessary to solve
The authentication of mobile terminal and digital signature.In this case, how efficiently to utilize mobile device and combine domestic close
Code algorithm realizes the problem of digital signature turns into a urgent need to resolve.
The content of the invention
In order to solve problem of the prior art, the invention provides a kind of SM2 algorithm secret keys to split signature system and method,
It combines the characteristics of mobile terminal, produces SM2 keys jointly using mobile device and high in the clouds cryptographic service, and be two by Secret splitting
Part, each preserved by mobile device end and high in the clouds cipher server respectively, this method realizes the label based on SM2 Secret splittings
Name algorithm, completes digital signature by mobile device and high in the clouds, ensure that signature process key is not compromised jointly, and can be effective
Protect the key safety of mobile device end.
The technical solution adopted in the present invention is as follows:
A kind of SM2 algorithm secret keys split signature system, including mobile device, high in the clouds cryptographic service and third party CA centers, described
Mobile device and high in the clouds cryptographic service each produce random number, and the legitimacy for completing in mobile device one end SM2 keys is tested
Card, confirm generation SM2 keys;Described mobile device and high in the clouds cryptographic service each completes one of SM2 algorithm digital signature
Point, and finally generate digital signature in mobile device one end;
Described mobile device is responsible for generating random number, the legitimate verification for completing SM2 keys and generation SM2 digital signature
Part calculates, in addition, mobile device can produce temporary key, for the communication with high in the clouds cryptographic services;
Described high in the clouds cryptographic service is responsible for generating random number, the transmission of encryption authentication data and realization with mobile device end
The part of SM2 signature algorithms calculates;
Signing and issuing for digital certificate is responsible at described third party CA centers, is on the one hand high in the clouds cryptographic service grant a certificate, it is ensured that cloud
The legal identity of cryptographic service is held, on the other hand digital certificate is issued for mobile device, is provided for the cipher application of mobile device
Legal identity certification.
Mobile device uses external hardware ciphering terminal equipment.
High in the clouds cryptographic service uses hardware encryption machine, or is operated using cloud cipher machine to complete ciphering signature.
A kind of SM2 algorithm secret keys split endorsement method, including the method for Split Key generation and the side for completing digital signature
Method, wherein, the method for Split Key generation includes:
Step 101, third party CA centers are that high in the clouds cryptographic service issues digital certificate;
Step 102, mobile device generation temporary key pair, Split Key generation request is proposed to described high in the clouds cryptographic service;
Step 103, described high in the clouds cryptographic service generation random number dc, are encrypted, and use using the public key of mobile device
Own key is signed, and is sent to described mobile device;
Step 104, described mobile device are decrypted first with temporary private, then verify that its certificate validity and signature are effective
Property, the random number dc of acquisition high in the clouds cryptographic service;
Step 105, described mobile device produce random number dm, calculate d=dc*dm -1, d ∈ [1;N -2], wherein n
For the rank of a basic point of SM2 elliptic curves;
It is basic point that step 106, described mobile device, which calculate point P=(xP, yP)=[d] G, wherein G,(XP, yP)For coordinate;
If P meets the requirement of SM2 elliptic curves, step 107 is gone to, otherwise goes to step 108;
Step 107, described mobile device send generation key success message, SM2 keys pair to described high in the clouds cryptographic service
It is SM2 keys to being (dm*dc-1;P), private keys of the wherein dm as described mobile device, dc is as described high in the clouds password
The private key of service, P are public key;
Step 108, described mobile device send generation key failed message to described high in the clouds cryptographic service, and go to step
102, re-start random number application;
To generating successfully, described third party CA centers are that the key issues digital certificate for step 109, SM2 Split Keys;
Completing the method for digital signature includes:
Step 201, described mobile device first calculate the Hash Value Z of this user, then splice plaintext M, calculate its digest value and turn
Integer is changed to, is denoted as e;
Step 202, described mobile device generation temporary key pair, Split Key generation is proposed to described high in the clouds cryptographic service
Request;
Step 203, described high in the clouds cryptographic service generation random number k ∈ [1, n-1], calculating SM2 elliptic curve points (x1, y1)=
[k] G, then r=(e+x1) mod n are calculated, regenerate random number if r=0 or r+k=n;
Step 204, described high in the clouds cryptographic service calculating t=(k+r)*dc-1;And will(R, t)Entered using the public key of mobile device
Row encryption, and signed using own key, it is sent to described mobile device;
Step 205, described mobile device are decrypted first with temporary private, then verify that its certificate validity and signature are effective
Property, obtain(R, t);
Step 206, described mobile device, which produce, calculates s=(t-r*dm) * dm-1, if s=0, goes to step 207, otherwise
Go to step 208;
Step 207, described mobile device send generation key failed message to described high in the clouds cryptographic service, and go to step
202, re-start signature;
Step 208, described mobile device send generation signature success message, SM2 signature values to described high in the clouds cryptographic service
For(R, s).
In step 102, mobile device proposes the request of Split Key generation, including movement to described high in the clouds cryptographic service
Device identification, the public key of temporary key pair, application time.
In step 202, described mobile device proposes the request bag of Split Key generation to described high in the clouds cryptographic service
Include mobile device mark, the public key of temporary key pair, digest value integer e.
The method of Split Key generation also includes:
Step 209, mobile device carry out sign test using its public key certificate to signature value.
The beneficial effect that technical scheme provided in an embodiment of the present invention is brought is:
The invention provides a kind of SM2 algorithm secret keys segmentation signature system and method, with reference to the characteristics of mobile terminal, is set using movement
Standby and high in the clouds cryptographic service produces SM2 keys jointly, and is two parts by Secret splitting, close by mobile device end and high in the clouds respectively
Code server each preserves.The process of generation key employs ciphering signature to realize the data interaction of equipment end and high in the clouds, protects
Transmission security is demonstrate,proved.SM signature algorithms based on Secret splitting, mobile device end and high in the clouds is transferred to complete respectively by calculating,
The generation of random number make use of high in the clouds hardware device to realize that this guarantees the generation intensity of random number in signature process;Key
All completed with signature generation in mobile device end, high in the clouds can not obtain the key part of mobile device end, or even connect by calculating
Cipher key content afterwards can not also obtain, this ensure that the key safety of mobile device end.On the other hand, key is split,
Even if partial Key Exposure, malicious attacker can not also forge digital signature, be effectively protected key safety.In addition, move
Dynamic equipment end can also access outer cipher encryption hardware equipment and produce the intensity of SM2 keys to strengthen it.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, make required in being described below to embodiment
Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for
For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings
Accompanying drawing.
Fig. 1 is that a kind of SM2 algorithm secret keys of the present invention split the system composition structure chart of signature system;
Fig. 2 is that a kind of SM2 algorithm secret keys of the present invention split the key generation method flow chart of endorsement method;
Fig. 3 is that a kind of SM2 algorithm secret keys of the present invention split the digital signature method flow chart of endorsement method.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention
Formula is described in further detail.
Embodiment one
As shown in Figure 1, a kind of SM2 algorithm secret keys segmentation signature system of the present embodiment, including mobile device, high in the clouds password clothes
Business and third party CA centers.Mobile device and high in the clouds cryptographic service each produce random number, and close in mobile device end completion SM2
The legitimate verification of key, confirm generation SM2 keys;Mobile device and high in the clouds cryptographic service each complete SM2 algorithm digital signature
A part, and finally mobile device end generate digital signature;SM2 digital signature verification operations and standard based on this method
SM2 algorithms it is identical.Wherein, described mobile device is responsible for generating random number, the legitimate verification of SM2 keys and generation
The part of SM2 digital signature calculates, in addition, mobile device, which can produce temporary key, is used for communication with high in the clouds cryptographic services, this
In mobile device can also improve its security by using external hardware ciphering terminal equipment.Described high in the clouds password clothes
Generation random number is responsible in business, and the part for transmitting and realizing SM2 signature algorithms with the encryption authentication data of mobile device end calculates,
High in the clouds cryptographic service can use hardware encryption machine, can also be operated using cloud cipher machine to complete ciphering signature etc..Described
Signing and issuing for digital certificate is mainly responsible at third party CA centers, is on the one hand high in the clouds cryptographic service grant a certificate, it is ensured that high in the clouds password
The legal identity of service, on the other hand issues digital certificate for mobile device, and legal body is provided for the cipher application of mobile device
Part certification.
It is clear in order to describe, it is assumed that in the present embodiment, high in the clouds and equipment end carry out message transmission and use state's Data Encryption Standard
SM2 algorithms, encryption key algorithm are SM2 national secret algorithms, and SM3 national secret algorithms are as digest algorithm, SM3SM2 national secret algorithm conducts
Signature algorithm, digital certificate use X509 forms.The data format of mobile device end key generation request is as follows:
ID :Mobile device identifies
PubKey:The public key of temporary key pair
T1:Application time
Nonce :Digital one time identifies
SigAlg :Signature algorithm
Signature :Signature value
The data format of the digital signature request of mobile device end is as follows:
ID :Mobile device identifies
e :Plaintext digest value after processing
PubKey:The public key of temporary key pair
T1:Application time
Nonce :Digital one time identifies
SigAlg :Signature algorithm
Signature :Signature value
It will be appreciated by those skilled in the art that in addition to using data above form, according to the embodiment of the present invention
Construction can also apply on other data formats.
Embodiment 2:
A kind of SM2 algorithm secret keys segmentation endorsement method of the present embodiment, including the method for Split Key generation and completion numeral label
The method of name, wherein, key generation method comprises the following steps with reference to figure 2:
Step 101, described third party CA centers are that described high in the clouds cryptographic service issues digital certificate;
Step 102, described mobile device generation temporary key pair, Split Key generation is proposed to described high in the clouds cryptographic service
Request(Identified including mobile device, the public key of temporary key pair, application time etc.);
Step 103, described high in the clouds cryptographic service generation random number dc, are encrypted, and use using the public key of mobile device
Own key is signed, and is sent to described mobile device;
Step 104, described mobile device are decrypted first with temporary private, then verify that its certificate validity and signature are effective
Property, the random number dc of acquisition high in the clouds cryptographic service.
Step 105, described mobile device produce random number dm, calculate d=dc*dm -1, d ∈ [1;N -2],
Wherein n is the rank of a basic point of SM2 elliptic curves.
It is basic point that step 106, described mobile device, which calculate point P=(xP, yP)=[d] G, wherein G,(XP, yP)For
Coordinate;If P meets the requirement of SM2 elliptic curves, step 107 is gone to, otherwise goes to step 108;
Step 107, described mobile device send generation key success message, SM2 keys pair to described high in the clouds cryptographic service
It is SM2 keys to being (dm*dc-1;P), private keys of the wherein dm as described mobile device, dc is as described high in the clouds password
The private key of service, P are public key;
Step 108, described mobile device send generation key failed message to described high in the clouds cryptographic service, and go to step
102, re-start random number application.
To generating successfully, described third party CA centers are that the key issues digital certificate for step 109, SM2 Split Keys.
The method of digital signature is completed with reference to figure 3, is comprised the following steps:
Step 201, described mobile device first calculate the Hash Value Z of this user, then splice plaintext M, calculate its digest value and turn
Integer is changed to, is denoted as e;
Step 202, described mobile device generation temporary key pair, Split Key generation is proposed to described high in the clouds cryptographic service
Request(Identified including mobile device, the public key of temporary key pair, digest value integer e etc.);
Step 203, described high in the clouds cryptographic service generation random number k ∈ [1, n-1], calculating SM2 elliptic curve points (x1, y1)=
[k] G, then r=(e+x1) mod n are calculated, regenerate random number if r=0 or r+k=n;
Step 204, described high in the clouds cryptographic service calculating t=(k+r)*dc-1;And will(R, t)Entered using the public key of mobile device
Row encryption, and signed using own key, it is sent to described mobile device;
Step 205, described mobile device are decrypted first with temporary private, then verify that its certificate validity and signature are effective
Property, obtain(R, t);
Step 206, described mobile device produce, and calculate s=(t-r*dm) * dm-1, if s=0, go to step 207, no
Then go to step 208;
Step 207, described mobile device send generation key failed message to described high in the clouds cryptographic service, and go to step
202, re-start signature.
Step 208, described mobile device send generation signature success message, SM2 label to described high in the clouds cryptographic service
Name value be(R, s);
Step 209, described mobile device carry out sign test using its public key certificate to signature value.
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc., it should be included in the scope of the protection.