CN115174057A - Online and offline signature generation method and system based on SM2 signature - Google Patents
Online and offline signature generation method and system based on SM2 signature Download PDFInfo
- Publication number
- CN115174057A CN115174057A CN202210725592.8A CN202210725592A CN115174057A CN 115174057 A CN115174057 A CN 115174057A CN 202210725592 A CN202210725592 A CN 202210725592A CN 115174057 A CN115174057 A CN 115174057A
- Authority
- CN
- China
- Prior art keywords
- signature
- offline
- online
- message
- key
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 22
- 241000122205 Chamaeleonidae Species 0.000 claims abstract description 20
- 238000012795 verification Methods 0.000 claims description 13
- 125000004122 cyclic group Chemical group 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
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/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
- H04L9/0825—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) using asymmetric-key encryption or public key infrastructure [PKI], e.g. key signature or public key certificates
-
- 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/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Power Engineering (AREA)
- Storage Device Security (AREA)
Abstract
Description
技术领域technical field
本发明属于信息安全技术领域,特别是一种基于SM2签名的在线离线签名生成方法及系统。The invention belongs to the technical field of information security, in particular to an online and offline signature generation method and system based on SM2 signature.
背景技术Background technique
数字签名是一种重要的密码方案,它通过某种密码运算生成消息数字签名,来代替书写签名或印章。在这些方案中,每个用户将生成一个(私有)签名密钥和一个(公共)验证密钥。用户使用私人签名密钥为消息签名,并且任何人都可以使用签名者的公共验证密钥对签名者进行身份验证并验证消息。如果任何知道用户的公钥而不知道用户的私钥的攻击者都不能伪造新消息上的签名,则签名方案将被认为是安全的。Digital signature is an important cryptographic scheme, which generates digital signature of message by some cryptographic operation instead of writing signature or seal. In these schemes, each user will generate a (private) signing key and a (public) verification key. The user signs the message with the private signing key, and anyone can use the signer's public verification key to authenticate the signer and verify the message. A signature scheme is considered secure if any attacker who knows the user's public key but not the user's private key cannot forge the signature on a new message.
SM2是国家密码管理局于2010年12月颁布的一种椭圆曲线公钥密码算法(参见《SM2椭圆曲线公钥密码算法》规范)。SM2主要包括三部分:签名算法、密钥交换算法、加密算法。基于此算法能实现数字签名、密钥交换以及数据加密。SM2 is an elliptic curve public key cryptography algorithm promulgated by the State Cryptography Administration in December 2010 (see "SM2 Elliptic Curve Public Key Cryptography Algorithm" specification). SM2 mainly includes three parts: signature algorithm, key exchange algorithm, and encryption algorithm. Based on this algorithm, digital signature, key exchange and data encryption can be realized.
本专利设计了一种基于SM2签名的在线离线签名生成方法及系统,此方案利用变色龙哈希,对消息进行哈希,然后再进行操作得到最终签名。离线阶段对于变色龙哈希值进行签名,在线阶段使得消息m的变色龙哈希同离线阶段的值相同,从而可以使得SM2签名能够支持在线离线功能。This patent designs an online and offline signature generation method and system based on SM2 signature. This scheme uses the chameleon hash to hash the message, and then operates to obtain the final signature. In the offline phase, the chameleon hash value is signed, and in the online phase, the chameleon hash of the message m is the same as the value in the offline phase, so that the SM2 signature can support the online and offline functions.
发明内容SUMMARY OF THE INVENTION
本发明的上述技术问题主要是通过下述技术方案得以解决的:The above-mentioned technical problems of the present invention are mainly solved by the following technical solutions:
一种基于SM2签名的在线离线签名生成方法,其特征在于,基于系统参数、用户私钥、陷门密钥、消息获取在线签名或离线签名,具体是利用陷门哈希函数对给定消息进行散列,然后使用给定的签名方案对哈希值进行签名;利用变色龙哈希,离线阶段对于变色龙哈希值进行签名,在线阶段使得消息m的变色龙哈希同离线阶段的值相同。An online and offline signature generation method based on SM2 signature, which is characterized in that an online signature or an offline signature is obtained based on system parameters, user private key, trapdoor key, and message, and specifically, a trapdoor hash function is used to perform a given message. Hash, and then use the given signature scheme to sign the hash value; using the chameleon hash, the offline phase signs the chameleon hash value, and the online phase makes the chameleon hash of the message m the same as the value in the offline phase.
在上述的方法,离线阶段签名时,给定系统参数PP、用户A的私钥d、陷门密钥t、消息m;In the above method, when signing in the offline phase, the system parameter PP, the private key d of the user A, the trapdoor key t, and the message m are given;
用户A随机选取计算(xe,ye)=e=w·G;选取计算(x1,y1)=k·G,计算r=(xe+x1)mod q;s=((1+d)-1·(k-r·d))mod q;User A randomly selects Calculate (x e , y e )=e=w·G; choose Calculate (x 1 , y 1 )=k·G, calculate r=(x e +x 1 )mod q; s=((1+d) −1 ·(kr·d))mod q;
输出关于消息m的离线签名值 output offline signature value for message m
在上述的方法,在线阶段签名时,给定系统参数PP、用户A的私钥d、陷门密钥t、消息m;In the above method, when signing in the online phase, the system parameter PP, the private key d of the user A, the trapdoor key t, and the message m are given;
用户A计算 User A calculates
输出关于消息m的最终签名值σ=(r,s,c)。Output the final signature value σ=(r, s, c) for message m.
在上述的方法,在线签名或离线签名之前,进行系统初始化和密钥生成,其中,系统初始化是基于安全参数,生成系统参数,具体是In the above method, before the online signature or the offline signature, system initialization and key generation are performed, wherein the system initialization is based on the security parameters, and the system parameters are generated, specifically:
给定安全参数1n,选择一个有限域生成椭圆曲线方程y2=x3+ax+b mod p,满足方程的点构成一个阿贝尔群 Given a security parameter 1 n , choose a finite field Generate the elliptic curve equation y 2 =x 3 +ax+b mod p, the points satisfying the equation form an abelian group
随机选取一个生成元其阶为q;Pick a generator at random Its order is q;
输出系统参数 output system parameters
在上述的方法,密钥生成时,In the above method, when the key is generated,
给定系统参数PP,用户A随机选取计算公钥PA=d·G;Given the system parameter PP, user A randomly selects Calculate the public key P A =d·G;
输出公私钥对(PA,d);随机选取计算T=t·G;Output public-private key pair (P A , d); randomly selected Calculate T = t · G;
输出变色龙哈希的公开哈希密钥T,陷门密钥t。Output the public hash key T of the chameleon hash, the trapdoor key t.
在上述的方法,在线签名或离线签名后,进行签名验证,具体是In the above method, after online signature or offline signature, signature verification is performed, specifically
给定系统参数PP、消息m、签名值σ=(r,s,c),验证者验证如果不成立,则验证不通过;Given system parameters PP, message m, signature value σ=(r, s, c), the verifier verifies If it does not hold, the verification fails;
依次计算(xe,ye)=e=H(m)·G+c·T;(x1,y1)=s·G+(r+s)·PA;R=(xe+x1)modq;Calculate (x e , y e )=e=H(m)·G+c·T in turn; (x 1 , y 1 )=s·G+(r+s)·PA ; R = (x e +x 1 ) modq;
验证等式R=r是否成立,若成立,则是合法签名;反之,则验证不通过。Verify whether the equation R=r is established, if so, it is a legal signature; otherwise, the verification fails.
一种系统,其特征在于,该系统被配置为能够基于系统参数、用户私钥、陷门密钥、消息获取在线签名或离线签名,具体是利用陷门哈希函数对给定消息进行散列,然后使用给定的签名方案对哈希值进行签名;利用变色龙哈希,离线阶段对于变色龙哈希值进行签名,在线阶段使得消息m的变色龙哈希同离线阶段的值相同。A system, characterized in that the system is configured to be able to obtain an online signature or an offline signature based on system parameters, user private keys, trapdoor keys, messages, and in particular to hash a given message using a trapdoor hash function , and then use the given signature scheme to sign the hash value; using the chameleon hash, the offline phase signs the chameleon hash value, and the online phase makes the chameleon hash of the message m the same as the value in the offline phase.
因此,本发明具有如下优点:目前已有的在线离线签名算法主要基于国际算法来设计,缺乏基于我国商用密码标准的在线离线签名算法,本发明具有安全性高、功能完善等优点,可以使得SM2签名具有在线离线签名的功能。能够被应用于轻量级签名场景下,例如应用于手机、便捷式电脑等环境中。Therefore, the present invention has the following advantages: the existing online and offline signature algorithms are mainly designed based on international algorithms, and there is no online and offline signature algorithm based on my country's commercial cryptographic standards. The present invention has the advantages of high security, perfect functions, etc. Signature has the function of online and offline signature. It can be used in lightweight signature scenarios, such as mobile phones, portable computers and other environments.
附图说明Description of drawings
附图1是本发明的方法流程图;Accompanying drawing 1 is the method flow chart of the present invention;
附图2是本发明的签名生成和验证流程图;Accompanying drawing 2 is the signature generation and verification flow chart of the present invention;
具体实施方式Detailed ways
下面通过实施例,并结合附图,对本发明的技术方案作进一步具体的说明。The technical solutions of the present invention will be further described in detail below through embodiments and in conjunction with the accompanying drawings.
实施例:Example:
本发明涉及的参数定义如下:The parameters involved in the present invention are defined as follows:
n:安全参数长度。n: Security parameter length.
a,b:椭圆曲线参数。a, b: Elliptic curve parameters.
PP:系统参数。PP: System parameter.
阶为素数q的椭圆曲线群,元素为椭圆曲线上的点。 The group of elliptic curves whose order is a prime number q, and the elements are points on the elliptic curve.
包含p个元素的素域。循环群的一个生成元。 A prime field containing p elements. Cyclic group a generator of .
p:有限域的元素个数。p: finite field the number of elements.
q:循环群的阶。q: cyclic group step.
由整数1,2,...,q-1组成的整数集合。 The set of integers consisting of the integers 1, 2, ..., q-1.
PA:用户A的公钥。P A : User A's public key.
T:公开哈希密钥。T: Public hash key.
d:用户A的私钥。d: User A's private key.
t:陷门密钥。t: Trapdoor key.
mod q:模q运算。mod q: Modulo q operation.
H:密码杂凑函数, H: cryptographic hash function,
m:消息值。m: message value.
w,k:中间变量,为随机数。w, k: intermediate variables, which are random numbers.
(r,s):离线签名值。(r, s): Offline signature value.
(r,s,c):最终签名值。(r, s, c): The final signature value.
图1为本发明实施的方法流程图。该方法包含以下步骤:FIG. 1 is a flow chart of a method implemented in the present invention. The method includes the following steps:
S1:基于安全参数,生成系统参数。S1: Generate system parameters based on security parameters.
S2:用户选取随机数,生成公私钥对、公开哈希密钥、陷门密钥。S2: The user selects a random number and generates a public-private key pair, a public hash key, and a trapdoor key.
S3:基于系统参数、用户私钥、陷门密钥、消息获取在线签名或离线签名。S3: Obtain online signature or offline signature based on system parameters, user private key, trapdoor key, and message.
S4:基于系统参数、消息、签名值对签名进行验证。S4: Verify the signature based on system parameters, messages, and signature values.
针对本发明的目的,本发明提出了一种基于SM2签名的在线离线签名生成方法及系统,下面给出具体描述。For the purpose of the present invention, the present invention proposes an online and offline signature generation method and system based on SM2 signature, and the specific description is given below.
具体方案流程如下所示:The specific program process is as follows:
1)系统初始化:给定安全参数1n,执行以下步骤:1) System initialization: Given a safety parameter 1 n , perform the following steps:
a)选择一个有限域生成椭圆曲线方程y2=x3+ax+b mod p,满足方程的点构成一个阿贝尔群 a) choose a finite field Generate the elliptic curve equation y 2 =x 3 +ax+b mod p, the points satisfying the equation form an abelian group
b)随机选取一个生成元其阶为q。b) randomly select a generator Its order is q.
c)输出系统参数 c) Output system parameters
2)密钥生成:给定系统参数PP,一个用户A执行以下步骤:2) Key generation: Given the system parameter PP, a user A performs the following steps:
a)随机选取计算公钥PA=d·G。a) randomly selected Calculate the public key P A =d·G.
b)输出公私钥对(PA,d)。b) Output the public-private key pair (P A , d).
c)随机选取计算T=t·G。c) randomly selected Calculate T=t·G.
d)输出变色龙哈希的公开哈希密钥T,陷门密钥t。d) Output the public hash key T of the chameleon hash, the trapdoor key t.
签名:给定系统参数PP、用户A的私钥d、陷门密钥t、消息m,如图2所示,用户A执行以下步骤:Signature: Given system parameters PP, user A's private key d, trapdoor key t, and message m, as shown in Figure 2, user A performs the following steps:
离线阶段:Offline stage:
e)随机选取计算(xe,ye)=e=w·G。e) randomly selected Calculate (x e , y e )=e=w·G.
f)随机选取计算(x1,y1)=k·G,f) randomly selected Calculate (x 1 , y 1 )=k·G,
g)计算r=(xe+x1)mod q。g) Calculate r=(x e +x 1 ) mod q.
h)计算s=((1+d)-1·(k-r·d))mod q。h) Calculate s=((1+d) −1 ·(kr·d))mod q.
i)输出关于消息m的离线签名值 i) output the offline signature value for message m
在线阶段:Online stage:
a)计算 a) Calculate
b)输出关于消息m的最终签名值σ=(r,s,c)。b) Output the final signature value σ=(r, s, c) for message m.
3)验证:给定系统参数PP、消息m、签名值σ=(r,s,c),如图2所示,验证者执行以下步骤:3) Verification: Given system parameters PP, message m, and signature value σ=(r, s, c), as shown in Figure 2, the verifier performs the following steps:
a)验证如果不成立,则验证不通过。a) Verify If it does not hold, the verification fails.
b)计算(xe,ye)=e=H(m)·G+c·T。b) Calculate (x e , y e )=e=H(m)·G+c·T.
c)计算(x1,y1)=s·G+(r+s)·PA。c) Calculate (x 1 , y 1 )=s· G +(r+s)·PA .
d)计算R=(xe+x1)mod q。d) Calculate R=(x e +x 1 ) mod q.
e)验证等式R=r是否成立,若成立,则是合法签名;反之,则验证不通过。e) Verify whether the equation R=r is established, if so, it is a legal signature; otherwise, the verification fails.
本文中所描述的具体实施例仅仅是对本发明精神作举例说明。本发明所属技术领域的技术人员可以对所描述的具体实施例做各种各样的修改或补充或采用类似的方式替代,但并不会偏离本发明的精神或者超越所附权利要求书所定义的范围。The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which the present invention pertains can make various modifications or additions to the described specific embodiments or substitute in similar manners, but will not deviate from the spirit of the present invention or go beyond the definitions of the appended claims range.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210725592.8A CN115174057B (en) | 2022-06-23 | 2022-06-23 | Online offline signature generation method and system based on SM2 signature |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210725592.8A CN115174057B (en) | 2022-06-23 | 2022-06-23 | Online offline signature generation method and system based on SM2 signature |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115174057A true CN115174057A (en) | 2022-10-11 |
CN115174057B CN115174057B (en) | 2024-06-11 |
Family
ID=83488193
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210725592.8A Active CN115174057B (en) | 2022-06-23 | 2022-06-23 | Online offline signature generation method and system based on SM2 signature |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115174057B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6108783A (en) * | 1998-02-11 | 2000-08-22 | International Business Machines Corporation | Chameleon hashing and signatures |
CN110086599A (en) * | 2019-04-24 | 2019-08-02 | 电子科技大学 | Hash calculation method and label decryption method based on homomorphism chameleon hash function |
CN110086631A (en) * | 2019-04-29 | 2019-08-02 | 电子科技大学 | A kind of method of renewable chameleon hash function |
WO2022071889A1 (en) * | 2020-10-01 | 2022-04-07 | Singapore University Of Technology And Design | Methods and apparatus for message authentication |
-
2022
- 2022-06-23 CN CN202210725592.8A patent/CN115174057B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6108783A (en) * | 1998-02-11 | 2000-08-22 | International Business Machines Corporation | Chameleon hashing and signatures |
CN110086599A (en) * | 2019-04-24 | 2019-08-02 | 电子科技大学 | Hash calculation method and label decryption method based on homomorphism chameleon hash function |
CN110086631A (en) * | 2019-04-29 | 2019-08-02 | 电子科技大学 | A kind of method of renewable chameleon hash function |
WO2022071889A1 (en) * | 2020-10-01 | 2022-04-07 | Singapore University Of Technology And Design | Methods and apparatus for message authentication |
Non-Patent Citations (2)
Title |
---|
向新银;: "基于理想格的在线/离线签名方案", 密码学报, no. 03, 15 June 2017 (2017-06-15) * |
马晓静;王尚平;王晓峰;秦慧;: "一种新的基于身份的变色龙数字签名方案", 计算机工程, no. 18, 20 September 2006 (2006-09-20) * |
Also Published As
Publication number | Publication date |
---|---|
CN115174057B (en) | 2024-06-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108667626B (en) | Secure two-party collaboration SM2 signature method | |
CN108551392B (en) | A blind signature generation method and system based on SM9 digital signature | |
CN107248909B (en) | A Certificateless Secure Signature Method Based on SM2 Algorithm | |
CN110011803B (en) | A Lightweight SM2 Method for Two-Party Collaboration to Generate Digital Signatures | |
CN110138567B (en) | ECDSA (electronic signature system) based collaborative signature method | |
US20170373847A1 (en) | Method for updating a public key | |
CN108667627A (en) | SM2 Digital Signature Method Based on Two-Party Collaboration | |
CN107911217B (en) | Method and device for cooperatively generating signature based on ECDSA algorithm and data processing system | |
CN112118111B (en) | SM2 digital signature method suitable for threshold calculation | |
CN114117547B (en) | SM9 digital signature acceleration generation method and digital signature acceleration verification method based on pre-calculation table | |
CN112118113A (en) | Multi-party cooperative group signature method, device, system and medium based on SM2 algorithm | |
CN113132104A (en) | Active and safe ECDSA (electronic signature SA) digital signature two-party generation method | |
CN110061828A (en) | Distributed digital endorsement method without trusted party | |
CN110086630B (en) | A Generating Method of Digital Signature Based on Edwards Curve | |
CN113452529A (en) | Adapter signature generation method based on SM2 algorithm | |
CN110855425A (en) | Lightweight multiparty cooperative SM9 key generation and ciphertext decryption method and medium | |
CN110932866B (en) | A Ring Signature Generation Method Based on SM2 Digital Signature Algorithm | |
CN115174053B (en) | Signature generation method and device for repudiation ring authentication based on SM9 algorithm | |
CN110798313B (en) | Secret dynamic sharing-based collaborative generation method and system for number containing secret | |
CN115174056B (en) | A method and device for generating chameleon signature based on SM9 signature | |
CN115174037B (en) | A method and device for constructing a chameleon hash function based on SM9 signature | |
CN116346328A (en) | A digital signature method, system, device and computer-readable storage medium | |
CN105187208B (en) | The unauthorized strong designated verifier signature system based on no certificate | |
CN111817848B (en) | ECDSA signature method and system for ECC private key segmented storage | |
CN110061847A (en) | The digital signature method that key distribution generates |
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 |