CN112367175A - 基于sm2数字签名的隐式证书密钥生成方法 - Google Patents
基于sm2数字签名的隐式证书密钥生成方法 Download PDFInfo
- Publication number
- CN112367175A CN112367175A CN202011259622.8A CN202011259622A CN112367175A CN 112367175 A CN112367175 A CN 112367175A CN 202011259622 A CN202011259622 A CN 202011259622A CN 112367175 A CN112367175 A CN 112367175A
- Authority
- CN
- China
- Prior art keywords
- public key
- certificate
- user
- key
- applying
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3263—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements
- H04L9/3268—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements using certificate validation, registration, distribution or revocation, e.g. certificate revocation list [CRL]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/30—Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
- H04L9/3066—Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
- H04L9/3239—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
- H04L9/3242—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving keyed hash functions, e.g. message authentication codes [MACs], CBC-MAC or HMAC
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3247—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3247—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
- H04L9/3249—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures using RSA or related signature schemes, e.g. Rabin scheme
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3263—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Algebra (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Mathematical Physics (AREA)
- Pure & Applied Mathematics (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Power Engineering (AREA)
- Storage Device Security (AREA)
Abstract
本发明公开了一种基于SM2数字签名的隐式证书密钥生成方法,主要解决现有技术在公钥密码体制中无法将用户身份与用户公钥相对应的问题。其方案是:按照标准密码算法SM2设置系统参数并初始化;证书颁发机构CA生成密钥对并将公钥PCA发送给申请证书的用户usr;申请证书的用户生成临时密钥对并将自己的身份标识IDA和临时公钥X发给证书颁发机构CA;CA生成隐式证书cert和签名s,并将cert和s发送给申请证书的用户;该用户生成完整公钥U后对该完整公钥U和签名s进行验证,获得完整公私钥对(u,U)。本发明符合国密SM2签名算法标准,运算效率高,带宽开销短,降低了中间人替换公钥的风险,可用于资源受限的物联网环境。
Description
技术领域
本发明属于信息安全技术领域,特别是涉及一种隐式证书密钥生成方法,可用于资源受限的物联网环境,统一用户身份与用户公钥的关系,实现公钥认证。
背景技术
在公钥密码体制中,一个用户均有公钥和私钥这两个密钥,其中,公钥是公开给任何人的,任何人只要获得了公钥,就可以使用公钥对消息加密,随后可以通过公开信道将加密后的密文发送给接受者。只有拥有公钥所对应私钥的接受者才能够正确地解密密文,恢复出明文信息。典型的公钥加密体制有RSA体制,ELGamal体制,以及具有很高安全性的Gramer-Shoup体制。
这类密码体制存在一个关键的问题就是,每个用户的公钥都是一串类似随机数的无意义的字符,在加密的时候,加密者无法知道加密所用的公钥是否是接收者的。如果加密过程中公钥使用错误,密文就不能被接收者正确地解密。同时,这很有可能就将信息透漏给了错误的用户,甚至透漏给恶意用户。现实中由于存在恶意用户欺骗加密者,将接收者的公钥替换为自己的公钥并告知加密者,同时加密者无法得知收到的公钥是否为接收者的情况,因而各个用户如何安全地公开自己的公钥,避免可能引起混乱或中间人替换公钥攻击的风险是公钥密码体质需要解决的关键问题之一。
为了应对公钥密码机制面临的中间人替换公钥攻击的风险,需要将用户的身份和用户的公钥对应起来,目前有三类主要的解决方案。
第一种方案:采用显式证书机制实现用户身份和用户公钥之间的安全对应。例如X.509证书协议,该方案的证书机制采用公钥基础设施PKI技术,它综合使用了数字摘要技术、数字签名这些密码技术以及一套完整的证书管理机制来提供安全服务。系统建设有公信力的认证中心CA,用于鉴定用户身份,并为用户签发数字证书,数字证书安全地将用户身份和用户密钥绑定在一起。用户在业务系统中先交换证书,再使用公私钥完成用户的身份认证、访问控制、信息安全传递等操作。但加密操作过程中数据发送方需要预先获得接收方证书,进而获取加密公钥,相关过程较为复杂。因此,目前证书系统广泛用于提供数字签名服务,实现身份认证、数据一致性保护等。为了进一步降低证书管理的复杂性,目前还有一些轻量级的证书管理协议,如简单证书注册协议SCEP来降低证书注册等流程的复杂性。
第二种方案:基于标识的密码技术IBC。为了降低公钥系统中密钥管理和使用的复杂性,Shamir在1984年提出了基于标识的密码机制。在这种系统中,用户的标识可以用做用户的公钥,更加准确地说是用户的公钥可以通过从用户的标识和标识密码算法规定的一个方法计算得出。在这种情况下,用户不需要申请和交换证书,而是直接使用标识进行密码运算,从而解决公钥真实性问题,极大地简化了密钥系统管理的复杂性。这类系统中用户的私钥由系统中的一受信任的第三方即密钥生成中心KGC使用标识私钥生成算法计算生成。这样的系统具有天然的密码委托功能,特别适合于对数据恢复有需求的应用环境。另外这类基于标识的密码系统相较于传统PKI具有巨大的灵活性、扩展性、简洁性。因为系统加密过程直接使用应用涉及的标识作为公钥,无需分发、查询证书、无需申请策略证书等,充分体现了加密操作的便捷性。应用系统涉及的标识只要具有唯一性特征就可以直接作为公钥进行密码应用。这些标识可以具有任意的格式、属性,可以是常用的用户标识如邮件地址、手机号码、身份证号码;在物联网中可以是设备标识、Handle码、OID等;还可以是数据安全控制策略的形式化编码、生物特征信息、甚至是标识属性集等,特别适合基于标识、基于属性的权限访问控制和数据安全保护。在密码运算中直接使用这类标识作为公钥运算,无需进行证书申请、无需额外的实体标识与公钥间的映射管理,充分体现了标识密钥的灵活性。但是IBC本身的问题是:身份虽然是一个有意义的字符串,但是如果加密时候身份信息输入错误,也可能导致接收者解密失败。另一个问题是效率问题,目前的IBC方案基本都是基于双线性群Bilinear Group,而双线性群的乘法和指数运算实际上是比较慢的,不能满足资源受限的物联网环境对密码技术较高运算速率的要求。
第三种方案:隐式证书密码体制Implicit Certificate。其隐式证书密码系统由Girault在1991年提出的自认证公钥机制发展起来的。这种密码体制介于传统PKI和标识密码技术之间。其中常用的隐式证书协议为ECQV隐式证书。该隐式证书系统中用户生成部分公钥,再把这部分公钥和用户标识提交到CA中心,在CA计算生成用户的公钥重建数据后进行签发证书,最后进行签名。用户的完整公钥是由用户的标识、公钥重建数据、CA的主公钥通过指定的算法计算得出。这种隐式证书的优势是上述密钥生成过程生成的用户私钥和还原的用户公钥与标准RSA、ECC算法的密钥对形式相同,因此理论上可以结合标准算法进行使用。与传统的显示证书相比,隐式证书不明确包含用户的公钥或CA的签名,而仅包含绑定到用户的公钥重建数据,验证签名者公钥有效性的过程与签名本身的验证相结合。因此,隐式证书减少了认证公钥密码所需的信息量,降低了通信开销,非常适用于资源受限的物联网环境的公钥认证应用。但是,ECQV隐式证书协议存在证书误绑定攻击,在运算速率方面也无法通过预计算和存储数据操作来加速ECQV隐式证书协议中用户公钥的生成。
发明内容
本发明的目的在于针对上述第三种方案的不足,提出一种基于SM2数字签名的隐式证书密钥生成方法,以避免ECQV隐式证书中的误绑定攻击,通过预计算和存储数据操作加速隐式证书协议中用户公钥的验证。
本发明的技术方案是这样实现的:
随着密码技术和计算机技术的发展,常用的1024位RSA算法面临严重的威胁,国家密码管理局组织制定并于2010年12月17日发布了SM2椭圆曲线密码算法标准。SM2算法包含数字签名、密钥交换、加密算法三个部分,与RSA算法相比密码复杂度高、处理速度快、机器性能消耗更小,现已广泛应用于商用系统中,成为商用密码体系标准之一。公钥认证是任何依赖于公私钥对进行数字签名,密钥交换和非对称加密的安全系统的基石。本发明是使用SM2的数字签名算法与隐式证书相结合来生成一个经过公钥认证的公私钥对,其实现步骤包括如下:
(1)系统参数初始化,并通过证书颁发机构CA生成主密钥对:
(1a)按国家密码局认定的国产密码算法SM2标准设置如下参数:
设椭圆曲线方程E为y2=x3+ax+b,并设椭圆曲线方程E上的阶为n的基点G=(xG,yG),其中a、b∈Fq,Fq是阶为q的有限域,xG、yG分别为基点的横坐标和纵坐标;
选取消息摘要长度为256比特的密码杂凑算法Hash()为密码散列函数SM3;
(1b)证书颁发机构CA用随机数发生器产生随机数dCA∈[1,n-1]作为私钥,并将私钥dCA与基点G在椭圆曲线E上的乘积PCA作为公钥:PCA=dCA·G;
(2)用户usr用随机数发生器产生随机数x∈[1,n-1]作为临时私钥,用临时私钥x与基点G在椭圆曲线E上的乘积X作为临时公钥:X=x·G,并将自己的身份标识IDA和临时公钥X发送给证书颁发机构CA;
(3)证书颁发机构CA生成隐式证书cert和签名s:
(3a)证书颁发机构CA用随机数发生器产生随机数随k∈[1,n-1],并计算公钥重建数据:V=X+k·G=(x1,y1),其中x1和y1为公钥重建数据V的横坐标和纵坐标;
(3b)证书颁发机构CA根据公钥重建数据V生成可信的隐式证书:cert={V,meta},其中,meta为包含用户身份信息、CA系统信息和待签名消息的元数据,即meta=ZA||M;ZA=Hash(ENTLA||IDA||a||b||xG||yG||xCA||yCA),其中ENTLA是由用户usr的身份标识IDA的长度转换而成的两个字节,a为椭圆曲线方程E中变量x的系数,b为椭圆曲线方程E中的常数项,xG,yG分别为基点G的横坐标和纵坐标,xCA,yCA分别为系统公钥PCA的横坐标和纵坐标;M为待签名的消息;
(3c)证书颁发机构CA使用密码散列函数SM3计算隐式证书cert和公钥PCA连接值的哈希值h:h=Hash(cert,PCA),并利用私钥dCA通过SM2数字签名算法得到对隐式证书cert的签名:s=(1+dCA)-1(k-r·dCA)mod n,其中r=(h+x1)mod n,mod n表示模n运算;
(3d)将隐式证书cert和签名s发送给用户usr;
(4)用户生成完整公钥U,并对该完整公钥U和签名s进行验证,获得完整公私钥对:
(4a)用户usr使用密码散列函数SM3计算隐式证书cert与公钥PCA相连接的哈希值:h=Hash(cert,PCA);
(4b)用户usr根据其计算的哈希值h计算中间值:r=(h+x1)mod n,并检验r∈[1,n-1],s∈[1,n-1]是否成立:若成立,则用户usr计算完整私钥:u=(x+s)mod n,否则,退出验证过程,其中x是usr的临时私钥;
(4c)用户usr根据完整私钥u生成完整公钥:U=u·G,并计算公钥重建数据V与公钥PCA在椭圆曲线E上t倍的差值:Q=V-t·PCA,其中t=(r+s)mod n;
(4d)用户usr验证U与Q是否相等:若相等,则将(u,U)作为用户的完整公私钥对参数并保存,结束验证,否则,验证失败。
本发明与现有技术相比,具有如下优点:
1.本发明由于将预期的验证公钥PCA包括在哈希计算中,避免了证书误绑定攻击。
2.本发明由于在证书颁发机构CA向用户usr传递的参数cert中只包含了公钥重建数据V和元数据meta,而没有包含明显可用的用户公钥和CA的签名,减少了通信开销。
3.本发明证书颁发机构CA的公钥PCA由于是固定的,故可通过预计算和数据存储加速在椭圆曲线E上进行t·PCA的计算,从而加速用户公钥的验证。
4.本发明由于是基于椭圆曲线密码算法标准SM2的数字签名算法生成密钥对,所以可以用于SM2标准下的密钥交换算法和加密算法,而且适用于使用密钥对的其他椭圆曲线密码算法。
附图说明
图1为本发明的实现流程图。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
参照图1,本发明的实现步骤如下:
步骤1,系统参数初始化。
本实例的系统参数按国家密码局认定的国产密码算法SM2标准设置,其设置如下:
1.1)设Fq是阶为q的有限域,其中q是一个奇素数或者是2的方幂,当q是奇素数p时,要求p>2191;当q是2的方幂2m时,要求m>192且为素数;
1.2)选取椭圆曲线方程E为y2=x3+ax+b,其中a、b∈Fq;
1.3)设有限域Fq上椭圆曲线方程E的所有的有理点和无穷远点O组成的集合为E(Fq);
1.4)设E上的阶为n的基点G=(xG,yG),其中xG、yG分别为基点的横坐标和纵坐标;
1.5)选取消息摘要长度为256比特的密码杂凑算法Hash()为密码散列函数SM3;
所述密码散列函数SM3,是中国采用的一种密码散列函数标准,由国家密码管理局于2010年12月17日发布,SM3规定可将消息经过填充和迭代压缩操作生成256比特长度的消息摘要,在商用密码体系中主要用于数字签名及验证、消息认证码生成及验证、随机数生成等,其安全性及效率与SHA-256相当。
步骤2,证书颁发机构CA生成主密钥对。
2.1)证书颁发机构CA用随机数发生器产生第一随机数dCA∈[1,n-1]作为私钥;
2.2)证书颁发机构CA将私钥dCA与基点G在椭圆曲线E上的乘积PCA作为公钥:PCA=dCA·G;
2.3)证书颁发机构CA将(dCA,PCA)作为公私钥对参数进行本地保存,并将公钥PCA发给申请证书的用户usr;
步骤3,申请证书的用户usr生成临时密钥对。
3.1)申请证书的用户usr用随机数发生器产生随机数x∈[1,n-1]作为临时私钥,用临时私钥x与基点G在椭圆曲线E上的乘积X作为临时公钥:X=x·G;
3.2)申请证书的用户usr将(x,X)作为临时密钥对参数保存并将自己的身份标识IDA和临时公钥X发送给证书颁发机构CA。
步骤4,证书颁发机构CA生成隐式证书cert和签名s。
4.1)证书颁发机构CA用随机数发生器产生第二随机数k∈[1,n-1];
4.2)证书颁发机构CA根据产生的第二随机数k与基点G在椭圆曲线E上的乘积和申请证书用户usr的临时公钥X计算公钥重建数据V:
V=X+k·G=(x1,y1),
其中x1和y1为公钥重建数据V的横坐标和纵坐标;
4.3)证书颁发机构CA根据公钥重建数据V生成可信的隐式证书:
cert={V,meta},其中,meta为包含用户身份信息、CA系统信息和待签名消息的元数据,即meta=ZA||M;ZA=Hash(ENTLA||IDA||a||b||xG||yG||xCA||yCA),式中ENTLA是由用户usr的身份标识IDA的长度转换而成的两个字节,a为椭圆曲线方程E中变量x的系数,b为椭圆曲线方程E中的常数项,xG,yG分别为基点G的横坐标和纵坐标,xCA,yCA分别为系统公钥PCA的横坐标和纵坐标;M为待签名的消息;
4.4)证书颁发机构CA使用密码散列函数SM3计算隐式证书cert和公钥PCA连接值的哈希值h:h=Hash(cert,PCA);
4.5)证书颁发机构CA利用私钥dCA通过SM2数字签名算法对隐式证书cert进行签名:
所述SM2数字签名算法包括签名和验证两个部分,签名是发送方将消息通过散列函数SM3得到第一消息摘要,再用发送方的私钥将第一消息摘要加密得到签名值与消息一起传给接收方;验证是接收方用发送方的公钥解密签名值得到第一消息摘要,再将收到的消息通过散列函数SM3得到第二消息摘要;比较第一消息摘要与第二消息摘要的值是否相等,如果相等则通过验证,否则验证失败。
SM2数字签名算法的功能包括保证了消息传输的完整性、发送方的身份认证、防止交易中的抵赖发生,通过该算法得到对隐式证书cert的签名s如下:
s=(1+dCA)-1(k-r·dCA)mod n,
其中r=(h+x1)mod n,mod n表示模n运算;
4.6)证书颁发机构CA将隐式证书cert和签名s发送给申请证书的用户usr。
步骤5,申请证书的用户生成完整公钥U,并对该完整公钥U和签名s进行验证,获得完整公私钥对。
5.1)申请证书的用户usr使用密码散列函数SM3重新计算隐式证书cert与公钥PCA相连接的哈希值:h=Hash(cert,PCA);
5.2)申请证书的用户usr根据其计算的哈希值h重新计算中间值:r=(h+x1)modn,并检验r∈[1,n-1],s∈[1,n-1]是否成立:若成立,则执行5.3),否则,退出验证过程;
5.3)申请证书的用户usr计算完整私钥:u=(x+s)mod n,其中,x是申请证书的用户usr的临时私钥,签名s作为申请证书用户的私钥构建数据使用;
5.4)申请证书的用户usr根据完整私钥u生成完整公钥:U=u·G;
5.5)申请证书的用户usr计算公钥重建数据V与公钥PCA在椭圆曲线E上t倍的差值:Q=V-t·PCA,其中t=(r+s)mod n;
5.6)申请证书的用户usr验证U与Q是否相等:若相等,则将(u,U)作为自己的完整公私钥对参数并保存,结束验证,否则,验证失败。
所述申请证书的用户usr验证U与Q是否相等,其过程如下:
5.6.1)将5.3)中u=(x+s)mod n带入到5.4)的U=u·G公式中,得到U=(x+s)G;
5.6.2)将5.6.1)的式子去括号后加上t与PCA在椭圆曲线E上的乘积t·PCA,再减去t·PCA得到U=x·G+(s·G+t·PCA)-t·PCA;
5.6.3)将SM2数字签名算法的验证步骤:k·G=s·G+t·PCA带入到5.6.2)得到的公式,得到U=X+k·G-t·PCA;
5.6.4)将4.2)中V=X+k·G带入到5.6.3)得到的公式中,得到U=V-t·PCA;
5.6.5)将5.5)中Q=V-t·PCA带入到5.6.4)得到的公式中,得到U=Q,即得到用户完整公钥U与通过公钥重建数据V与公钥PCA的t倍差值Q相等的结果。
所述验证失败,其原因包括多方面,例如,不知道证书颁发机构CA私钥dCA的攻击者伪造了一个公钥重建数据与用户usr交互则而导致验证失败;证书颁发机构CA和申请证书的用户usr在密码原语的计算中出现计算错误也会导致验证失败。
以上描述仅是本发明的一个具体实例,并未构成对本发明的任何限制,例如针对SM2椭圆曲线密码算法标准提出的时间已将近十年,其采用的标准椭圆曲线NIST P–256已经不能满足现有的应用场景,如资源受限的物联网应用,要求更快的计算速度和更少的能量消耗的情况,微软公司提出的成熟的椭圆曲线FourQ与标准椭圆曲线NIST P–256相比,在计算效率方面上至少可以提高5倍,尤其是在计算标量乘时其效率可提高5倍以上。因而在现实商业应用中可以考虑用椭圆曲线FourQ替换标准椭圆曲线NIST P–256。该椭圆曲线FourQ的方程E为-x2+y2=1+dx2y2,其中d∈Fq,Fq是阶为q的有限域,其中q=p2,p=2127-1。显然,对于本领域的专业人员来说,在了解了本发明内容和原理后,都有可能在不背离本发明原理、结构的情况下,进行形式和细节上的各种修改和改变,但是这些基于本发明思想的修正和改变仍在本发明的要求保护范围之内。
Claims (2)
1.一种基于SM2数字签名算法的隐式证书密钥生成方法,其特征在于,包括如下:
(1)系统参数初始化,并通过证书颁发机构CA生成主密钥对:
(1a)按国家密码局认定的国产密码算法SM2标准设置如下参数:
设椭圆曲线方程E为y2=x3+ax+b,并设椭圆曲线方程E上的阶为n的基点G=(xG,yG),其中a、b∈Fq,Fq是阶为q的有限域,xG、yG分别为基点的横坐标和纵坐标;
选取消息摘要长度为256比特的密码杂凑算法Hash()为密码散列函数SM3;
(1b)证书颁发机构CA用随机数发生器产生第一随机数dCA∈[1,n-1]作为私钥,并将私钥dCA与基点G在椭圆曲线E上的乘积PCA作为公钥:PCA=dCA·G;
(2)申请证书的用户usr用随机数发生器产生随机数x∈[1,n-1]作为临时私钥,用临时私钥x与基点G在椭圆曲线E上的乘积X作为临时公钥:X=x·G,并将自己的身份标识IDA和临时公钥X发送给证书颁发机构CA;
(3)证书颁发机构CA生成隐式证书cert和签名s:
(3a)证书颁发机构CA用随机数发生器产生第二随机数k∈[1,n-1],并计算公钥重建数据:V=X+k·G=(x1,y1),其中x1和y1为公钥重建数据V的横坐标和纵坐标;
(3b)证书颁发机构CA根据公钥重建数据V生成可信的隐式证书:cert={V,meta},其中,meta为包含用户身份信息、CA系统信息和待签名消息的元数据,即meta=ZA||M;ZA=Hash(ENTLA||IDA||a||b||xG||yG||xCA||yCA),其中ENTLA是由用户usr的身份标识IDA的长度转换而成的两个字节,a为椭圆曲线方程E中变量x的系数,b为椭圆曲线方程E中的常数项,xG,yG分别为基点G的横坐标和纵坐标,xCA,yCA分别为系统公钥PCA的横坐标和纵坐标;M为待签名的消息;
(3c)证书颁发机构CA使用密码散列函数SM3计算隐式证书cert和公钥PCA连接值的哈希值h:h=Hash(cert,PCA),并利用私钥dCA通过SM2数字签名算法得到对隐式证书cert的签名:s=(1+dCA)-1(k-r·dCA)mod n,其中r=(h+x1)mod n,mod n表示模n运算;
(3d)将隐式证书cert和签名s发送给申请证书的用户usr;
(4)申请证书的用户usr生成完整公钥U,并对该完整公钥U和签名s进行验证,获得完整公私钥对:
(4a)申请证书的用户usr使用密码散列函数SM3重新计算隐式证书cert与公钥PCA相连接的哈希值:h=Hash(cert,PCA);
(4b)申请证书的用户usr根据其计算的哈希值h重新计算中间值:r=(h+x1)mod n,并检验r∈[1,n-1],s∈[1,n-1]是否成立:若成立,则用户usr计算完整私钥:u=(x+s)mod n,否则,退出验证过程,其中x是usr的临时私钥;
(4c)申请证书的用户usr根据完整私钥u生成完整公钥:U=u·G,并计算公钥重建数据V与公钥PCA在椭圆曲线E上t倍的差值:Q=V-t·PCA,其中t=(r+s)mod n;
(4d)申请证书的用户usr验证U与Q是否相等:若相等,则将(u,U)作为自己的完整公私钥对参数并保存,结束验证,否则,验证失败。
2.根据权利要求1所述的方法,其特征在于,所述(4d)中申请证书的用户usr验证U与Q相等的真实性,过程如下:
(4d1)将(4b)中u=(x+s)mod n带入到(4c)的U=u·G公式中,得到U=(x+s)G;
(4d2)将(4d1)的式子去括号后加上t与PCA在椭圆曲线E上的乘积t·PCA,再减去t·PCA得到U=x·G+(s·G+t·PCA)-t·PCA;
(4d3)将SM2数字签名算法的验证步骤:k·G=s·G+t·PCA带入到(4d2)得到的公式,得到U=X+k·G-t·PCA;
(4d4)将(3a)中V=X+k·G带入到(4d3)得到的公式中,得到U=V-t·PCA;
(4d5)将(4c)中Q=V-t·PCA带入到(4d4)得到的公式中,得到U=Q,即得到用户完整公钥U与通过公钥重建数据V与公钥PCA的t倍差值Q相等的结果。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011259622.8A CN112367175B (zh) | 2020-11-12 | 2020-11-12 | 基于sm2数字签名的隐式证书密钥生成方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011259622.8A CN112367175B (zh) | 2020-11-12 | 2020-11-12 | 基于sm2数字签名的隐式证书密钥生成方法 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112367175A true CN112367175A (zh) | 2021-02-12 |
CN112367175B CN112367175B (zh) | 2021-07-06 |
Family
ID=74514480
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011259622.8A Active CN112367175B (zh) | 2020-11-12 | 2020-11-12 | 基于sm2数字签名的隐式证书密钥生成方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112367175B (zh) |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113055189A (zh) * | 2021-06-02 | 2021-06-29 | 工业信息安全(四川)创新中心有限公司 | Sm2数字签名验证失败原因判定方法、装置、设备和介质 |
CN113158176A (zh) * | 2021-06-02 | 2021-07-23 | 工业信息安全(四川)创新中心有限公司 | 基于sm2签名的公钥解析方法、装置、设备及存储介质 |
CN113190862A (zh) * | 2021-05-10 | 2021-07-30 | 成都卫士通信息产业股份有限公司 | 基于sm2的无证书密钥生成方法、装置、电子设备及介质 |
CN113259097A (zh) * | 2021-05-13 | 2021-08-13 | 晋商博创(北京)科技有限公司 | 基于cpk的可多态配置的密钥生成方法及装置 |
CN113285934A (zh) * | 2021-05-14 | 2021-08-20 | 鼎铉商用密码测评技术(深圳)有限公司 | 基于数字签名的服务器密码机客户端ip检测方法及装置 |
CN113364582A (zh) * | 2021-05-11 | 2021-09-07 | 国网浙江省电力有限公司电力科学研究院 | 一种变电站内通信密钥配置与更新管理的方法 |
CN113904777A (zh) * | 2021-09-23 | 2022-01-07 | 武汉大学 | 一种基于sm2数字签名算法的签密方法 |
CN114070570A (zh) * | 2021-11-16 | 2022-02-18 | 华北电力大学 | 一种电力物联网的安全通信方法 |
CN114070561A (zh) * | 2022-01-17 | 2022-02-18 | 工业信息安全(四川)创新中心有限公司 | 一种基于sm2算法的零知识证明方法和系统 |
CN114095214A (zh) * | 2021-10-29 | 2022-02-25 | 上海热线信息网络有限公司 | 一种基于区块链nft技术的加、解密方法及装置、设备及介质 |
CN114499860A (zh) * | 2022-03-22 | 2022-05-13 | 深圳壹账通智能科技有限公司 | 签名公钥压缩方法、装置、计算机设备及存储介质 |
CN114650181A (zh) * | 2022-03-31 | 2022-06-21 | 西安电子科技大学 | 电子邮件加解密方法、系统、设备及计算机可读存储介质 |
CN114726546A (zh) * | 2022-05-11 | 2022-07-08 | 北京信安世纪科技股份有限公司 | 数字身份认证方法、装置、设备和存储介质 |
CN115664852A (zh) * | 2022-12-14 | 2023-01-31 | 金钱猫科技股份有限公司 | 一种基于区块链技术的数据管理方法与系统 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103546288A (zh) * | 2013-09-25 | 2014-01-29 | 中国科学院数据与通信保护研究教育中心 | Sm2数字签名生成算法的实现方法及装置 |
US20140211938A1 (en) * | 2013-01-29 | 2014-07-31 | Certicom Corp. | Modified elliptic curve signature algorithm for message recovery |
CN107248909A (zh) * | 2017-03-16 | 2017-10-13 | 北京百旺信安科技有限公司 | 一种基于sm2算法的无证书安全签名方法 |
CN109600233A (zh) * | 2019-01-15 | 2019-04-09 | 西安电子科技大学 | 基于sm2数字签名算法的群签名标识签发方法 |
CN111314089A (zh) * | 2020-02-18 | 2020-06-19 | 数据通信科学技术研究所 | 一种基于sm2的两方协同签名方法及解密方法 |
-
2020
- 2020-11-12 CN CN202011259622.8A patent/CN112367175B/zh active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140211938A1 (en) * | 2013-01-29 | 2014-07-31 | Certicom Corp. | Modified elliptic curve signature algorithm for message recovery |
CN103546288A (zh) * | 2013-09-25 | 2014-01-29 | 中国科学院数据与通信保护研究教育中心 | Sm2数字签名生成算法的实现方法及装置 |
CN107248909A (zh) * | 2017-03-16 | 2017-10-13 | 北京百旺信安科技有限公司 | 一种基于sm2算法的无证书安全签名方法 |
CN109600233A (zh) * | 2019-01-15 | 2019-04-09 | 西安电子科技大学 | 基于sm2数字签名算法的群签名标识签发方法 |
CN111314089A (zh) * | 2020-02-18 | 2020-06-19 | 数据通信科学技术研究所 | 一种基于sm2的两方协同签名方法及解密方法 |
Cited By (22)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113190862A (zh) * | 2021-05-10 | 2021-07-30 | 成都卫士通信息产业股份有限公司 | 基于sm2的无证书密钥生成方法、装置、电子设备及介质 |
CN113364582A (zh) * | 2021-05-11 | 2021-09-07 | 国网浙江省电力有限公司电力科学研究院 | 一种变电站内通信密钥配置与更新管理的方法 |
CN113364582B (zh) * | 2021-05-11 | 2022-07-12 | 国网浙江省电力有限公司电力科学研究院 | 一种变电站内通信密钥配置与更新管理的方法 |
CN113259097A (zh) * | 2021-05-13 | 2021-08-13 | 晋商博创(北京)科技有限公司 | 基于cpk的可多态配置的密钥生成方法及装置 |
CN113285934B (zh) * | 2021-05-14 | 2023-04-28 | 鼎铉商用密码测评技术(深圳)有限公司 | 基于数字签名的服务器密码机客户端ip检测方法及装置 |
CN113285934A (zh) * | 2021-05-14 | 2021-08-20 | 鼎铉商用密码测评技术(深圳)有限公司 | 基于数字签名的服务器密码机客户端ip检测方法及装置 |
CN113158176B (zh) * | 2021-06-02 | 2022-08-02 | 工业信息安全(四川)创新中心有限公司 | 基于sm2签名的公钥解析方法、装置、设备及存储介质 |
CN113158176A (zh) * | 2021-06-02 | 2021-07-23 | 工业信息安全(四川)创新中心有限公司 | 基于sm2签名的公钥解析方法、装置、设备及存储介质 |
CN113055189B (zh) * | 2021-06-02 | 2021-08-10 | 工业信息安全(四川)创新中心有限公司 | Sm2数字签名验证失败原因判定方法、装置、设备和介质 |
CN113055189A (zh) * | 2021-06-02 | 2021-06-29 | 工业信息安全(四川)创新中心有限公司 | Sm2数字签名验证失败原因判定方法、装置、设备和介质 |
CN113904777A (zh) * | 2021-09-23 | 2022-01-07 | 武汉大学 | 一种基于sm2数字签名算法的签密方法 |
CN113904777B (zh) * | 2021-09-23 | 2023-10-03 | 武汉大学 | 一种基于sm2数字签名算法的签密方法 |
CN114095214A (zh) * | 2021-10-29 | 2022-02-25 | 上海热线信息网络有限公司 | 一种基于区块链nft技术的加、解密方法及装置、设备及介质 |
CN114095214B (zh) * | 2021-10-29 | 2023-12-12 | 上海热线信息网络有限公司 | 一种基于区块链nft技术的加、解密方法及装置、设备及介质 |
CN114070570A (zh) * | 2021-11-16 | 2022-02-18 | 华北电力大学 | 一种电力物联网的安全通信方法 |
CN114070561A (zh) * | 2022-01-17 | 2022-02-18 | 工业信息安全(四川)创新中心有限公司 | 一种基于sm2算法的零知识证明方法和系统 |
CN114499860A (zh) * | 2022-03-22 | 2022-05-13 | 深圳壹账通智能科技有限公司 | 签名公钥压缩方法、装置、计算机设备及存储介质 |
CN114650181A (zh) * | 2022-03-31 | 2022-06-21 | 西安电子科技大学 | 电子邮件加解密方法、系统、设备及计算机可读存储介质 |
CN114726546A (zh) * | 2022-05-11 | 2022-07-08 | 北京信安世纪科技股份有限公司 | 数字身份认证方法、装置、设备和存储介质 |
CN114726546B (zh) * | 2022-05-11 | 2022-09-16 | 北京信安世纪科技股份有限公司 | 数字身份认证方法、装置、设备和存储介质 |
CN115664852B (zh) * | 2022-12-14 | 2023-05-23 | 金钱猫科技股份有限公司 | 一种基于区块链技术的数据管理方法与系统 |
CN115664852A (zh) * | 2022-12-14 | 2023-01-31 | 金钱猫科技股份有限公司 | 一种基于区块链技术的数据管理方法与系统 |
Also Published As
Publication number | Publication date |
---|---|
CN112367175B (zh) | 2021-07-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112367175B (zh) | 基于sm2数字签名的隐式证书密钥生成方法 | |
US5907618A (en) | Method and apparatus for verifiably providing key recovery information in a cryptographic system | |
JP3872107B2 (ja) | 暗号キー回復システム | |
US6697488B1 (en) | Practical non-malleable public-key cryptosystem | |
Toorani et al. | An elliptic curve-based signcryption scheme with forward secrecy | |
CN107659395B (zh) | 一种多服务器环境下基于身份的分布式认证方法及系统 | |
US20090185677A1 (en) | Short message encryption | |
CN110113150B (zh) | 基于无证书环境的可否认认证的加密方法和系统 | |
CN110020524B (zh) | 一种基于智能卡的双向认证方法 | |
JP2013539295A (ja) | メッセージ復元を伴うデジタル署名の認証された暗号化 | |
US20210152370A1 (en) | Digital signature method, device, and system | |
CN111953479B (zh) | 数据处理的方法及装置 | |
CN110535626B (zh) | 基于身份的量子通信服务站保密通信方法和系统 | |
US9088419B2 (en) | Keyed PV signatures | |
CN112104453A (zh) | 一种基于数字证书的抗量子计算数字签名系统及签名方法 | |
CN106713349B (zh) | 一种能抵抗选择密文攻击的群组间代理重加密方法 | |
CN114172745A (zh) | 一种物联网安全协议系统 | |
CN114726546A (zh) | 数字身份认证方法、装置、设备和存储介质 | |
CN113162773A (zh) | 一种可证安全的异构盲签密方法 | |
CN110519226B (zh) | 基于非对称密钥池和隐式证书的量子通信服务端保密通信方法和系统 | |
JP4485122B2 (ja) | 公開鍵暗号システム,署名システム,暗号通信システム,秘密鍵生成器,公開鍵生成器及びコンピュータプログラム | |
KR20040013966A (ko) | 이동 통신망에서의 인증 및 키 합의 방법 | |
CN114978488A (zh) | 一种基于sm2算法的协同签名方法及系统 | |
Zhang et al. | Certificateless hybrid signcryption by a novel protocol applied to internet of things | |
CN114070549A (zh) | 一种密钥生成方法、装置、设备和存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |