Anonymous credential method, system and storage medium based on national secret SM2
Through the anonymous credential method based on the national secret SM2, using zero-knowledge proof and confusing circuit solutions, the problem of user privacy leakage and national standard compatibility in digital identity authentication is solved, and safe and compatible digital identity authentication and privacy protection are achieved.
Patent Information
- Application Number
- CN202410609102.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-05-16
AI Technical Summary
Existing digital identity authentication technology has problems such as user privacy leakage and incompatibility with national password standards. It is difficult to ensure data security while meeting the needs of user privacy protection and national security policies.
Adopt the anonymous certificate method based on the national secret SM2, select the zero-knowledge proof scheme and the confusing circuit scheme through the certificate authority center, generate the public parameters of the anonymous certificate, and use the public parameters and specific attributes of the anonymous certificate to generate certificate requests with corresponding attributes, and conduct legal Verification and issuance to ensure user identity privacy protection and compatibility of digital identity authentication.
It achieves digital identity authentication while protecting user data privacy, provides more secure and credible technical support, complies with domestic independent and controllable strategic policies, and is suitable for a variety of practical application scenarios.
Smart Images

Figure CN118316627B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of information security authentication, and specifically relates to an anonymous credential method, system and storage medium based on national secret SM2. Background Art
[0002] In an open environment where multiple emerging technologies such as cloud computing, the Internet of Things, and artificial intelligence are integrated, data security circulation and data security utilization provide security guarantees for data resource sharing. Data security circulation and utilization both require entities to carry them, and trusted digital identities are the basis for ensuring the credibility of data sources and users to carry out various digital activities. They are widely used in e-commerce, e-government and other systems. In recent years, countries have launched initiatives to establish national digital identity systems, such as the European Union's Electronic Identification, Authentication and Trust Service (eIDAS) and India's Aadhaar system. These initiatives aim to provide citizens with a safe and convenient way to access online services and conduct digital transactions.
[0003] Currently, there are a variety of digital identity authentication technologies available, including password-based authentication, biometric authentication, and electronic credential schemes. Among them, password-based authentication is the most widely used method, but it has some limitations, such as being vulnerable to phishing attacks and password guessing. On the other hand, biometric authentication uses unique physical or behavioral characteristics (such as fingerprints or facial recognition) to authenticate users, and there is a risk of user privacy leakage during the authentication process, such as excessive biometric collection and illegal use. The electronic credential scheme performs identity authentication by showing the electronic credential to the service provider, which also has the risk of excessive exposure of user privacy. For example, when using a credit card issued based on an electronic ID card to make a purchase, the service provider can easily associate the user's transaction information and track the user's consumption behavior. In addition, these technologies may be incompatible with national password standards, which has caused public concerns about their security and credibility.
[0004] Therefore, a practical and secure digital identity authentication technology must consider two aspects of needs: on the one hand, it is necessary to fully consider the privacy protection of users and avoid revealing the identity information of users during use; on the other hand, it must use or be compatible with national cryptographic standards to ensure compatibility and interoperability within the national digital infrastructure, enhance the scalability and applicability of digital identity solutions in specific environments, and implement independent and controllable national security strategies and policies. The anonymous credential method based on the national secret SM2 can effectively meet these two needs. As one of the cryptographic algorithms independently developed by my country, the national secret SM2 has excellent security and efficiency, complies with the domestic independent and controllable strategic policies, and has been widely used in government affairs, finance and other fields. The anonymous credential method based on the national secret SM2 can also protect the user's identity privacy while authenticating the validity of the user's digital identity, perfectly meeting the needs of user privacy protection and having broad application prospects. Summary of the invention
[0005] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide an anonymous credential method, system and storage medium based on the national secret SM2, which can protect user data privacy while realizing digital identity authentication and is more in line with actual application scenarios; at the same time, the solution adopts the national secret standard and can provide more secure and reliable technical support.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] On the one hand, the present invention provides an anonymous credential method based on the national secret SM2, comprising the following steps:
[0008] The certificate authority selects a zero-knowledge proof scheme and a garbled circuit scheme, and generates public parameters of the anonymous credential; and makes the selected zero-knowledge proof scheme, garbled circuit scheme, and public parameters of the anonymous credential public;
[0009] The certificate authority generates its own public-private key pair, where the public key is made public and the private key is kept secret;
[0010] When a user requests a specific service provided by a service provider and meets the specific attribute conditions of the specific service, the user generates a certificate request with the corresponding attributes using the public parameters and specific attributes of the anonymous credential and sends it to the certificate authority;
[0011] When the certificate authority receives a user's certificate request, the certificate authority and the user jointly execute the obfuscated circuit scheme and the zero-knowledge proof scheme to verify the legitimacy of the certificate request; if the legitimacy verification fails, the user's certificate request is rejected;
[0012] If the legitimacy verification is passed, the certificate authority will accept the user's certificate request and interact with the user to jointly complete the issuance of the certificate and send the authorization certificate to the user;
[0013] The user generates an anonymous credential using the authorization certificate, the public parameters of the anonymous credential, and the public key of the certificate authority, and sends the anonymous credential to the service provider;
[0014] When the service provider receives the anonymous credential, it verifies the validity of the anonymous credential; if the validity verification is passed, the service provider provides the specific service requested by the user; if the validity verification is not passed, the service request of the user is rejected.
[0015] As a preferred technical solution, the certificate authority selects a zero-knowledge proof solution and a garbled circuit solution, and generates public parameters of anonymous credentials, specifically:
[0016] The certificate authority selects a zero-knowledge proof scheme ZK = (ZK.Setup, ZK.Prove, ZK.Verify) for zero-knowledge proof of algebraic statements, and selects a security parameter λ1; where ZK.Setup is the initialization algorithm of ZK, inputs the security parameter λ1, and outputs the public reference string crs, that is, ZK.Prove is the proof algorithm of ZK. It takes as input the public reference string crs, statement st and evidence w, and outputs proof π, i.e., π←ZK.Prove(crs,st,w); ZK.Verify is the verification algorithm of ZK. It takes as input the public reference string crs, statement st and proof π, and verifies whether the proof is valid. If the proof is valid, it returns 1, otherwise it returns 0, i.e., 0 / 1←ZK.Verify(crs,st,π);
[0017] The certificate authority selects a garbled circuit scheme GC = (GC.Gen, GC.En, GC.De, GC.Eval) for zero-knowledge proof of non-algebraic statements, and selects a security parameter λ2; where GC.Gen is the generation algorithm of GC, which inputs the security parameter λ2 and a description of a Boolean circuit F, and outputs the corresponding garbled circuit C, the encoding information e of C, and the decoding information d of C, that is, GC.En is the encoding algorithm of GC. It inputs the encoding information e of the obfuscated circuit C and the input x of the Boolean circuit F, and outputs the obfuscated input x′ corresponding to x, that is, x′←GC.En(e,x); GC.Eval is the evaluation algorithm of GC. It inputs the obfuscated circuit C and the obfuscated input x′, and outputs the encoded evaluation result y′, that is, y′←GC.Eval(C,x′); GC.De is the decoding algorithm of GC. It inputs the encoded evaluation result y′ and the decoding information d, and outputs the decoded evaluation result y, that is, y←GC.De(d,y′);
[0018] The certificate authority runs the Cred.Steup algorithm, selects a security parameter λ3 as input, and calls the SM2.Setup algorithm to generate the public parameters of the SM2 digital signature scheme. Right now Among them, p and q are two different large prime numbers, G1 and G2 are cyclic groups of order p and order q respectively, P1 and Q1 are two different generators of cyclic group G1, P2 and Q2 are two different generators of cyclic group G2, and H0 is a hash function The public parameters of the SM2 digital signature scheme The public reference string crs in the zero-knowledge proof scheme ZK is concatenated as the public parameter of the anonymous credential.
[0019] The certificate authority will make public the public parameters pp, the selected zero-knowledge proof scheme ZK, the confusion circuit scheme GC and the security parameters λ1, λ2 and λ3.
[0020] As a preferred technical solution, the certificate authority generates its own public and private key pair, specifically:
[0021] The certificate authority runs the Cred.KeyGen algorithm, takes the public parameter pp of the anonymous credential as input, and calls the SM2.KeyGen algorithm to generate a public-private key pair (mpk, msk) = (xP2, x), that is:
[0022]
[0023] Among them, x is from group Z q We randomly select from the group Z q is a finite field modulo a large prime number q; xP2 represents x times the generator P2 in the cyclic group G2;
[0024] The public key mpk is made public and the private key msk is kept secret.
[0025] As a preferred technical solution, the user generates a certificate request with corresponding attributes using the public parameters and specific attributes of the anonymous credential, specifically:
[0026] The user runs the Cred.Request algorithm, passing in the public parameters pp and specific attributes m∈Z of the anonymous credential. q , randomly select r1,r2∈Z q , calculate the commitment c1=mP2+r1Q2 corresponding to the specific attribute m, and the commitment c2=H0(m)P2+r2Q2 corresponding to the hash value H0(m) of the specific attribute m;
[0027] The commitments c1 and c2 are used as a certificate request for a specific attribute m, i.e., req = (c1, c2), and sent to the certificate authority.
[0028] As a preferred technical solution, the verification of the legitimacy of the certificate request is specifically as follows:
[0029] Assume that the user holds u=(m,M), m, M∈Z q ; The certificate authority randomly selects two integers a, b∈Z with bit lengths n and n+s q and two random numbers r3,r4∈Z used to calculate the commitment q , and calculate the commitment c3=aP2+r3Q2 corresponding to a and the commitment c4=bP2+r4Q2 corresponding to b, and send the commitments c3 and c4 to the user; where n is the bit length of u;
[0030] The certificate authority determines a Boolean circuit F, whose input is u=(m,M) and output is (v,t), and the structure of the Boolean circuit F satisfies: the value of v is related to m and M, that is, when M=H0(m), v=1, otherwise v=0; and the value of t is always t=au+b; the certificate authority takes the Boolean circuit F and the security parameter λ2 as input, and calls the GC.Gen algorithm to generate the obfuscated circuit C corresponding to F, the encoding information e of C, and the decoding information d of C;
[0031] The certificate authority randomly selects two values for each bit in the user's u. Assume that the random value corresponding to the i-th bit in u is For all i∈[n], the user input (i,u i ), the certificate authority enters Both run the 2-choose-1 oblivious transfer protocol together After executing n rounds of the oblivious transfer protocol After that, the user gets
[0032] The certificate authority sends the generated obfuscated circuit C to the user, and the user uses the obfuscated circuit C and the obtained As input, call the GC.Eval algorithm to evaluate the garbled circuit C and get the outputs t′ and v′, that is, The user randomly selects r5∈Z q , calculate the commitment c5=v′P2+r5Q2 corresponding to v′, and send the commitment c5 to the certificate authority, where t′ and v′ are the encoding results of t and v respectively, that is, t′←GC.En(e,t) and v′←GC.En(e,v);
[0033] When the certificate authority receives the commitment c5, it sends the decoded information d of the obfuscated circuit C to the user. After receiving the decoded information d, the user uses it and t′ as the input of the GC.De algorithm and decodes to get t. The user randomly selects r6∈Z q , calculate the commitment c6=tP2+r6Q2 corresponding to t, and send the commitment c6 to the certificate authority;
[0034] When the certificate authority receives the commitment c6, the certificate authority will generate a random value The random values (a, r3), (b, r4) and Boolean circuit F required to open commitments c3 and c4 are sent to the user; the user receives After (a, r3) and (b, r4), recalculate the commitment c′3=aP2+r3Q2 corresponding to a and the commitment c′4=bP2+r4Q2 corresponding to b, and compare whether c3 and c′3 are equal, and whether c4 and c′4 are equal; if c3≠c′3 or c4≠c′4, abandon the certificate request and no longer interact with the certificate authority;
[0035] If c3=c′3 and c4=c′4, then the user uses the garbled circuit C, The Boolean circuit F is used to construct the obfuscated circuit C to check whether the certificate authority is honest; if the check fails, the certificate request is abandoned and no longer interacts with the certificate authority; if the check passes, the user sends the random value (v′, r5) required to open the commitment c5 to the certificate authority;
[0036] After receiving the random value (v′, r5), the certificate authority recalculates the commitment c′5=v′P2+r5Q2 corresponding to v′, and compares whether c5 and c′5 are equal; if they are not equal, the certificate authority rejects the user's certificate request and no longer interacts with the user; if they are equal, the certificate authority inputs the obtained v′ and the decoding information d, calls the GC.De algorithm, and decodes to obtain v; if v≠1, the certificate authority rejects the user's certificate request and no longer interacts with the user;
[0037] If v = 1, the user inputs the public reference string crs in the public parameter pp, the evidence w1 = (u, t, r1, r2, r6) = (m, M, t, r1, r2, r6) and the statement st1: c1 = mP2 + r1Q2 ∧ c2 = MP2 + r2Q2 ∧ c6 = tP2 + r6Q2 ∧ t = au + b, calls the ZK.Prove algorithm, and generates the zero-knowledge proof corresponding to the statement st1 Zero-knowledge proof Send to the certificate authority;
[0038] When receiving the zero-knowledge proof sent by the user When the certificate authority sends a zero-knowledge proof The public reference string crs and statement st1 are used as input to call the ZK.Verify algorithm to verify Is it valid? If the output of the ZK.Verify algorithm is 1, the certificate authority accepts the user's certificate request and passes the legitimacy verification; if the output of the ZK.Verify algorithm is 0, the certificate authority rejects the user's certificate request and fails the legitimacy verification.
[0039] As a preferred technical solution, the issuance of the joint completion certificate is specifically as follows:
[0040] The certificate authority inputs the public parameter pp and its own private key msk, and the user inputs the public parameter pp, the specific attribute m, and the hash value H0(m) of the specific attribute m, and the two parties jointly run the Cred.Issue algorithm;
[0041] For the certificate authority, the Cred.Isue algorithm receives the public parameter pp and the private key msk of the certificate authority as input and randomly selects k∈Z q And calculate the element K=kP2 in the cyclic group G2, and send K to the user;
[0042] For the user, the Cred.Issue algorithm receives the public parameter pp, the specific attribute m, the hash value H0(m) of the specific attribute m, and K sent by the certificate authority as input, and randomly selects α∈Z q , and calculate the elements K′=αP2, K″=αK=αkP2=(x1,y1) in the cyclic group G2, calculate r=x1+H0(m)mod q, r′=α -1 r mod q, then calculate the element Z=(αr′-x1)P2 in the cyclic group G2, and finally use the public reference string crs, the statement st2:(αr′-x1)P2=H0(m)P2∧c2=H0(m)P2+r2Q2 and the evidence w2=(α,x1,H0(m),r2) to call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to the statement st2 And r′, Z, zero-knowledge proof Send to the certificate authority;
[0043] When receiving r′, Z and zero-knowledge proof sent by the user When the certificate authority's Cred.Issue algorithm uses the public reference string crs, statement st2 and zero-knowledge proof Call ZK.Verify algorithm to verify Is it valid? If the output of the ZK.Verify algorithm is 1, then the zero-knowledge proof Valid, calculate s′=(1+x) -1(kr′x)mod q=(1+x) -1 (k+r′)-r′mod q, and send s′ to the user; if the output of the ZK.Verify algorithm is 0, then the zero-knowledge proof Invalid, the certificate authority notifies the user to regenerate the zero-knowledge certificate
[0044] After receiving s′ from the certificate authority, the user's Cred.Issue algorithm calculates s=αs′mod q, and uses r and s as the SM2 signature σ of the certificate authority on the specific attribute m; using the SM2 signature σ and the public key mpk of the certificate authority, the SM2.Verify algorithm is called to verify whether the SM2 signature is valid. If the output of the SM2.Verify algorithm is 1, the SM2 signature σ is valid, and cred=(m,σ)=(m,(r,s)) is used as the authorization certificate for the specific attribute m; if the output of the SM2.Verify algorithm is 0, the SM2 signature σ is invalid, and the user notifies the certificate authority to re-verify the zero-knowledge proof
[0045] As a preferred technical solution, the generation of anonymous credentials is specifically as follows:
[0046] The user runs the Cred.Show algorithm, using the authorization certificate cred, public parameters pp and the public key mpk of the certificate authority, and randomly selects r7, r8∈Z q , calculate the commitment c7=rP2+r7Q2 corresponding to r, the commitment c8=sP2+r8Q2 corresponding to s, and calculate z=r+s, the element z·mpk=zxP2=(z x , z y ), sP2=(s x ,s y ), where z x 、z y are the horizontal and vertical coordinates of the element z·mpk in the cyclic group G2; s x 、s y are the abscissa and ordinate of the element sP2 in the cyclic group G2 respectively;
[0047] Randomly select r9∈Z q ,r 10 ,r 11 ,r 12 ,r 13 ∈Z p , Z p For a finite field modulo a large prime number p, calculate the commitments corresponding to z c9 = zP2 + r9Q2, z x The corresponding commitment c 10 =zx P1+r 10 Q1, z y The corresponding commitment c 11 =z y P1+r 11 Q1, s x The corresponding commitment c 12 =s x P1+r 12 Q1, s y The corresponding commitment c 13 =s y P1+r 13 Q1;
[0048] Using the common reference string crs, statement st3: c8 = sP2 + r8Q2 ∧ c 12 =s x P1+r 12 Q1∧c 13 =s y P1+r 13 Q1 and evidence w3=(s,s x ,s y ,r8,r 12 ,r 13 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st3
[0049] Using the common reference string crs, statement st4: c9 = zP2 + r9Q2Λc 10 =z x P1+r 10 Q1Λc 11 =z y P1+r 11 Q1 and evidence w4=(z,z x ,z y ,r9,r 10 ,r 11 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st4
[0050] Using the common reference string crs, statement st5: c7 = rP2 + r7Q2 ∧ c2 = H0(m)P2 + r2Q2 ∧ c 12 =s x P1+r 12 Q1∧c 13 =s y P1+r 13 Q1∧c 10 =z x P1+r 10 Q1∧c 11 =zy P1+r 11 Q1 and evidence w5=(r,H0(m),s x ,s y ,z x ,z y ,r7,r2,r 12 ,r 13 ,r 10 ,r 11 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st5
[0051] Using the public reference string crs, statement st6: c7 = rP2 + r7Q2 ∧ c8 = sP2 + r8Q2 ∧ c9 = zP2 + r9Q2 ∧ z = r + s and evidence w6 = (r, s, z, r7, r8, r9), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st6
[0052] Output anonymous credentials
[0053] As a preferred technical solution, when the service provider receives the anonymous credential, the service provider inputs the public parameter pp, the anonymous credential θ displayed by the user and statements st3, st4, st5, st6, and runs the Cred.Verify algorithm to verify the validity of the anonymous credential, specifically:
[0054] Input public reference string crs, statement st3 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0055] Input public reference string crs, statement st4 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0056] Input public reference string crs, statement st5 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0057] Input public reference string crs, statement st6 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0058] If zero-knowledge proof If any of the verifications fails, the Cred.Verify algorithm outputs 0, indicating that the anonymous credential has not passed the validity verification and the service provider rejects the user's service request;
[0059] If zero-knowledge proof If all are verified, the Cred.Verify algorithm outputs 1, indicating that the anonymous credential passes the validity verification and the service provider provides the specific service requested by the user.
[0060] On the other hand, the present invention provides an anonymous credential system based on the national secret SM2, which is applied to the above-mentioned anonymous credential method based on the national secret SM2, including a parameter generation module, a key generation module, a certificate request module, a certificate verification module, a certificate issuance module, a credential generation module and a credential verification module;
[0061] The parameter generation module is used for the certificate authority to select a zero-knowledge proof scheme and a confusion circuit scheme, and generate public parameters of the anonymous credential; the selected zero-knowledge proof scheme, confusion circuit scheme and public parameters of the anonymous credential are made public together;
[0062] The key generation module is used by the certificate authority to generate its own public and private key pair, where the public key is made public and the private key is kept secret;
[0063] The certificate request module is used for generating a certificate request with corresponding attributes by using public parameters and specific attributes of anonymous credentials and sending it to the certificate authority when the user requests to enjoy a specific service provided by the service provider and meets the specific attribute conditions of the specific service;
[0064] The certificate verification module is used when the certificate authority receives a certificate request from a user. The certificate authority and the user jointly execute the obfuscation circuit scheme and the zero-knowledge proof scheme to verify the legitimacy of the certificate request; if the legitimacy verification fails, the user's certificate request is rejected;
[0065] The certificate issuance module is used to, if the legitimacy verification is passed, the certificate authority accepts the user's certificate request and interacts with the user to jointly complete the issuance of the certificate and send the authorization certificate to the user;
[0066] The credential generation module is used for the user to generate an anonymous credential using the authorization certificate, the public parameters of the anonymous credential and the public key of the certificate authority, and send the anonymous credential to the service provider;
[0067] The credential verification module is used to verify the validity of the anonymous credential when the service provider receives it; if the validity verification is passed, the service provider provides the specific service requested by the user; if the validity verification is not passed, the service request of the user is rejected.
[0068] On the other hand, a computer-readable storage medium is provided, which stores a program. When the program is executed by a processor, the anonymous credential method based on the national secret SM2 is implemented.
[0069] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0070] 1. The present invention uses anonymous credential technology to protect user data privacy while implementing digital identity authentication; this identity anonymity feature is exactly what many practical applications need.
[0071] 2. The present invention is based on the national secret SM2 and uses an efficient zero-knowledge proof scheme and a confusion circuit scheme to construct an efficient anonymous credential scheme, which is of great significance for strengthening the application and promotion of national secret standards in digital identity authentication systems and providing more secure and reliable technical support.
[0072] 3. The anonymous credential scheme based on SM2 proposed in the present invention not only caters to the policy trend of localization of cryptography, but also can effectively protect the user's identity privacy while realizing digital identity authentication, which is conducive to promoting the safe development of various digital activities, and has broad application scenarios and high economic benefits. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0074] Figure 1 This is an overall flow chart of the anonymous credential method based on the national secret SM2 in an embodiment of the present invention.
[0075] Figure 2 It is an overall block diagram of the anonymous credential system based on the national secret SM2 in an embodiment of the present invention.
[0076] Figure 3 Schematic diagram of the structure of a computer-readable storage medium in an embodiment of the present invention. DETAILED DESCRIPTION
[0077] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0078] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0079] The anonymous credential method based on the national secret SM2 proposed in the present invention not only efficiently completes identity authentication under the premise of protecting the user's identity privacy, but also is compatible with the deployed SM2 signature application. SM2 is a cryptographic algorithm independently developed by my country, which complies with national cryptographic standards, has independent intellectual property rights, and is not restricted by foreign technology and policies. The anonymous credential method based on the national secret SM2 not only caters to the localization of cryptography, but also can effectively protect the user's identity privacy while realizing digital identity authentication, which is conducive to promoting the safe development of various digital activities. This method involves three participating roles, namely: certificate authority center, user and service provider (verifier); when the user wants the service provider to provide a specific service, first request an authorization certificate from the certificate authority center, the certificate authority center verifies the legitimacy of the user's certificate request and issues a certificate to the user, the user holding the certificate displays the credential to prove to the service provider that he meets the specific verification conditions, the service provider verifies the validity of the credential and provides the user with a specific service, thereby realizing user identity authentication. The algorithms involved in this method include Cres.Setup algorithm, Cred.KeyGen algorithm, Cred.Request algorithm, Cres.Issue algorithm, Cres.Show algorithm and Cres.Verify algorithm, all of which are built based on the national secret SM2 digital signature scheme.
[0080] Among them, the Cred.Setup algorithm is run by the certificate authority and is used to generate public parameters in the anonymous credential method;
[0081] Cred.KeyGen algorithm, which is run by the certificate authority to generate the certificate authority's public and private key pair, where the public key is used to verify the certificate and the private key is used to generate the certificate;
[0082] Cred.Request algorithm, which is run by the user to request a certificate from a certificate authority;
[0083] Cred.Issue algorithm, which is jointly run by the user and the certificate authority and is used by the certificate authority to issue certificates to users;
[0084] Cred.Show algorithm, which is run by the user to generate and display anonymous credentials;
[0085] Cred.Verify algorithm, which is run by the service provider to verify whether the credentials presented by the user are valid.
[0086] For the national secret SM2 digital signature scheme, it includes four algorithms, namely SM2.Setup, SM2.KeyGen, SM2.Sign and SM2.Verify.
[0087] like Figure 1 As shown, this embodiment is based on the anonymous credential method of the national secret SM2, and includes the following steps:
[0088] S1. The certificate authority selects a zero-knowledge proof scheme and a garbled circuit scheme, and generates public parameters of the anonymous credential; the selected zero-knowledge proof scheme, garbled circuit scheme, and public parameters of the anonymous credential are made public together;
[0089] Specifically, the process of step S1 is:
[0090] S101. The certificate authority selects a zero-knowledge proof scheme ZK = (ZK.Setup, ZK.Prove, ZK.Verify) for zero-knowledge proof of algebraic statements, and selects a security parameter λ1; where ZK.Setup is the initialization algorithm of ZK, inputs the security parameter λ1, and outputs the public reference string crs, that is, ZK.Prove is the proof algorithm of ZK. It takes as input the public reference string crs, statement st and evidence w, and outputs proof π, i.e., π←ZK.Prove(crs,st,w); ZK.Verify is the verification algorithm of ZK. It takes as input the public reference string crs, statement st and proof π, and verifies whether the proof is valid. If the proof is valid, it returns 1, otherwise it returns 0, i.e., 0 / 1←ZK.Verify(crs,st,π);
[0091] S102. The certificate authority selects a garbled circuit scheme GC = (GC.Gen, GC.En, GC.De, GC.Eval) for zero-knowledge proof of non-algebraic statements, and selects a security parameter λ2; where GC.Gen is a generation algorithm of GC, which inputs security parameter λ2 and a description of a Boolean circuit F, and outputs the corresponding garbled circuit C, the encoding information e of C, and the decoding information d of C, i.e. GC.En is the encoding algorithm of GC. It inputs the encoding information e of the obfuscated circuit C and the input x of the Boolean circuit F, and outputs the obfuscated input x′ corresponding to x, that is, x′←GC.En(e,x); GC.Eval is the evaluation algorithm of GC. It inputs the obfuscated circuit C and the obfuscated input x′, and outputs the encoded evaluation result y′, that is, y′←GC.Eval(C,x′); GC.De is the decoding algorithm of GC. It inputs the encoded evaluation result y′ and the decoding information d, and outputs the decoded evaluation result y, that is, y←GC.De(d,y′);
[0092] S103, the certificate authority runs the Cred.Setup algorithm, selects a security parameter λ3 as input, and calls the SM2.Setup algorithm to generate the public parameters of the SM2 digital signature scheme Right now Among them, p and q are two different large prime numbers, G1 and G2 are cyclic groups of order p and order q respectively, P1 and Q1 are two different generators of cyclic group G1, P2 and Q2 are two different generators of cyclic group G2, and H0 is a hash function The public parameters of the SM2 digital signature scheme The public reference string crs in the zero-knowledge proof scheme ZK is concatenated as the public parameter of the anonymous credential.
[0093] S104. The certificate authority discloses the public parameters pp, the selected zero-knowledge proof scheme ZK, the confusion circuit scheme GC and the security parameters λ1, λ2 and λ3.
[0094] S2. The certificate authority generates its own public-private key pair, where the public key is made public and the private key is kept secret;
[0095] Specifically, the process of step S2 is:
[0096] S201. The certificate authority runs the Cred.KeyGen algorithm, takes the public parameter pp of the anonymous credential as input, and calls the SM2.KeyGen algorithm to generate a public-private key pair (mpk, msk) = (xP2, x), that is:
[0097]
[0098] Among them, x is from group Z q We randomly select from the group Z q is a finite field modulo a large prime number q; xP2 represents x times the generator P2 in the cyclic group G2;
[0099] S202. The public key mpk is made public, and the private key msk is kept secret.
[0100] S3. When a user requests a specific service provided by a service provider and meets the specific attribute conditions of the specific service, the user generates a certificate request with corresponding attributes using the public parameters and specific attributes of the anonymous credential and sends it to the certificate authority;
[0101] Specifically, the process of step S3 is:
[0102] S301, the user runs the Cred.Request algorithm, passing in the public parameter pp and specific attribute m∈Z of the anonymous credential q , randomly select r1,r2∈Z q , calculate the commitment c1=mP2+r1Q2 corresponding to the specific attribute m, and the commitment c2=H0(m)P2+r2Q2 corresponding to the hash value H0(m) of the specific attribute m;
[0103] S302: Take the commitments c1 and c2 as a certificate request for a specific attribute m, that is, req = (c1, c2), and send it to a certificate authority.
[0104] S4. When the certificate authority receives the user's certificate request, the certificate authority and the user jointly execute the obfuscated circuit scheme and the zero-knowledge proof scheme to verify the legitimacy of the certificate request; if the legitimacy verification fails, the user's certificate request is rejected;
[0105] Specifically, the process of step S4 is as follows:
[0106] S401. Assume that the user holds u = (m, M), that is, u is the concatenation of m and M, m, M∈Z q , the certificate authority randomly selects two integers a, b∈Z with bit lengths n and n+s q and two random numbers r3,r4∈Z used to calculate the commitment q , and calculate the commitment c3=aP2+r3Q2 corresponding to a and the commitment c4=bP2+r4Q2 corresponding to b, and send the commitments c3 and c4 to the user; where n is the bit length of u;
[0107] S402, the certificate authority determines a Boolean circuit F, whose input is u=(m,M), and whose output is (v,t), and the structure of the Boolean circuit F satisfies: the value of v is related to m, M, that is, when M=H0(m), v=1, otherwise v=0; and the value of t is always t=au+b; the certificate authority takes the Boolean circuit F and the security parameter λ as input, and calls the GC.Gen algorithm to generate the obfuscated circuit C corresponding to F, the encoding information e of C, and the decoding information d of C;
[0108] S403: The certificate authority randomly selects two values for each bit in u held by the user. Assume that the random value corresponding to the i-th bit in u is For all i∈[n], the user input (i,u i ), the certificate authority enters Both (i.e. user and certificate authority) jointly run the 2-choice-1 oblivious transfer protocol After executing n rounds of the oblivious transfer protocol After that, the user gets
[0109] S404: The certificate authority sends the generated obfuscated circuit C to the user. The user uses the obfuscated circuit C and the obtained As input, call the GC.Eval algorithm to evaluate the garbled circuit C and get the outputs t′ and v′, that is, The user randomly selects r5∈Z q , calculate the commitment c5=v′P2+r5Q2 corresponding to v′, and send the commitment c5 to the certificate authority, where t′ and v′ are the encoding results of t and v respectively, that is, t′←GC.En(e,t) and v′←GC.En(e,v);
[0110] S405. When the certificate authority receives the commitment c5, it sends the decoding information d of the obfuscated circuit C to the user. After receiving the decoding information d, the user uses it and t′ as the input of the GC.De algorithm and decodes to obtain t, that is, t←GC.De(d,t′). The user randomly selects r6∈Z q , calculate the commitment c6=tP2+r6Q2 corresponding to t, and send the commitment c6 to the certificate authority;
[0111] S406: When the certificate authority receives the commitment c6, the certificate authority generates the random value The random values (a, r3), (b, r4) and Boolean circuit F required to open commitments c3 and c4 are sent to the user; the user receives After (a, r3) and (b, r4), recalculate the commitment c′3=aP2+r3Q2 corresponding to a and the commitment c′4=bP2+r4Q2 corresponding to b, and compare whether c3 and c′3 are equal, and whether c4 and c′4 are equal; if c3≠c′3 or c4≠c′4, abandon the certificate request and no longer interact with the certificate authority;
[0112] S407, if c3 = c'3 and c4 = c'4, the user uses the garbled circuit C, The Boolean circuit F is used to construct the obfuscated circuit C to check whether the certificate authority is honest; if the check fails, the certificate request is abandoned and no longer interacts with the certificate authority; if the check passes, the user sends the random value (v′, r5) required to open the commitment c5 to the certificate authority;
[0113] S408. After receiving the random value (v′, r5), the certificate authority recalculates the commitment c′5=v′P2+r5Q2 corresponding to v′, and compares whether c5 and c′5 are equal; if they are not equal, the certificate authority rejects the user's certificate request and no longer interacts with the user; if they are equal, the certificate authority inputs the obtained v′ and the decoding information d, calls the GC.De algorithm, and decodes to obtain v, that is, v←GC.De(d,v′); if v≠1, the certificate authority rejects the user's certificate request and no longer interacts with the user;
[0114] S409. If v = 1, the user inputs the public reference string crs in the public parameter pp, the evidence w1 = (u, t, r1, r2, r6) = (m, M, t, r1, r2, r6) and the statement st1: c1 = MP2 + r1Q2Λc2 = MP2 + r2Q2∧c6 = tP2 + r6Q2∧t = au + b, calls the ZK.Prove algorithm, and generates the zero-knowledge proof corresponding to the statement st1 Zero-knowledge proof Send to the certificate authority;
[0115] S410: When receiving the zero-knowledge proof sent by the user When the certificate authority sends a zero-knowledge proof The public reference string crs and statement st1 are used as input to call the ZK.Verify algorithm to verify Is it effective? If the output of the ZK.Verify algorithm is 1, the certificate authority accepts the user's certificate request and passes the legitimacy verification; if the output of the ZK.Verify algorithm is 0, the certificate authority rejects the user's certificate request and fails the legitimacy verification.
[0116] S5. If the legitimacy verification is passed, the certificate authority accepts the user's certificate request and interacts with the user to jointly complete the issuance of the certificate and send the authorization certificate to the user;
[0117] Specifically, the process of step S5 is as follows:
[0118] S501, the certificate authority inputs the public parameter pp and its own private key msk, the user inputs the public parameter pp, the specific attribute m and the hash value H0(m) of the specific attribute m, and the two parties jointly run the Cred.Issue algorithm;
[0119] S502: For the certificate authority, the Cred.Issue algorithm receives the public parameter pp and the private key msk of the certificate authority as input, and randomly selects k∈Z q And calculate the element K=kP2 in the cyclic group G2, and send K to the user;
[0120] S503. For the user, the Cred.Issue algorithm receives the public parameter pp, the specific attribute m, the hash value H0(m) of the specific attribute m, and K sent by the certificate authority as input, and randomly selects α∈Z q , and calculate the elements K′=αP2, k″=αK=αkP2=(x1,y1) in the cyclic group G2, calculate r=x1+H0(m)mod q, r′=α -1 r mod q; then calculate the element Z=(αr′-x1)P2 in the cyclic group G2, and finally use the public reference string crs, the statement st2:(αr′-x1)P2=H0(m)P2∧c2=H0(m)P2+r2Q2 and the evidence w2=(α,x1,H0(m),r2) to call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to the statement st2 Right now , and r′, Z, zero-knowledge proof Send to the certificate authority;
[0121] S504: When receiving r′, Z and zero-knowledge proof sent by the user When the certificate authority runs the Cred.Issue algorithm again, it uses the public reference string crs, statement st2 and zero-knowledge proof Call ZK.Verify algorithm to verify Is it effective? If the output of the ZK.Verify algorithm is 1, then the zero-knowledge proof Valid, calculate s′=(1+x) -1 (kr′x)mod q=(1+x) -1(k+r′)-r′mod q, and send s′ to the user; if the output of the ZK.Verify algorithm is 0, then the zero-knowledge proof Invalid, the certificate authority notifies the user to re-execute step S503 to generate a new zero-knowledge proof
[0122] S505. After receiving s′ sent by the certificate authority, the user runs the Cred.Issue algorithm again to calculate s=αs′mod q, and uses r and s as the SM2 signature σ of the certificate authority on the specific attribute m; using the SM2 signature σ and the public key mpk of the certificate authority, call the SM2.Verify algorithm to verify whether the SM2 signature is valid, that is, 0 / 1←SM2.Verify(mpk,σ); if the output of the SM2.Verify algorithm is 1, the SM2 signature σ is valid, and cred=(m,σ)=(m,(r,s)) is used as the authorization certificate for the specific attribute m; if the output of the SM2.Verify algorithm is 0, the SM2 signature σ is invalid, and the user notifies the certificate authority to re-execute step S504 to verify the zero-knowledge proof again
[0123] S6. The user generates an anonymous credential using the authorization certificate, the public parameters of the anonymous credential, and the public key of the certificate authority, and sends the anonymous credential to the service provider;
[0124] Specifically, the process of step S6 is:
[0125] S601, the user runs the Cred.Show algorithm, using the authorization certificate cred, the public parameter pp and the public key mpk of the certificate authority, and randomly selects r7, r8∈Z q , calculate the commitment c7=rP2+r7Q2 corresponding to r, the commitment c8=sP2+r8Q2 corresponding to s, and calculate z=r+s, the element z·mpk=zxP2=(z x , z y ), sP2=(s x ,s y ), where z x 、z y are the horizontal and vertical coordinates of the element z·mpk in the cyclic group G2; s x 、s y are the abscissa and ordinate of the element sP2 in the cyclic group G2 respectively;
[0126] S602, randomly select r9∈Z q ,r 10 ,r 11 ,r 12 ,r 13 ∈Zp , Z p For a finite field modulo a large prime number p, calculate the commitments corresponding to z c9 = zP2 + r9Q2, z x The corresponding commitment c 10 =z x P1+r 10 Q1, z y The corresponding commitment c 11 =z y P1+r 11 Q1, s x The corresponding commitment c 12 =s x P1+r 12 Q1, s y The corresponding commitment c 13 =s y P1+r 13 Q1;
[0127] S603, using the common reference string crs, statement st3: c8 = sP2 + r8Q2 ∧ c 12 =s x P1+r 12 Q1∧c 13 =s y P1+r 13 Q1 and evidence w3=(s,s x ,s y ,r8,r 12 ,r 13 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st3 Right now
[0128] S604, using the common reference string crs, statement st4: c9 = zP2 + r9Q2 ∧ c 10 =z x P1+r 10 Q1∧c 11 =z y P1+r 11 Q1 and evidence w4=(z,z x ,z y ,r9,r 10 ,r 11 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st4 Right now
[0129] S605, using the common reference string crs, statement st5: c7 = rP2 + r7Q2 ∧ c2 = H0(m)P2 + r2Q2 ∧ c 12 =s xP1+r 12 Q1∧c 13 =s y P1+r 13 Q1∧c 10 =z x P1+r 10 Q1∧c 11 =z y P1+r 11 Q1 and evidence w5=(r,H0(m),s x ,s y ,z x ,z y ,r7,r2,r 12 ,r 13 ,r 10 ,r 11 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st5 Right now
[0130] S606. Use the public reference string crs, statement st6: c7 = rP2 + r7Q2 ∧ c8 = sP2 + r8Q2 ∧ c9 = zP2 + r9Q2 ∧ z = r + s and evidence w6 = (r, s, z, r7, r8, r9), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st6 Right now
[0131] S607: Output anonymous credentials
[0132] S7. When the service provider receives the anonymous credential, it verifies the validity of the anonymous credential; if the validity verification is passed, the service provider provides the specific service requested by the user; if the validity verification is not passed, the service request of the user is rejected.
[0133] Specifically, in step S7, when the service provider receives the anonymous credential, the service provider inputs the public parameter pp, the anonymous credential θ presented by the user, and statements st3, st4, st5, and st6, and runs the Cred.Verify algorithm to verify the validity of the anonymous credential, specifically:
[0134] S701, input public reference string crs, statement st3 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0135] S702, input public reference string crs, statement st4 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0136] S703, input public reference string crs, statement st5 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0137] S704, input public reference string crs, statement st6 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective?
[0138] S705, if zero-knowledge proof If any of the verifications fails, the Cred.Verify algorithm outputs 0, indicating that the anonymous credential has not passed the validity verification and the service provider rejects the user's service request;
[0139] S706, if zero-knowledge proof If all are verified, the Cred.Verify algorithm outputs 1, indicating that the anonymous credential passes the validity verification and the service provider provides the specific service requested by the user.
[0140] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.
[0141] Based on the same idea as the anonymous credential method based on the national secret SM2 in the above embodiment, the present invention also provides an anonymous credential system based on the national secret SM2, which can be used to execute the above anonymous credential method based on the national secret SM2. For ease of explanation, the structural diagram of the anonymous credential system embodiment based on the national secret SM2 only shows the parts related to the embodiment of the present invention. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0142] like Figure 2 As shown, another embodiment of the present invention provides an anonymous credential system based on the national secret SM2, including a parameter generation module, a key generation module, a certificate request module, a certificate verification module, a certificate issuance module, a credential generation module and a credential verification module;
[0143] The parameter generation module is used by the certificate authority to select a zero-knowledge proof scheme and a confusion circuit scheme, and generate public parameters of the anonymous credential; the selected zero-knowledge proof scheme, confusion circuit scheme and public parameters of the anonymous credential are made public together;
[0144] The key generation module is used by the certificate authority to generate its own public and private key pair, where the public key is made public and the private key is kept secret;
[0145] The certificate request module is used for generating a certificate request with corresponding attributes by using the public parameters and specific attributes of the anonymous credential and sending it to the certificate authority when the user requests to enjoy a specific service provided by the service provider and meets the specific attribute conditions of the specific service;
[0146] The certificate verification module is used when the certificate authority receives a certificate request from a user. The certificate authority and the user jointly execute the obfuscated circuit scheme and the zero-knowledge proof scheme to verify the legitimacy of the certificate request. If the legitimacy verification fails, the user's certificate request is rejected.
[0147] The certificate issuance module is used to accept the user's certificate request and interact with the user if the legitimacy verification is passed, and jointly complete the certificate issuance and send the authorization certificate to the user;
[0148] The credential generation module is used for the user to generate an anonymous credential using the authorization certificate, the public parameters of the anonymous credential and the public key of the certificate authority, and send the anonymous credential to the service provider;
[0149] The credential verification module is used by the service provider to verify the validity of the anonymous credential when the service provider receives it; if the validity verification passes, the service provider provides the specific service requested by the user; if the validity verification fails, the service request of the user is rejected.
[0150] It should be noted that the anonymous credential system based on the national secret SM2 of the present invention corresponds one-to-one to the anonymous credential method based on the national secret SM2 of the present invention. The technical features and beneficial effects described in the above-mentioned embodiment of the anonymous credential method based on the national secret SM2 are applicable to the embodiment of the anonymous credential system based on the national secret SM2. For specific contents, please refer to the description in the embodiment of the method of the present invention, which will not be repeated here. This is hereby declared.
[0151] In addition, in the implementation of the anonymous credential system based on the national secret SM2 in the above-mentioned embodiment, the logical division of each program module is only an example. In actual application, the above-mentioned functions can be assigned to different program modules as needed, for example, for the configuration requirements of the corresponding hardware or the convenience of software implementation. That is, the internal structure of the anonymous credential system based on the national secret SM2 is divided into different program modules to complete all or part of the functions described above.
[0152] like Figure 3 As shown, in one embodiment, a computer-readable storage medium is provided, which stores a program in a memory, and when the program is executed by a processor, the anonymous credential method based on the national secret SM2 is implemented, specifically:
[0153] The certificate authority selects a zero-knowledge proof scheme and a garbled circuit scheme, and generates public parameters of the anonymous credential; and makes the selected zero-knowledge proof scheme, garbled circuit scheme, and public parameters of the anonymous credential public;
[0154] The certificate authority generates its own public-private key pair, where the public key is made public and the private key is kept secret;
[0155] When a user requests a specific service provided by a service provider and meets the specific attribute conditions of the specific service, the user generates a certificate request with the corresponding attributes using the public parameters and specific attributes of the anonymous credential and sends it to the certificate authority;
[0156] When the certificate authority receives a user's certificate request, the certificate authority and the user jointly execute the obfuscated circuit scheme and the zero-knowledge proof scheme to verify the legitimacy of the certificate request; if the legitimacy verification fails, the user's certificate request is rejected;
[0157] If the legitimacy verification is passed, the certificate authority will accept the user's certificate request and interact with the user to jointly complete the issuance of the certificate and send the authorization certificate to the user;
[0158] The user generates an anonymous credential using the authorization certificate, the public parameters of the anonymous credential, and the public key of the certificate authority, and sends the anonymous credential to the service provider;
[0159] When the service provider receives the anonymous credential, it verifies the validity of the anonymous credential; if the validity verification is passed, the service provider provides the specific service requested by the user; if the validity verification is not passed, the service request of the user is rejected.
[0160] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0161] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0162] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. An anonymous credential method based on the national secret SM2, characterized in that: The steps include: The certificate authority selects a zero-knowledge proof scheme and a garbled circuit scheme, and generates public parameters of the anonymous credential; and makes the selected zero-knowledge proof scheme, garbled circuit scheme, and public parameters of the anonymous credential public; The certificate authority generates its own public-private key pair, where the public key is made public and the private key is kept secret; When a user requests a specific service provided by a service provider and meets the specific attribute conditions of the specific service, the user generates a certificate request with the corresponding attributes using the public parameters and specific attributes of the anonymous credential and sends it to the certificate authority; When the certificate authority receives a certificate request from a user, the certificate authority and the user jointly execute the obfuscated circuit scheme and the zero-knowledge proof scheme to verify the legitimacy of the certificate request; If the legitimacy verification fails, the user's certificate request will be rejected; If the legitimacy verification is passed, the certificate authority will accept the user's certificate request and interact with the user to jointly complete the issuance of the certificate and send the authorization certificate to the user; The user generates an anonymous credential using the authorization certificate, the public parameters of the anonymous credential, and the public key of the certificate authority, and sends the anonymous credential to the service provider; When the service provider receives the anonymous credential, it verifies the validity of the anonymous credential; if the validity verification is passed, the service provider provides the specific service requested by the user; if the validity verification is not passed, the service request of the user is rejected.
2. The anonymous credential method based on the national secret SM2 according to claim 1 is characterized in that: The certificate authority selects a zero-knowledge proof scheme and a garbled circuit scheme, and generates public parameters for anonymous credentials, specifically: The certificate authority selects a zero-knowledge proof scheme ZK = (ZK.Setup, ZK.Prove, ZK.Verify) for zero-knowledge proof of algebraic statements, and selects a security parameter λ1; where ZK.Setup is the initialization algorithm of ZK, inputs the security parameter λ1, and outputs the public reference string crs, that is, ZK.Prove is the proof algorithm of ZK. It takes as input the public reference string crs, statement st and evidence w, and outputs proof π, i.e., π←ZK.Prove(crs, st, w); ZK.Verify is the verification algorithm of ZK. It takes as input the public reference string crs, statement st and proof π, and verifies whether the proof is valid. If the proof is valid, it returns 1, otherwise it returns 0, i.e., 0 / 1←ZK.Verify(crs, st, π); The certificate authority selects a garbled circuit scheme GC = (GC.Gen, GC.En, GC.De, GC.Eval) for zero-knowledge proof of non-algebraic statements, and selects a security parameter λ2; where GC.Gen is the generation algorithm of GC, which inputs the security parameter λ2 and a description of a Boolean circuit F, and outputs the corresponding garbled circuit C, the encoding information e of C, and the decoding information d of C, that is, GC.En is the encoding algorithm of GC. It inputs the encoding information e of the garbled circuit C and the input x of the Boolean circuit F, and outputs the garbled input x′ corresponding to x, that is, x′←GC.En(e, x); GC.Eval is the evaluation algorithm of GC. It inputs the garbled circuit C and the garbled input x′, and outputs the encoded evaluation result y′, that is, y′←GC.Eval(C, x′); GC.De is the decoding algorithm of GC. It inputs the encoded evaluation result y′ and the decoding information d, and outputs the decoded evaluation result y, that is, y←GC.De(d, y′); The certificate authority runs the Cred.Setup algorithm, selects a security parameter λ3 as input, and calls the SM2.Setup algorithm to generate the public parameters of the SM2 digital signature scheme. Right now Among them, p and q are two different large prime numbers, G1 and G2 are cyclic groups of order p and order q respectively, P1 and Q1 are two different generators of cyclic group G1, P2 and Q2 are two different generators of cyclic group G2, and H0 is a hash function The public parameters of the SM2 digital signature scheme The public reference string crs in the zero-knowledge proof scheme ZK is concatenated as the public parameter of the anonymous credential. The certificate authority will make public the public parameters pp, the selected zero-knowledge proof scheme ZK, the confusion circuit scheme GC and the security parameters λ1, λ2 and λ3.
3. The anonymous credential method based on the national secret SM2 according to claim 2 is characterized in that: The certificate authority generates its own public and private key pair, specifically: The certificate authority runs the Cred.KeyGen algorithm, takes the public parameter pp of the anonymous credential as input, and calls the SM2.KeyGen algorithm to generate a public-private key pair (mpk, msk) = (xP2, x), that is: Among them, x is from group Z q We randomly select from the group Z q is a finite field modulo a large prime number q; xP2 represents x times the generator P2 in the cyclic group G2; The public key mpk is made public and the private key msk is kept secret.
4. The anonymous credential method based on the national secret SM2 according to claim 3 is characterized in that: The user generates a certificate request with corresponding attributes using the public parameters and specific attributes of the anonymous credential, specifically: The user runs the Cred.Request algorithm, passing in the public parameters pp and specific attributes m∈Z of the anonymous credential. q , randomly select r1,r2∈Z q , calculate the commitment c1=mP2+r1Q2 corresponding to the specific attribute m, and the commitment c2=H0(m)P2+r2Q2 corresponding to the hash value H0(m) of the specific attribute m; The commitments c1 and c2 are used as a certificate request for a specific attribute m, i.e., req = (c1, c2), and sent to a certificate authority.
5. The anonymous credential method based on the national secret SM2 according to claim 4 is characterized in that: The verification of the legitimacy of the certificate request is specifically as follows: Assume that the user holds u = (m, M), m, M∈Z q ; The certificate authority randomly selects two integers a, b∈Z with bit lengths n and n+s. q and two random numbers r3,r4∈Z for computing the commitment q , and calculate the commitment c3=aP2+r3Q2 corresponding to a and the commitment c4=bP2+r4Q2 corresponding to b, and send the commitments c3 and c4 to the user; where n is the bit length of u; The certificate authority determines a Boolean circuit F, whose input is u=(m, M) and output is (v, t), and the structure of the Boolean circuit F satisfies: the value of v is related to m and M, that is, when M=H0(m), v=1, otherwise v=0; and the value of t is always t=au+b; the certificate authority takes the Boolean circuit F and the security parameter λ2 as input, and calls the GC.Gen algorithm to generate the obfuscated circuit C corresponding to F, the encoding information e of C, and the decoding information d of C; The certificate authority randomly selects two values for each bit in the user's u. Assume that the random value corresponding to the i-th bit in u is For all i∈[n], the user input (i, u i ), the certificate authority enters Both run the 2-choose-1 oblivious transfer protocol together After executing n rounds of the oblivious transfer protocol After that, the user gets The certificate authority sends the generated obfuscated circuit C to the user, and the user uses the obfuscated circuit C and the obtained As input, call the GC.Eval algorithm to evaluate the garbled circuit C and get the outputs t′ and v′, that is, The user randomly selects r5∈Z q , calculate the commitment c5=v′P2+r5Q2 corresponding to v′, and send the commitment c5 to the certificate authority, where t′ and v′ are the encoding results of t and v respectively, that is, t′←GC.En(e, t) and v′←GC.En(e, v); When the certificate authority receives the commitment c5, it sends the decoded information d of the obfuscated circuit C to the user. After receiving the decoded information d, the user uses it and t′ as the input of the GC.De algorithm and decodes to get t. The user randomly selects r6∈Z q , calculate the commitment c6=tP2+r6Q2 corresponding to t, and send the commitment c6 to the certificate authority; When the certificate authority receives the commitment c6, the certificate authority will generate a random value The random values (a, r3), (b, r4) and Boolean circuit F required to open commitments c3 and c4 are sent to the user; the user receives After (a, r3) and (b, r4), recalculate the commitment c′3=aP2+r3Q2 corresponding to a and the commitment c′4=bP2+r4Q2 corresponding to b, and compare whether c3 and c′3 are equal, and whether c4 and c′4 are equal; if c3≠c′3 or c4≠c′4, abandon the certificate request and no longer interact with the certificate authority; If c3=c′3 and c4=c′4, then the user uses the garbled circuit C, and Boolean circuit F, to construct a confusion circuit C to check whether the certificate authority is honest; if the check fails, the certificate request is abandoned and no longer interacts with the certificate authority; if the check passes, the user sends the random value (v′, r5) required to open the commitment c5 to the certificate authority; After receiving the random value (v′, r5), the certificate authority recalculates the commitment c′5=v′P2+r5Q2 corresponding to v′, and compares whether c5 and c′5 are equal; if they are not equal, the certificate authority rejects the user's certificate request and no longer interacts with the user; if they are equal, the certificate authority inputs the obtained v′ and the decoding information d, calls the GC.De algorithm, and decodes to obtain v; if v≠1, the certificate authority rejects the user's certificate request and no longer interacts with the user; If v = 1, the user inputs the public reference string crs in the public parameter pp, the evidence w1 = (u, t, r1, r2, r6) = (m, M, t, r1, r2, r6) and the statement st1: c1 = mP2 + r1Q2 ∧ c2 = MP2 + r2Q2 ∧ c6 = tP2 + r6Q2 ∧ t = au + b, calls the ZK.Prove algorithm, and generates the zero-knowledge proof corresponding to the statement st1 Zero-knowledge proof Send to the certificate authority; When receiving the zero-knowledge proof sent by the user When the certificate authority sends a zero-knowledge proof The public reference string crs and statement st1 are used as input to call the ZK.Verify algorithm to verify Is it valid? If the output of the ZK.Verify algorithm is 1, the certificate authority accepts the user's certificate request and passes the legitimacy verification; if the output of the ZK.Verify algorithm is 0, the certificate authority rejects the user's certificate request and fails the legitimacy verification.
6. The anonymous credential method based on the national secret SM2 according to claim 5 is characterized in that: The issuance of the joint completion certificate is specifically as follows: The certificate authority inputs the public parameter pp and its own private key msk, and the user inputs the public parameter pp, the specific attribute m, and the hash value H0(m) of the specific attribute m, and the two parties jointly run the Cred.Issue algorithm; For the certificate authority, the Cred.Isue algorithm receives the public parameter pp and the private key msk of the certificate authority as input and randomly selects k∈Z q And calculate the element K=kP2 in the cyclic group G2, and send K to the user; For the user, the Cred.Issue algorithm receives the public parameter pp, the specific attribute m, the hash value H0(m) of the specific attribute m, and K sent by the certificate authority as input, and randomly selects α∈Z q , and calculate the elements K′=αP2, K″=αK=αkP2=(x1,y1) in the cyclic group G2, calculate r=x1+H0(m)mod q, r′=α -1 r mod q, then calculate the element Z=(αr′-x1)P2 in the cyclic group G2, and finally use the public reference string crs, statement st2: (αr′-x1)P2=H0(m)P2∧c2=H0(m)P2+r2Q2 and evidence w2=(α,x1,H0(m),r2) to call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st2 And r′, Z, zero-knowledge proof Send to the certificate authority; When receiving r′, Z and zero-knowledge proof sent by the user When the certificate authority's Cred.Issue algorithm uses the public reference string crs, statement st2 and zero-knowledge proof Call ZK.Verify algorithm to verify Is it valid? If the output of the ZK.Verify algorithm is 1, then the zero-knowledge proof Valid, calculate s′=(1+x) -1 (kr′x)mod q=(1+x) -1 (k+r′)-r′mod q, and send s′ to the user; if the output of the ZK.Verify algorithm is 0, then the zero-knowledge proof Invalid, the certificate authority notifies the user to regenerate the zero-knowledge certificate After receiving s′ from the certificate authority, the user's Cred.Issue algorithm calculates s=αs′mod q, and uses r and s as the SM2 signature σ of the certificate authority on the specific attribute m; using the SM2 signature σ and the public key mpk of the certificate authority, the SM2.Verify algorithm is called to verify whether the SM2 signature is valid. If the output of the SM2.Verify algorithm is 1, the SM2 signature σ is valid, and cred=(m, σ)=(m, (r, s)) is used as the authorization certificate for the specific attribute m; If the output of the SM2.Verify algorithm is 0, the SM2 signature σ is invalid, and the user notifies the certificate authority to re-verify the zero-knowledge proof 7. The anonymous credential method based on the national secret SM2 according to claim 6 is characterized in that: The generating of anonymous credentials is specifically as follows: The user runs the Cred.Show algorithm, using the authorization certificate cred, public parameters pp and the public key mpk of the certificate authority, and randomly selects r7, r8∈Z q , calculate the commitment c7=rP2+r7Q2 corresponding to r, the commitment c8=sP2+r8Q2 corresponding to s, and calculate z=r+s, the element z·mpk=zxP2=(z x , z y ), sP2=(s x ,s y ), where z x 、z y are the horizontal and vertical coordinates of the element z·mpk in the cyclic group G2; s x 、s y are the abscissa and ordinate of the element sP2 in the cyclic group G2 respectively; Randomly select r9∈Z q , r 10 , r 11 , r 12 , r 13 ∈Z p , Z p For a finite field modulo a large prime number p, calculate the commitments corresponding to z c9 = zP2 + r9Q2, z x The corresponding commitment c 10 =z x P1+r 10 Q1, z y The corresponding commitment c 11 =z y P1+r 11 Q1, s x The corresponding commitment c 12 =s x P1+r 12 Q1, s y The corresponding commitment c 13 =s y P1+r 13 Q1; Using the common reference string crs, statement st3: c8 = sP2 + r8Q2 ∧ c 12 =s x P1+r 12 Q1∧c 13 =s y P1+r 13 Q1 and evidence w3 = (s, s x ,s y ,r8,r 12 , r 13 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st3 Using the common reference string crs, statement st4: c9 = zP2 + r9Q2 ∧ c 10 =z x P1+r 10 Q1∧c 11 =z y P1+r 11 Q1 and evidence w4 = (z, z x , z y ,r9,r 10 , r 11 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st4 Using the common reference string crs, statement st5: c7 = rP2 + r7Q2 ∧ c2 = H0(m)P2 + r2Q2 ∧ c 12 =s x P1+r 12 Q1∧c 13 =s y P1+r 13 Q1∧c 10 =z x P1+r 10 Q1∧c 11 =z y P1+r 11 Q1 and evidence w5 = (r, H0(m), s x ,s y , z x , z y , r7, r2, r 12 , r 13 , r 10 , r 11 ), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st5 Using the public reference string crs, statement st6: c7 = rP2 + r7Q2 ∧ c8 = sP2 + r8Q2 ∧ c9 = zP2 + r9Q2 ∧ z = r + s and evidence w6 = (r, s, z, r7, r8, r9), call the ZK.Prove algorithm to generate the zero-knowledge proof corresponding to statement st6 Output anonymous credentials 8. The anonymous credential method based on the national secret SM2 according to claim 7 is characterized in that: When the service provider receives the anonymous credential, the service provider inputs the public parameter pp, the anonymous credential θ presented by the user, and statements st3, st4, st5, and st6, and runs the Cred.Verify algorithm to verify the validity of the anonymous credential, specifically: Input public reference string crs, statement st3 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective? Input public reference string crs, statement st4 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective? Input public reference string crs, statement st5 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective? Input public reference string crs, statement st6 and zero-knowledge proof Call the ZK.Verify algorithm to verify the zero-knowledge proof Is it effective? If zero-knowledge proof If any of the verifications fails, the Cred.Verify algorithm outputs 0, indicating that the anonymous credential has not passed the validity verification and the service provider rejects the user's service request; If zero-knowledge proof If all are verified, the Cred.Verify algorithm outputs 1, indicating that the anonymous credential passes the validity verification and the service provider provides the specific service requested by the user.
9. An anonymous credential system based on the national secret SM2, characterized by: The anonymous credential method based on the national secret SM2 applied to any one of claims 1-8 comprises a parameter generation module, a key generation module, a certificate request module, a certificate verification module, a certificate issuance module, a credential generation module and a credential verification module; The parameter generation module is used for the certificate authority to select a zero-knowledge proof scheme and a confusion circuit scheme, and generate public parameters of the anonymous credential; the selected zero-knowledge proof scheme, confusion circuit scheme and public parameters of the anonymous credential are made public together; The key generation module is used by the certificate authority to generate its own public and private key pair, where the public key is made public and the private key is kept secret; The certificate request module is used for generating a certificate request with corresponding attributes by using public parameters and specific attributes of anonymous credentials and sending it to the certificate authority when the user requests to enjoy a specific service provided by the service provider and meets the specific attribute conditions of the specific service; The certificate verification module is used when the certificate authority receives a certificate request from a user, and the certificate authority and the user jointly execute the obfuscated circuit scheme and the zero-knowledge proof scheme to verify the legitimacy of the certificate request; If the legitimacy verification fails, the user's certificate request will be rejected; The certificate issuance module is used to, if the legitimacy verification is passed, the certificate authority accepts the user's certificate request and interacts with the user to jointly complete the issuance of the certificate and send the authorization certificate to the user; The credential generation module is used for the user to generate an anonymous credential using the authorization certificate, the public parameters of the anonymous credential and the public key of the certificate authority, and send the anonymous credential to the service provider; The credential verification module is used for verifying the validity of the anonymous credential when the service provider receives the anonymous credential; if the validity verification is passed, the service provider provides the specific service requested by the user; if the validity verification is not passed, the service request of the user is rejected.
10. A computer-readable storage medium storing a program, characterized in that: When the program is executed by the processor, the anonymous credential method based on the national secret SM2 described in any one of claims 1-8 is implemented.
