WO2013078970A1 - 基于sm2密钥交换协议的密钥协商方法及装置 - Google Patents

基于sm2密钥交换协议的密钥协商方法及装置 Download PDF

Info

Publication number
WO2013078970A1
WO2013078970A1 PCT/CN2012/085233 CN2012085233W WO2013078970A1 WO 2013078970 A1 WO2013078970 A1 WO 2013078970A1 CN 2012085233 W CN2012085233 W CN 2012085233W WO 2013078970 A1 WO2013078970 A1 WO 2013078970A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
parameter
key
positive integer
negotiation
Prior art date
Application number
PCT/CN2012/085233
Other languages
English (en)
French (fr)
Inventor
李志勇
颜湘
Original Assignee
西安西电捷通无线网络通信股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 西安西电捷通无线网络通信股份有限公司 filed Critical 西安西电捷通无线网络通信股份有限公司
Priority to JP2014543759A priority Critical patent/JP6014678B2/ja
Priority to KR1020147017887A priority patent/KR101617561B1/ko
Priority to US14/361,750 priority patent/US9313026B2/en
Priority to EP12852494.9A priority patent/EP2787682B1/en
Publication of WO2013078970A1 publication Critical patent/WO2013078970A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0819Key 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)
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3066Public 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3006Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters
    • H04L9/3033Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters details relating to pseudo-prime or prime number generation, e.g. primality test
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/24Key scheduling, i.e. generating round keys or sub-keys for block encryption

Definitions

  • the key negotiation method and device based on the SM2 key exchange protocol are submitted to the Chinese Patent Office on November 30, 2011, and the application name is 201110390564.7.
  • the present invention relates to the field of information technology, and in particular, to a key agreement method and apparatus based on an SM2 key exchange protocol. BACKGROUND OF THE INVENTION In December 2010, the China National Cryptography Administration disclosed the SM2 and SM3 cryptographic algorithms, marking SM2.
  • the SM3 cryptographic algorithm has entered the commercialization phase.
  • the SM2 key exchange protocol is well applied in the field of key management and key agreement functions.
  • the W parameter is an important parameter in the key exchange protocol, and the efficiency of generating the parameter value becomes the decisive factor for the efficiency of the entire key exchange protocol.
  • the user A is the key negotiation initiator
  • the user B is the key negotiation responder.
  • the key derivation function specified in the SM2 key exchange protocol is denoted as KDF Z, klen, , which functions to derive key data from a secret bit string, where z is the input secret bit string, t klen represents The bit length of the key data to be obtained is required to be smaller than (2 32 - l) v , and the length of the key data bit string is "! ⁇
  • the key derivation function needs to call the password hash function (for example, SM3 cryptographic hash algorithm).
  • the cryptographic hash function is recorded as H v (), and the output of the cryptographic hash function is V bit. The hash value.
  • A3 will be sent to user B;
  • User B can further perform B8:
  • Hash ( ) can be regarded as a cryptographic hash function H v (), which can be regarded as a hash value obtained by the operation.
  • B9 will be sent to user A. If B8 is executed, it will need to be sent to user A further; user A:
  • A4 The domain element xl is extracted from the domain element xl. If the domain element xl is binary extended domain data, the data type is first converted to an integer. If the domain element xl is the prime domain data, no conversion is needed, and the subsequent operation can be directly performed.
  • user A may further perform A9 and A10:
  • Hash ( ) can be regarded as a cryptographic hash function H v ()
  • S can be regarded as a hash value obtained by the operation, and check if & is true If yes, it is determined that the key confirmation of user B to user A is successful, and if not, it is determined that the key confirmation from user B to user A fails;
  • the curve parameter, called the order n the order n is usually a large integer of 160 or more. If the logarithm of log 2 ( «) is directly obtained based on the order n, then the rounding operation is performed, which is complicated in engineering implementation. The calculation time is also relatively expensive, which directly reduces the implementation efficiency of the key agreement process, and improves the implementation complexity of the key agreement process.
  • the present invention provides a key agreement based on the SM2 key exchange protocol. The method and device are used to reduce the implementation complexity of the key negotiation process and improve the implementation efficiency of the key negotiation process.
  • a key agreement method based on the SM2 key exchange protocol including:
  • Key negotiation is performed based on the value of the W and the negotiation peer.
  • a key agreement device based on the SM2 key exchange protocol comprising:
  • a first control module configured to determine a value of an elliptic curve parameter order n used in the current key negotiation, and calculate a minimum positive integer value of the order n that is less than or equal to 2 ⁇ , X, and based on the obtained X The smallest positive integer value obtains the value of the parameter W;
  • the second control module is configured to perform key negotiation with the negotiated peer based on the value of the W.
  • a parameter generating device includes:
  • a determining unit configured to determine a value of an elliptic curve parameter order n used in the current key negotiation; a calculating unit, configured to calculate the minimum positive integer value of the order n less than or equal to 2 ⁇ , X, and based on the obtained The smallest positive integer value of X obtains the value of the parameter W.
  • both parties of the negotiation calculate the parameter W according to the smallest positive integer value of the X value established by the inequality " ⁇ 2 X , and perform the SM2 key exchange protocol according to the parameter W and the negotiation peer.
  • Key negotiation Compared with the method of calculating the log W ( n ) and then rounding up the value to calculate the parameter W, the calculation amount is effectively reduced, and the implementation complexity of the algorithm is reduced, so that the degree of complexity is greatly reduced.
  • the implementation efficiency of the key agreement process based on the SM2 key exchange protocol is improved, and the engineering implementation of the SM2 key exchange protocol is optimized.
  • FIG. 1A is a schematic structural diagram of a function of a key agreement apparatus according to an embodiment of the present invention.
  • FIG. 1B is a schematic structural diagram of a function of a parameter W generating apparatus according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a first method for generating a parameter W according to an embodiment of the present invention
  • FIG. 4 is a flow chart of a second method for generating a parameter W in an embodiment of the present invention. detailed description
  • a key agreement device (which may be user A or user B) used by either of the key negotiation parties based on the SM2 key exchange protocol includes the first control module. 10 and a second control module 11 , wherein
  • the first control module 10 is configured to determine the value of the elliptic curve parameter order n used in the current key negotiation, and calculate the minimum positive integer value of the order n less than or equal to 2 ⁇ , X, and based on the obtained minimum X A positive integer value obtains the value of the parameter W;
  • the second control module 11 is configured to perform key negotiation with the negotiating peer based on the value of the parameter W. As shown in FIG. 1A, the second control module 11 can be further subdivided into functional units implemented in the form of software and functional units implemented in hardware. The functions of these functional units will be described in detail in subsequent embodiments. On the other hand, the division of the functional units in the second control module 11 shown in FIG. 1A is only an example, and the implementation may be separately planned according to the specific application environment, and details are not described herein again.
  • the first control module 10 may be a logic module set in the key agreement device, or may be a sub-device having an independent operation function.
  • the first control module 10 includes a determining unit 100 and a calculating unit 101, where
  • a determining unit 100 configured to determine a value of an elliptic curve parameter order n used by the current key negotiation; a calculating unit 101, configured to calculate a minimum positive integer value of the order n less than or equal to 2 ⁇ , X, and based on the obtained The smallest positive integer value of X obtains the value of the parameter W.
  • the specific process performed by either of the SM2 key negotiation parties (which may be user A or user B) is as follows:
  • Step 200 Determine the value of the elliptic curve parameter order n used in the key negotiation.
  • the value of the order n is preset.
  • User A and user B agree on the equation of the elliptic curve used in the startup phase of the SM2 key negotiation process, and send the public key used by the peer to the peer, that is, P A And P B .
  • Step 210 Calculate the minimum positive integer value of X when the determined order n is less than or equal to the power of 2, that is, determine the minimum positive integer value of the inequality " ⁇ 2", and based on the obtained minimum positive integer of X The value obtains the value of the parameter W.
  • the key agreement device when determining the minimum positive integer value of the inequality " ⁇ 2", the specific operations performed are as follows: Referring to FIG. 3 and FIG. 4, the key agreement device needs to first determine the effective number of bits of the order n. m, that is, the total number of bits contained in the order n from the first non-zero bit of the upper bit; then, compare the value of the order n with the size of 2TM- 1 , that is, judge n > 2 ⁇ - if yes, Directly take the current value of m as the minimum positive integer value of X; otherwise, use the set step value (for example, the step value is 1) to reduce m successively, and each time it is reduced, judge n >2" ! - 1 ? Until the inequality is established, and the last value after m reduction is taken as the minimum positive integer value of X.
  • the set step value for example, the step value is 1
  • the parity of the last obtained m (ie, the parity of the smallest positive integer value of X) can be determined first. If m is an odd number, m is divided by the first preset parameter and proceeds. The result of the rounding is taken as the value of the parameter W.
  • the value of the parameter W where 2 is the first preset parameter and 1 is the second preset parameter.
  • the parity of the finally obtained m ie, the parity of the smallest positive integer value of X
  • Step 220 Perform key negotiation with the negotiated peer based on the obtained value of the parameter W.
  • the key agreement device that implements the SM2 key exchange protocol can be used as the initiator user A or the responder user B.
  • the first control module 10 is an operation module for calculating the parameter W. After the key negotiation device obtains the parameter W through the first control module 10, the process of performing key agreement with the peer end is as follows:
  • the user initiator A and the user responder B respectively obtain the corresponding parameters W through the first control module 10 set in the key negotiation device used by the user.
  • the user A calculates the random number and the elliptic curve point through the second control module 11 in the key agreement device, wherein the second control module 11 can be implemented by hardware.
  • the user A can pass the second control.
  • the random number generating unit in the module 11 generates a random number e " -1 ", and the ECC operation unit can generate an elliptic curve point ⁇ 2, 3 " 1 ) based on the generated random number, and the second control module 11
  • the public key corresponding to the private key used in the key storage sub-module stored in the key agreement sub-module is taken out, and the public key 75 ⁇ is passed through the local communication interface implemented by software to set the elliptic curve point.
  • Ra and public key Pa are sent to user B;
  • the information received by the user B from the key negotiation device B is mainly included in the information received by the user A:
  • the user B uses the local second control module 11 to calculate a random number and an elliptic curve point.
  • the second control module 11 can be implemented in hardware. For example, the user B can generate a random number through the random number generating unit in the second control module 11. The number " -1 ", then, by the ECC operation unit in the second control module 11, an elliptic curve point [ ⁇ 2 ⁇ 2 , 3 " 2 ) can be generated based on the generated random number, and at the same time, the second The control module 11 takes out the public key Ps corresponding to the private key dB used in the key storage unit stored in the key storage unit, and performs an elliptic curve through a local communication interface implemented in software. Point Rb and public key P B are sent to user A;
  • the user B can convert the obtained domain element and the data type into an integer data type by using the data type conversion unit implemented in the software form in the local second control module 11, and then call the second control unit 11 in software form.
  • the user B uses the key agreement device to use the peer public key A , the opposite elliptic curve point Ra , and the local use.
  • the elliptic curve cofactor parameter parameter X1 , the parameter ⁇ is transmitted to the hardware implementation part of the second control module 11, and the large integer operation unit is called to complete the ⁇ ( ⁇ + ⁇ mod" operation, wherein the private key is from the second
  • K B KDF v II yv II Z A II Z B en)
  • the data type of the abscissa ⁇ and the ordinate is converted into a bit string data type, and then the following check information is calculated by the cryptographic hash calculation unit implemented in software form in the second control module 11:
  • User B transmits the verification information Sb through the transmission interface in software form To user A.
  • the key agreement device of the initiator A receives the information sent by the user B, obtains the public key P B of the user B, the elliptic curve point Rb of the user B, the user information B of the user B, and the local user information, the elliptic curve cofactor parameter h.
  • the negotiated key length klen is negotiated and then calculated using the same process as user B:
  • K A KDF ⁇ x u ⁇ y u ⁇ Z A ⁇ Z B ,klen
  • initiator A can also negotiate the key success by default. Further, if user A receives the verification information sent by user B, the following verification process is also required to calculate the following verification information:
  • both parties of the negotiation calculate the parameter W according to the minimum positive integer value in the X value that the inequality is established, and perform SM2-based key exchange with the negotiation peer according to the parameter W.
  • the key negotiation of the protocol wherein the calculation process of the parameter W can be performed before the actual negotiation process is started, or after the actual negotiation process is started, the same effect can be achieved.
  • the log2 (n) is calculated first.
  • the method of calculating the parameter W by re-rounding the value is effective, which reduces the amount of calculation and reduces the implementation complexity of the algorithm, thereby greatly improving the key negotiation process based on the SM2 key exchange protocol.
  • the efficiency is realized, which optimizes the engineering implementation of the SM2 key exchange protocol.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the present invention can be embodied in the form of one or more computer program products embodied on a computer-usable storage medium (including but not limited to disk storage, CD-ROM, optical storage, etc.) in which the program code available for the computer is included.
  • a computer-usable storage medium including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more flows of the flowchart or in a block or blocks of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Algebra (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Storage Device Security (AREA)

Abstract

涉及信息技术领域,公开了一种基于SM2密钥交换协议的密钥协商方法及装置。该方法为:协商双方均根据令不等式n≤2x成立的X取值中的最小正整数值,来计算参数W,并根据该参数W与协商对端进行密钥协商。相较于采用先计算log2(n)对数值再向上取整的方式计算参数W的方法,有效地减少了计算量,并且降低了算法的实现复杂度,从而在很大程度上提高了基于SM2密钥交换协议的密钥协商流程的实现效率,进而优化了SM2 密钥交换协议的工程化实现。

Description

基于 SM2密钥交换协议的密钥协商方法及装置 本申请要求在 2011年 11月 30日提交中国专利局、 申请号为 201110390564.7、 发 明名称为"基于 SM2密钥交换协议的密钥协商方法及装置"的中国专利申请的优先权, 其全部内容通过 I用结合在本申请中。 技术领域 本发明涉及信息技术领域, 特别涉及一种基于 SM2密钥交换协议的密钥协商 方法及装置。 背景技术 2010年 12月中国国家密码管理局将 SM2、 SM3密码算法公开,标志着 SM2、
SM3密码算法进入了商用化阶段。 SM2密钥交换协议作为 SM2密码算法的一个 组成部分,其在密钥管理和密钥协商功能领域得到很好的应用。在 SM2密钥交换 协议工程实现过程中, W参数作为密钥交换协议内的一个重要参数, 其参数值的 生成运算效率成为整个密钥交换协议实现效率的决定性因素。
基于 SM2密钥交换协议的规定, 现有的密钥协商流程如下:
支设用户 A为密钥协商发起方, 而用户 B为密钥协商响应方, 用户 A和用 户 B协商获得的密钥数据的长度为 klen比特, 以及用户 A和用户 B双方使用相 同的椭圆曲线方程, 其中, 该椭圆曲线方程类型可选择素域方程 = X3 + i7X + 6 , 也可以选择二元扩域方程 + = X3 + αχ2 + 6。
在 SM2密钥交换协议内规定使用的密钥派生函数记为 KDF Z, klen、 , 其作用 是从一个秘密比特串中派生出密钥数据, 其中, z为输入的秘密比特串, t klen 表示要获得的密钥数据的比特长度,要求该值小于(232 - l)v ,将长度为 《的密钥 数据比特串记为!^ 在密钥数据生成的过程中, 密钥派生函数需要调用密码杂凑 函数(例如, SM3密码杂凑算法) , 通常将密码杂凑函数记为 Hv() , 密码杂凑函 数的输出是长度为 V比特的杂凑值。
下面介绍密钥派生函数运算步骤如下:
( 1 ) 、 初始化一个 32比特构成的计数器" = 0x00000001 ;
( 2 )、 分别釆用 i从 1到 的取值循环执行以下步骤 a和步骤 b , 各次的执 行结果分别记为: Ha Ha2 ... ... Ηα^ι→_χ , Ha\[klen/vV 其中, /vl为 生成的最后一个 的取值的部分或全部: a、 计算 ^.=^(2||^); II为级联运算
b、 ct + + - 在计算, ¾!「fe/vl时,若 klen/v是整数,则令 !「^/ν1 = ^^fe/vl '若 klen/V 是非整数, 则令^ !p e«/v,为 Haklen ~]最左边的(We«- (vx^fe«/v」))个比特; (3 )、 最后, 令 二^ ^ …!!^^ — ^!^ ; K便是获 得的密钥数据。
基于获得的密钥函数, 用户 A和用户 B为了获得相同的密钥, 需要进行密钥 协商, 具体运算步骤如下:
w =「(「log2(")]/2)]_l。
用户 A:
Al: 釆用随机数发生器产生随机数 rA G[1,«-1];
A2: 计算椭圆曲线点 =[ ](? = ( ), (χ,, )即是点 的坐标值, G 为选取的椭圆曲线参数。
A3: 将 发送给用户 B;
用户 B:
B 1: 釆用随机数发生器产生随机数 e [1, «— 1];
B2: 计算椭圆曲线点」 =[ ]G = ( 2,_y2) , (JC2,;2)即是点 ¾的坐标值, G为选取的椭圆曲线参数。
B3: 从^¾中取出域元素 x2, 若域元素 x2为二元扩域数据, 则先要将其数据 类型转换为整数, 若域元素 x2为 域数据, 则无需转换, 可直接进行后续操作; 接着, 计算用户 B侧的中间 数 x2 =2w +(x2 & (2W— 1));
B4:计算 ^ ={dB +x2 rB) odn ,其中, ^为用户8侧的中间参数, dB 为用户 B本地保存的私钥、 为用户 B本地产生的随机数。
B5: 验证 是否满足椭圆曲线方程(釆用素域方式或二元扩域方式可预先 与用户 A约定, 双方釆用相同的椭圆曲线方程) , 若不满足则确定本次密钥协商 失败, 若满足, 则从 中取出域元素 xl, 若域元素 xl为二元扩域域数据, 则先 要将其数据类型转换为整数, 若域元 xl为素域数据, 则无需转换, 可直接进行 后续操作, 计算用户 B侧的中间参数 Xx , ^ = 2 + & (2 - 1));
B6: 计算椭圆曲线点^^^^ ^+^^]^)^ ,^),其中, h为选取 的椭圆曲线参数, 为用户 A的公钥,判断 V是否为无穷远点(如, =0 , yv=0 ), 若是, 则确认用户 B密钥协商失败, 否则, 将域元素^、 的数据类型转换为 比特串;
B7: 计算^二^^;^^;^^^ ^^ , Men); 即为用户 B通过密 钥协商获得的密钥数据, 此时, 可默认用户 B的密钥协商成功。
可选地, 在执行 B7后, 用户 B还可以进一步执行 B8:
B8: 将 R 的坐标 xl、 yW Rs的坐标 x2、 y2的数据类型均转换为比特串, 计 算^二/^/?^^^ !!;^/^/^^^^^^^^^;^^^ )), Hash ( ) 可以看作是密码杂凑函数 Hv(), 可以看作是运算获得的一杂凑值。
B9: 将 发送给用户 A, 若执行了 B8, 则还需进一步将 发送给用户 A; 用户 A:
A4: 从 中取出域元素 xl, 若域元素 xl为二元扩域数据, 则先要将其数据 类型转换为整数, 若域元素 xl为素域数据, 则无需转换, 可直接进行后续操作, 计算中间参数 ^^ + &^ — 1》;
A5: 计算 4=( 4+::1. )1110(1", 其中, ^为用户 A侧的中间参数, 为 用户 A本地保存的私钥、 为用户 A本地产生的随机数。
A6: 验证^ ¾是否满足椭圆曲线方程(与用户 B约定) , 若不满足, 则确定 本次密钥协商失败; 否则, 从 中取出域元素 x2, 若域元素 x2为二元扩域域数 据, 则先要将其数据类型转换为整数, 若域元素 x2为素域数据, 则无需转换, 可 直接进行后续操作, 计算中间参数 ^ = 2w+(x2 & (2W— 1));
A7:计算椭圆曲线点 = ^ ] (A + [^] = ,若 U是无究远点(如,
½=0, yu=0 ) , 则 ^协商失败; 否则将域元素 ·%、 的数据类型转换为比 特串;
A8: 计算^ = KDF(xu II γυ || ZA || ZB, Men) , ΚΑ即为用户 Α通过 密钥协商获得的密钥数据, 此时, 可默认用户 A的密钥协商成功;
可选地, 在执行 A8后, 若接收到用户 B发送的 , 则用户 A还可以进一步执 行 A9和 A10:
A9: 将 R 的坐标 xl、 yW Rs的坐标 x2、 y2的数据类型均转换为比特串, 计 算 S1=Ho^(0x02||>¾ ||Ha^(x[/|| || ||x1||_y1||x2||_y2)), Hash ( )可以看 作是密码杂凑函数 Hv(), S可以看作是运算获得的一杂凑值, 并检验 &是 否成立, 若成立, 则确定用户 B到用户 A的密钥确认成功, 若不成立则确定从用户 B到用户 A的密钥确认失败;
A10: 计算 =/¾^(0 03|| ||/¾^(½||2 |2 || 1|| || || )), 并 将 发送给用户
用户 B: (若接收到用户 A发送的 , 则用户 B可以继续执行步骤 B10和 B11 ) B10: 计算& = Hash (0x03 \\ yv || Hash(xv || ZA || ZB || xx || yx || x21| y2)) , 并检验 是否成立, 若成立, 则确定用户 A到用户 B的密钥确认成功, 若不 成立则确定从用户 A到用户 B的密钥确认失败。
上述过程便是 SM2密钥交换协议描述的密钥协商过程, 由此可知, 在上述流 程中, \¥参数值运算公式为 =「(「10§2 ^ / 2 -1 , 其中 n为椭圆曲线参数, 称为 阶 n, 阶 n通常是 160位以上的大整数, 如果基于阶 n直接求取 log2(«)的对数值, 然后再进行向上取整运算, 在工程实现上是较为复杂的, 也比较耗费计算时间, 从而直接降低了密钥协商流程的实现效率, 提升了密钥协商流程的实现复杂度。 发明内容 本发明实施例提供一种基于 SM2密钥交换协议的密钥协商方法及装置, 用以 降低密钥协商流程的实现复杂度, 提高密钥协商流程的实现效率。
本发明实施例提供的具体技术方案如下:
一种基于 SM2密钥交换协议的密钥协商方法, 包括:
确定本次密钥协商所使用的椭圆曲线参数阶 n的取值;
计算所述阶 n小于或等于 2 †, X的最小正整数值, 并基于获得的 X的最小正 整数值获得参数 W的取值;
基于所述 W的取值与协商对端进行密钥协商。
一种基于 SM2密钥交换协议的密钥协商装置, 包括:
第一控制模块,用于确定本次密钥协商所使用的椭圆曲线参数阶 n的取值,并 计算所述阶 n小于或等于 2 †, X的最小正整数值, 并基于获得的 X的最小正整数 值获得参数 W的取值;
第二控制模块, 用于基于所述 W的取值与协商对端进行密钥协商。
一种参数生成装置, 包括:
确定单元, 用于确定本次密钥协商所使用的椭圆曲线参数阶 n的取值; 计算单元, 用于计算所述阶 n小于或等于 2 †, X的最小正整数值, 并基于 获得的 X的最小正整数值获得参数 W的取值。
本发明实施例中, 协商双方均根据令不等式"≤ 2X成立的 X取值中的最小正整 数值, 来计算参数 W, 并根据该参数 W与协商对端进行基于 SM2密钥交换协议的 密钥协商。 相较于釆用先计算 log2 ( n )对数值再向上取整的方式计算参数 W的方 法, 有效地减少了计算量, 并且降低了算法的实现复杂度, 从而在很大程度上提 高了基于 SM2密钥交换协议的密钥协商流程的实现效率, 进而优化了 SM2密钥交 换协议的工程化实现。 附图说明
图 1 A为本发明实施例中密钥协商装置功能结构示意图;
图 1B为本发明实施例中参数 W生成装置功能结构示意图;
图 2为本发明实施例中进行密钥协商的流程图;
图 3为本发明实施例中生成参数 W的第一种方法流程图;
图 4为本发明实施例中生成参数 W的第二种方法流程图。 具体实施方式
在基于 SM2密钥交换协议的密钥协商过程中,为了降低密钥协商流程的执行 复杂度, 提高密钥协商流程的实现效率, 本发明实施例中, 进行密钥协商的双方 不再釆用「log2(« 来计算参数 W, 而是求取满足 w≤ 2X中 X的最小正整数值, 并 基于获得的 X的最小正整数值获得参数 W的取值 (例如, 将 X的最小正整数值 替代「l。g2(« 的运算结果代入公式 w =「(「log2(«^ /2),-l中计算 W的取值 ),然后, 再基于釆用这种方式计算出的 W值与对端进行密钥协商。
下面仍以用户 A和用户 B为例,结合附图对本发明优选的实施方式进行详细 说明。
参阅图 1A所示, 本发明实施例中, 基于 SM2密钥交换协议的密钥协商双方 中, 任意一方使用的密钥协商装置 (可以是用户 A, 也可以是用户 B ) 包括第一 控制模块 10和第二控制模块 11 , 其中,
第一控制模块 10,用于确定本次密钥协商所使用的椭圆曲线参数阶 n的取值, 并计算阶 n小于或等于 2 †, X的最小正整数值, 并基于获得的 X的最小正整 数值获得参数 W的取值;
第二控制模块 11 , 用于基于上述参数 W的取值与协商对端进行密钥协商。 如图 1A所示, 第二控制模块 11内部又可细分为若千以软件形式实现的功能 单元和以硬件形式实现的功能单元, 这些功能单元的作用将在后续实施例中进行 详细介绍, 另一方面, 图 1A所示的第二控制模块 11内部的功能单元的划分方式 仅为一种举例, 实现应用中可以根据具体的应用环境而另行规划,在此不再赘述。
另一方面, 实际应用中,第一控制模块 10可以是密钥协商装置中设置的逻辑 模块, 也可以是具有独立运行功能的子装置, 参阅图 1B所示, 本发明实施例中, 第一控制模块 10包括确定单元 100和计算单元 101 , 其中,
确定单元 100 , 用于确定本次密钥协商所使用的椭圆曲线参数阶 n的取值; 计算单元 101 , 用于计算阶 n小于或等于 2 †, X的最小正整数值, 并基于 获得的 X的最小正整数值获得参数 W的取值。
基于上述技术方案, 参阅图 2所示, 本发明实施例中, SM2密钥协商双方中 的任意一方 (可以是用户 A, 也可以是用户 B )所执行的具体流程如下:
步骤 200: 确定本次密钥协商所使用的椭圆曲线参数阶 n的取值。
通常阶 n的取值会预先设置, 用户 A和用户 B在 SM2密钥协商流程的启动 阶段,会约定釆用的椭圆曲线的方程, 以及向对端发送自身釆用的公钥, 即 PA和 PB
步骤 210: 计算确定的阶 n小于或等于 2的 X次方时, X的最小正整数值, 即确定令不等式《≤2 成立的 X的最小正整数值,并基于获得的 X的最小正整数 值获得参数 W的取值。
本实施例中, 在确定令不等式《≤2 成立的 X的最小正整数值时, 执行的具 体操作如下: 参阅图 3和图 4所示, 密钥协商装置需要先确定阶 n的有效比特数 m, 即从高位第一个非 0比特位算起, 阶 n包含的比特总数目; 然后, 将阶 n的 取值与 2™—1进行大小比较, 即判断 n > 2— 若是, 则直接将 m的当前取值作为 X的最小正整数值; 否则, 釆用设定步长值(如, 步长值为 1 )对 m逐次进行减 小, 每减少一次, 判断一次n > 2"!-1 ? 直到该不等式成立为止, 并将 m减少后的 最后取值作为 X的最小正整数值。
本实施例中,在获得 X的最小正整数值后,在基于 X的最小正整数值计算参 数 W的取值时, 可以釆用多种方式:
例如: 参阅图 3所示, 可以先判断最后获得的 m的奇偶性(即 X的最小正整 数取值的奇偶性), 若 m为奇数, 则将 m除以第一预设参数并进行向下取整后的 结果作为参数 W的取值,如,釆用公式 w = Lw/ 2」计算参数 W的取值,其中, L 」 为向下取整操作, m为 X的最小正整数; 若 m为偶数, 则将 m除以第一预设参 数并进行向下取整后再减去第二预设参数的结果作为参数 W的取值,如, 釆用公 式 = / 2」_1计算参数 W的取值, 其中, 2为第一预设参数, 1为第二预设参 数。 又例如, 参阅图 4所示, 可以先判断最后获得的 m的奇偶性(即 X的最小正 整数取值的奇偶性),若 m为奇数,则将 m右移设定位数后的结果作为参数 W的 取值, 如, 釆用公式 w = >> 1计算参数 W的取值, 其中, >>为向右移位操作, 1为右移的设定位数, 即表示将 m的当前取值的最低位(二元扩域形式) 删除, 再将最高位补零; 若 m为偶数, 则将 m右移设定位数后再减去第三预设 参数的结果作为参数 W的取值, 如, 釆用公式 w = (w » l) — 1计算参数 W的取 值, 其中, 第一个 1为右移设定位数, 第二个 1为第三预设参数。
步骤 220: 基于获得的参数 W的取值与协商对端进行密钥协商。
参阅图 2所示,实现 SM2密钥交换协议的密钥协商装置即可作为发起方用户 A, 也可作为响应方用户 B , 其中, 第一控制模块 10即是计算参数 W的运算模 块, 密钥协商装置通过第一控制模块 10获得参数 W后, 与对端进行密钥协商的 过程如下:
在 SM2密钥交换协议流程启动后, 用户发起方 A和用户响应方 B通过各自 使用的密钥协商装置内设置的第一控制模块 10分别获得相应的参数 W,
接着, 用户 A通过密钥协商装置内的第二控制模块 11计算随机数和椭圆曲 线点, 其中, 第二控制模块 11 可以通过硬件方式实现, 参阅图 1所示, 用户 A 可以通过第二控制模块 11 内的随机数发生单元生成随机数 e "— 1] , 而 ECC 运算单元可以基于生成的随机数产生椭圆曲线点 二^ ^二 ,3"1 ) , 同时, 第 二控制模块 11 将本密钥协商装置中密钥存储子模块内保存的参与本次密钥协商 所用到的私钥 相对应的公钥 取出,并将公钥75 ^通过本地以软件形式实现的通 信接口将椭圆曲线点 Ra和公钥 Pa发送给用户 B;
用户 B使用的密钥协商装置 B从用户 A接收的信息中主要包括: 对方公钥
PA、 对方椭圆曲线点 、 对方用户信息 同时获取本地用户信息 Ζΰ、 椭圆 曲线余因子参数 h、 协商密钥预期长度 klen;
用户 B釆用本地第二控制模块 11计算随机数和椭圆曲线点, 其中, 第二控 制模块 11可以通过硬件方式实现, 如, 用户 B可以通过第二控制模块 11内的随 机数发生单元生成随机数 "— 1] , 接着, 通过第二控制模块 11 内的 ECC运 算单元可以基于生成的随机数产生椭圆曲线点 [^ ^二 ^23"2 ) , 同时, 第二 控制模块 11 将本密钥协商装置中密钥存储单元内保存的参与本次密钥协商所用 到的私钥 dB相对应的公钥 Ps取出,并通过本地以软件形式实现的通信接口将椭圆 曲线点 Rb和公钥 PB发送给用户 A;
接着, 用户 B可以釆用本地第二控制模块 11 内以软件形式实现的数据类型 转换单元将获得的域元素 和 的数据类型转化成整数数据类型, 然后, 调用 第二控制单元 11 内以软件形式实现的 x参数运算单元, 基于已获得的参数 W, 釆用公式 x =2W +(X & (2W_ 分别计算出参数 ^和 其中, χ'为椭圆曲线点 的横坐标, 为椭圆曲线点 横坐标, 此处便使用到了釆用本发明实施例 提供的方案生成的参数 W。 接着, 用户 B通过密钥协商装置将对端公钥 ?A、 对端椭圆曲线点 Ra、 本地 釆用的椭圆曲线余因子参数 参数 Xl 、 参数 ^传输至第二控制模块 11内的硬 件实现部分, 并调用其中的大整数运算单元完成 ίβ (^+^^^mod"运算, 其中私钥 是从第二控制模块 11中以硬件形式实现的密钥存储单元中读取出的, 相关运算主要包括, 先釆用大整数模乘运算计算出 / = 再釆用大整数 模加运算计算
Figure imgf000009_0001
用户 B 继续调用上述大整数运算单元完成
/ = ^'^]运算, 相关运算主要包括大整数乘运算。
然后, 用户 B釆用第二控制模块 11内以硬件形式实现的 ECC运算单元完成 是否满足椭圆曲线方程的验证,再完成 = /(^ + [ ]^) = (½'^)运算,相关 运算主要包括: 通过 ECC点乘运算计算出5 = ^」 , 通过 ECC点加运算计算出 g = 然后再次通过 ECC点乘运算计算出 ^ ^^ (^,"^)。 用户 B通过密钥协商装置中的第二控制模块 11将7^是否满足椭圆曲线方程 的验证结果及椭圆曲线点 = ( ' )传输至软件实现部分,如果 不满足椭圆曲 线方程, 或, = (W 为椭圆曲线无穷远点, 则结束运算; 否则用户 B通过第二 控制模块 11 中以软件形式实现的数据类型转换单元将椭圆曲线点 = ( ' )中横 坐标 ^ 和纵坐标 ^ 的数据类型转换为比特串数据类型, 用户 B通过第二控制 模块 11 中以软件形式实现的密钥派生单元计算用户 B 本地的协商密钥
KB = KDF v II yv II ZA II ZB en) 至此, 用户 β 可以默认密胡协商成 功。
当然, 可选的, 用户 Β还可以进一步通过第二控制模块 11 中通过软件形式 实现的数据类型转换单元将椭圆曲线点 '3"1)横坐标 Xl、 纵坐标 和椭圆 曲线点 Re = ( '^)横坐标 ^、 纵坐标 的数据类型转换为比特串数据类型, 然 后,通过第二控制模块 11中以软件形式实现的密码杂凑计算单元计算出如下校验 信息:
SB=Ha^(0x02||^||Ha^(xf,||ZJ|ZB||^ || -1 ||x2 || '2))
= ash(0x03 II yv || Hash{xv \\ZA \\ ZB || || || x21| y2 )) 用户 B将校验信息 Sb通过以软件形式的传输接口传输到用户 A。 发起方 A所属密钥协商装置接收用户 B发送的信息,获得用户 B的公钥 PB、 用户 B椭圆曲线点 Rb、 用户 B的用户信息 B、 以及获取本地用户信息 、 椭圆 曲线余因子参数 h、 协商密钥预期长度 klen, 而后釆用与用户 B相同的流程计算 出的:
KA =KDF{xu \\yu \\ZA \\ZB,klen)
至此, 发起方 A也可以默认密钥协商成功。 进一步地, 若用户 A接收到用户 B发送的校验信息 , 则也需要釆用相同 流程计算出以下验证信息:
S, =Hash(0x02\\ γυ ||Ha^(½ || ZA || ZB || xx || yx || x21| y2))
SA = Hash (0x031| γυ \\Hash(xu || ZA || ZB || xl || yl || x21| y2)) 然后校验 是否与 相等, 如果相等, 则确认密钥协商成功, 若不相等, 则确认密钥协商失败, 并将 发送给用户 B;
用户 B验证 是否等于&, 如果相等, 则确认密钥协商成功, 如果不相等, 则确认密钥协商失败。 至此, SM2密钥交换协议中制定的 SM2密钥协商流程完全结束。
综上所述, 本发明实施例中, 协商双方均根据令不等式" 成立的 X取值 中的最小正整数值, 来计算参数 W, 并根据该参数 W与协商对端进行基于 SM2 密钥交换协议的密钥协商。 其中, 参数 W的计算过程, 可以在实际协商流程启动 之前执行, 或者, 在实际协商流程启动之后执行, 均可实现相同效果。 相较于釆 用先计算 log2 ( n )对数值再向上取整的方式计算参数 W的方法, 有效地减少了 计算量, 并且降低了算法的实现复杂度,从而在很大程度上提高了基于 SM2密钥 交换协议的密钥协商流程的实现效率,进而优化了 SM2密钥交换协议的工程化实 现。
本领域内的技术人员应明白, 本发明的实施例可提供为方法、 系统、 或计算 机程序产品。 因此, 本发明可釆用完全硬件实施例、 完全软件实施例、 或结合软 件和硬件方面的实施例的形式。 而且, 本发明可釆用在一个或多个其中包含有计 算机可用程序代码的计算机可用存储介盾(包括但不限于磁盘存储器、 CD-ROM, 光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备 (系统)、和计算机程序产品的 流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流程图和 /或方 框图中的每一流程和 /或方框、 以及流程图和 /或方框图中的流程和 /或方框的 结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入式处理机或 其他可编程数据处理设备的处理器以产生一个机器, 使得通过计算机或其他可编 程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程 和 /或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以 特定方式工作的计算机可读存储器中, 使得存储在该计算机可读存储器中的指令 产生包括指令装置的制造品, 该指令装置实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使得 在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理, 从 而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多 个流程和 /或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例, 但本领域内的技术人员一旦得知了基本 创造性概念, 则可对这些实施例作出另外的变更和修改。 所以, 所附权利要求意 欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然, 本领域的技术人员可以对本发明实施例进行各种改动和变型而不脱离 本发明实施例的精神和范围。 这样, 倘若本发明实施例的这些修改和变型属于本 发明权利要求及其等同技术的范围之内, 则本发明也意图包含这些改动和变型在 内。

Claims

权 利 要 求
1、 一种基于 SM2密钥交换协议的密钥协商方法, 其特征在于, 包括: 确定本次密钥协商所使用的椭圆曲线参数阶 n的取值;
计算所述阶 n小于或等于 2X时, X的最小正整数值, 并基于获得的 X的最 小正整数值获得参数 W的取值;
基于所述参数 W的取值与协商对端进行密钥协商。
2、 如权利要求 1所述的方法, 其特征在于, 计算所述阶 n小于或等于 2 †, X的最小正整数值, 包括:
获取所述阶 n的有效比特数 m;
判断阶 n的取值是否大于 的取值, 若是, 则直接将 m的当前取值作为所 述 X的最小正整数值; 否则, 釆用设定步长值对 m逐次进行减小, 每减少一次, 将阶 n的取值与 2∞_1的取值进行一次比较, 直到前者大于后者为止, 并将 m的最 后取值作为所述 X的最小正整数值。
3、 如权利要求 2所述的方法, 其特征在于, 基于获得的 X的最小正整数值 获得参数 W的取值, 包括:
判断 X的最小正整数值为奇数还是偶数,若为奇数, 则将 X的最小正整数值 除以第一预设参数并进行向下取整后的结果作为参数 W的取值; 若为偶数, 则将 X的最小正整数值除以第一预设参数并进行向下取整后再减去第二预设参数。
4、 如权利要求 2所述的方法, 其特征在于, 基于获得的 X的最小正整数值 获得参数 W的取值, 包括:
判断 X的最小正整数值为奇数还是偶数,若为奇数, 则将 X的最小正整数值 右移设定位数后的结果作为参数 W的取值; 若为偶数, 则将 X的最小正整数值 右移设定位数后再减去第三预设参数的结果作为参数 W的取值。
5、 如权利要求 1 _ 4任一项所述的方法, 其特征在于, 基于所述 W的取值与 协商对端进行密钥协商, 包括:
接收协商对端发送的对端公钥 PA、 对端椭圆曲线点 RA、 对端用户信息 ZA , 以及获取本地用户信息 、 本地私钥 < 、 本地生成的随机数 、 本地生成的椭 圆曲线点 RB、 本地椭圆曲线余因子参数 h和协商密钥预期长度 klen; 基于已获得的参数 w, 分别根据椭圆曲线点 RA的横坐标 和椭圆曲线点 RB 的横坐标 Λ½ , 釆用 SM2密钥交换协议规定的方式生成相应的参数 和 ; 根据本地椭圆曲线余因子参数 h, 本地私钥 <¾ , 所述参数 ^和¾、 对端公 钥 PA、对端椭圆曲线点 , 本地生成随机数 rs , 釆用 SM2密钥交换协议规定的 方式生成椭圆曲线点 V, 其坐标值为(½, ) ; 根据椭圆曲线点 V的横坐标 和纵坐标 , 对端用户信息 ZA , 本地用户 信息 以及协商密钥预期长度 klen, 釆用 SM2密钥交换协议规定的方式生成 本地协商密钥 。
6、 如权利要求 5的方法, 其特征在于, 生成本地协商密钥 后, 包括: 默认与协商对端的密钥协商成功; 或者, 根据所述椭圆曲线点的横坐标 和纵坐标 , 椭圆曲线点 RA的横坐标 ^ 和纵坐标 yi , 椭圆曲线点^ J的横坐标 _¾和纵坐标 y2 , 对端用户信息 Ζ^ , 本地 用户信息 ΖΒ ,釆用 SM2密钥交换协议规定的方式计算验证信息 SB和验证信息 S2 , 并将验证信息 SB发送至协商对端,令协商对端接收到验证信息 后,釆用相同方 式生成验证信息 和验证信息 S , 并在确认 和 S相等时, 确定本地至协商对 端的密钥协商成功, 以及接收协商对端发送的验证信息 并在确认 和&相 等时, 确定协商对端至本地的密钥协商成功。
7、 一种基于 SM2密钥交换协议的密钥协商的装置, 其特征在于, 包括: 第一控制模块, 用于确定本次密钥协商所使用的椭圆曲线参数阶 n的取值, 并计算所述阶 n小于或等于 2 †, X的最小正整数值, 并基于获得的 X的最小 正整数值获得参数 W的取值;
第二控制模块, 用于基于所述参数 W的取值与协商对端进行密钥协商。
8、 如权利要求 7所述的装置, 其特征在于, 所述第一控制模块计算所述阶 n 小于或等于 2 †, X的最小正整数值时, 获取所述阶 n的有效比特数 m, 判断阶 n的取值是否大于 2∞1的取值, 若是, 则直接将 m的当前取值作为所述 X的最小 正整数值; 否则, 釆用设定步长值对 m逐次进行减小, 每减少一次, 将阶 n的取 值与 2∞_1的取值进行一次比较, 直到前者大于后者为止, 并将 m的最后取值作为 所述 X的最小正整数值。
9、 如权利要求 8所述的装置, 其特征在于, 所述第一控制模块基于获得的 X 的最小正整数值获得参数 W的取值时, 判断 X的最小正整数值为奇数还是偶数, 若为奇数, 则将 X的最小正整数值除以第一预设参数并进行向下取整后的结果作 为参数 W的取值; 若为偶数, 则将 X的最小正整数值除以第一预设参数并进行 向下取整后再减去第二预设参数后的结果作为参数 W的取值。
10、 如权利要求 8所述的装置, 其特征在于, 所述第一控制模块基于获得的 X的最小正整数值获得参数 W的取值时, 判断 X的最小正整数值为奇数还是偶 数, 若为奇数, 则将 X的最小正整数值右移设定位数后的结果作为参数 W的取 值; 若为偶数, 则将 X的最小正整数值右移设定位数后再减去第三预设参数的结 果作为参数 W的取值。
11、 如权利要求 8 _ 10任一项所述的装置, 其特征在于, 所述第二控制模块 基于所述 W的取值与协商对端进行密钥协商时, 执行以下操作:
接收协商对端发送的对端公钥 PA、 对端椭圆曲线点 RA、 对端用户信息 ΖΑ , 以及获取本地用户信息 、 本地私钥 < 、 本地生成的随机数 、 本地生成的椭 圆曲线点 RB、 本地椭圆曲线余因子参数 h和协商密钥预期长度 klen; 基于已获得的参数 W, 分别根据椭圆曲线点 RA的横坐标 和椭圆曲线点 RB 的横坐标 Λ½ , 釆用 SM2密钥交换协议规定的方式生成相应的参数 和 ; 根据本地椭圆曲线余因子参数 h, 本地私钥 <¾ , 所述参数 ^和¾、 对端公 钥 PA、对端椭圆曲线点 RA , 本地生成的随机数 rB , 釆用 SM2密钥交换协议规定 的方式生成椭圆曲线点 V, 其坐标值为( , ); 根据椭圆曲线点 V的横坐标 和纵坐标 , 对端用户信息 ΖΑ , 本地用户 信息 以及协商密钥预期长度 klen, 釆用 SM2密钥交换协议规定的方式生成 本地协商密钥 。
12、 如权利要求 11的装置, 其特征在于, 所述第一控制模块生成本地协商密 钥 后, 默认与协商对端的密钥协商成功; 或者, 根据所述椭圆曲线点的横坐 标 X 和纵坐标 , 椭圆曲线点 RA的横坐标 和纵坐标^ , 椭圆曲线点 RB的 横坐标 x2和纵坐标 y2 , 对端用户信息 ΖΑ , 本地用户信息 ΖΒ , 釆用 SM2密钥交 换协议规定的方式计算验证信息 SB和验证信息 S2 , 并将验证信息 发送至协商 对端, 令协商对端接收到验证信息 后, 釆用相同方式生成验证信息 和验证 信息 并在确认 和 S相等时, 确定本地至协商对端的密钥协商成功, 以及 接收协商对端发送的验证信息 , 并在确认 和&相等时, 确定协商对端至本 地的密钥协商成功。
13、 一种参数生成装置, 其特征在于, 包括:
确定单元, 用于确定本次密钥协商所使用的椭圆曲线参数阶 n的取值; 计算单元, 用于计算所述阶 n小于或等于 2 †, X的最小正整数值, 并基于 获得的 X的最小正整数值获得参数 W的取值。
14、 如权利要求 13 所述的装置, 其特征在于, 所述计算单元计算所述阶 n 小于或等于 2 †, X的最小正整数值时, 获取所述阶 n的有效比特数 m, 并判断 阶 n的取值是否大于 21的取值 , 若是, 则直接将 m的当前取值作为所述 X的最 小正整数值; 否则, 釆用设定步长值对 m逐次进行减小, 每减少一次, 将阶 n的 取值与 2∞_1的取值进行一次比较, 直到前者大于后者为止, 并将 m的最后取值作 为所述 X的最小正整数值。
15、 如权利要求 13 所述的装置, 其特征在于, 所述计算单元基于获得的 X 的最小正整数值获得参数 W的取值时, 判断 X的最小正整数值为奇数还是偶数, 若为奇数, 则将 X的最小正整数值除以第一预设参数并进行向下取整后的结果作 为参数 W的取值; 若为偶数, 则将 X的最小正整数值除以第一预设参数并进行 向下取整后再减去第二预设参数的结果作为参数 W的取值。
16、 如权利要求 13 所述的装置, 其特征在于, 所述计算单元基于获得的 X 的最小正整数值获得参数 W的取值时, 判断 X的最小正整数值为奇数还是偶数, 若为奇数, 则将 X的最小正整数值右移设定位数后的结果作为参数 W的取值; 若为偶数, 则将 X的最小正整数值右移设定位数后再减去第三预设参数的结果作 为 W的取值。
PCT/CN2012/085233 2011-11-30 2012-11-26 基于sm2密钥交换协议的密钥协商方法及装置 WO2013078970A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2014543759A JP6014678B2 (ja) 2011-11-30 2012-11-26 Sm2鍵交換プロトコルに基づく鍵交渉方法及び装置
KR1020147017887A KR101617561B1 (ko) 2011-11-30 2012-11-26 Sm2 키 교환 프로토콜 기반의 키 협상 방법 및 장치
US14/361,750 US9313026B2 (en) 2011-11-30 2012-11-26 Key negotiation method and apparatus according to SM2 key exchange protocol
EP12852494.9A EP2787682B1 (en) 2011-11-30 2012-11-26 Key negotiation method and apparatus according to sm2 key exchange protocol

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110390564.7 2011-11-30
CN201110390564.7A CN102412971B (zh) 2011-11-30 2011-11-30 基于sm2密钥交换协议的密钥协商方法及装置

Publications (1)

Publication Number Publication Date
WO2013078970A1 true WO2013078970A1 (zh) 2013-06-06

Family

ID=45914836

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/085233 WO2013078970A1 (zh) 2011-11-30 2012-11-26 基于sm2密钥交换协议的密钥协商方法及装置

Country Status (6)

Country Link
US (1) US9313026B2 (zh)
EP (1) EP2787682B1 (zh)
JP (1) JP6014678B2 (zh)
KR (1) KR101617561B1 (zh)
CN (1) CN102412971B (zh)
WO (1) WO2013078970A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109547209A (zh) * 2018-11-19 2019-03-29 北京大学 一种两方sm2数字签名生成方法
CN112688784A (zh) * 2020-12-23 2021-04-20 安徽中科美络信息技术有限公司 一种数字签名、验证方法、装置及系统
CN113612799A (zh) * 2021-08-25 2021-11-05 中国银行股份有限公司 一种基于sm2算法的区块链哈希加密方法及装置
CN114329518A (zh) * 2021-12-10 2022-04-12 奇安信科技集团股份有限公司 软件密码模块账号的加密和解密方法及装置
CN115499832A (zh) * 2022-11-14 2022-12-20 济南职业学院 一种工业无线通信安全方法

Families Citing this family (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102412971B (zh) * 2011-11-30 2015-04-29 西安西电捷通无线网络通信股份有限公司 基于sm2密钥交换协议的密钥协商方法及装置
WO2015062239A1 (zh) * 2013-11-04 2015-05-07 华为技术有限公司 密钥协商处理方法和装置
CN104702566B (zh) * 2013-12-06 2021-08-06 苏州海博智能系统有限公司 一种虚拟设备的授权使用方法及装置
US10503510B2 (en) 2013-12-27 2019-12-10 Intel Corporation SM3 hash function message expansion processors, methods, systems, and instructions
WO2015184991A1 (en) * 2014-06-04 2015-12-10 Jintai Ding Improvements on cryptographic systems using pairing with errors
US9317719B2 (en) 2014-09-04 2016-04-19 Intel Corporation SM3 hash algorithm acceleration processors, methods, systems, and instructions
US9658854B2 (en) 2014-09-26 2017-05-23 Intel Corporation Instructions and logic to provide SIMD SM3 cryptographic hashing functionality
EP3373505A1 (en) * 2017-03-06 2018-09-12 Koninklijke Philips N.V. Device and method for sharing a matrix for use in a cryptographic protocol
CN107579811A (zh) * 2017-07-28 2018-01-12 广州星海集成电路基地有限公司 一种基于sm3密码杂凑算法的硬件优化方法
CN107689867B (zh) * 2017-09-08 2019-12-10 晋商博创(北京)科技有限公司 一种在开放环境下的密钥保护方法和系统
CN107896147B (zh) * 2017-12-07 2020-07-28 福建联迪商用设备有限公司 一种基于国密算法协商临时会话密钥的方法及其系统
CN108566375A (zh) * 2018-03-12 2018-09-21 深圳壹账通智能科技有限公司 基于区块链的多端间消息通信的方法、终端及存储介质
CN110730184B (zh) * 2019-10-22 2021-11-05 江苏先安科技有限公司 一种基于国密sm2算法的新型招投标加解密方法
CN111147250B (zh) * 2019-12-18 2022-08-02 北京江南天安科技有限公司 一种数字签名方法、装置、发送端、接收端及系统
CN111555879B (zh) * 2020-07-13 2021-01-05 南京凯瑞得信息科技有限公司 一种卫星通信网管信道报文加解密方法及系统
CN111953489A (zh) * 2020-08-31 2020-11-17 中国电力科学研究院有限公司 基于sm2算法的发电单元采集业务的密钥交换设备及方法
CN112529313B (zh) * 2020-12-17 2022-12-09 中国航空综合技术研究所 基于协商策略的智能人机工程设计优化方法
CN113660087B (zh) * 2021-07-06 2023-09-26 浙江传媒学院 一种基于有限域的sm9标识密码算法硬件实现系统
CN114070561A (zh) * 2022-01-17 2022-02-18 工业信息安全(四川)创新中心有限公司 一种基于sm2算法的零知识证明方法和系统
CN114338047A (zh) * 2022-03-08 2022-04-12 科大天工智能装备技术(天津)有限公司 基于国密的区块链工业数据加密方法、装置及存储介质
CN115174086B (zh) * 2022-07-11 2023-06-27 三未信安科技股份有限公司 基于sm2椭圆曲线的二分之一概率密钥协商方法
CN116032490B (zh) * 2023-01-09 2023-10-03 郑州轻工业大学 一种基于改进SM2算法的Fabric区块链构建方法
CN117041961B (zh) * 2023-09-05 2024-06-11 北京电子科技学院 基于sm2无证书的车联网终端认证方法及系统
CN117436043A (zh) * 2023-12-20 2024-01-23 鼎铉商用密码测评技术(深圳)有限公司 待执行文件的来源验证方法、设备以及可读存储介质
CN117811737A (zh) * 2023-12-29 2024-04-02 北京海泰方圆科技股份有限公司 一种数据处理方法、装置及电子设备
CN117811730B (zh) * 2023-12-29 2024-06-25 北京天融信网络安全技术有限公司 国密密钥协商方法、装置、计算设备及可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1831754A (zh) * 2005-11-04 2006-09-13 北京浦奥得数码技术有限公司 一种椭圆曲线密码系统及实现方法
CN101291214A (zh) * 2007-04-19 2008-10-22 华为技术有限公司 一种生成组密钥的方法、系统和设备
CN102412971A (zh) * 2011-11-30 2012-04-11 西安西电捷通无线网络通信股份有限公司 基于sm2密钥交换协议的密钥协商方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2542556C (en) * 2005-06-03 2014-09-16 Tata Consultancy Services Limited An authentication system executing an elliptic curve digital signature cryptographic process
EP2359523B1 (en) 2008-12-16 2017-04-05 Certicom Corp. Acceleration of key agreement protocols
CN102111681B (zh) * 2009-12-24 2012-12-12 航天信息股份有限公司 一种用于数字电视广播条件接收系统的密钥系统
CN102111266B (zh) * 2009-12-28 2014-01-15 航天信息股份有限公司 基于椭圆曲线的组密钥产生方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1831754A (zh) * 2005-11-04 2006-09-13 北京浦奥得数码技术有限公司 一种椭圆曲线密码系统及实现方法
CN101291214A (zh) * 2007-04-19 2008-10-22 华为技术有限公司 一种生成组密钥的方法、系统和设备
CN102412971A (zh) * 2011-11-30 2012-04-11 西安西电捷通无线网络通信股份有限公司 基于sm2密钥交换协议的密钥协商方法及装置

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109547209A (zh) * 2018-11-19 2019-03-29 北京大学 一种两方sm2数字签名生成方法
CN112688784A (zh) * 2020-12-23 2021-04-20 安徽中科美络信息技术有限公司 一种数字签名、验证方法、装置及系统
CN113612799A (zh) * 2021-08-25 2021-11-05 中国银行股份有限公司 一种基于sm2算法的区块链哈希加密方法及装置
CN113612799B (zh) * 2021-08-25 2022-11-18 中国银行股份有限公司 一种基于sm2算法的区块链哈希加密方法及装置
CN114329518A (zh) * 2021-12-10 2022-04-12 奇安信科技集团股份有限公司 软件密码模块账号的加密和解密方法及装置
CN115499832A (zh) * 2022-11-14 2022-12-20 济南职业学院 一种工业无线通信安全方法
CN115499832B (zh) * 2022-11-14 2023-01-17 济南职业学院 一种工业无线通信安全方法

Also Published As

Publication number Publication date
CN102412971A (zh) 2012-04-11
EP2787682A4 (en) 2015-09-30
JP6014678B2 (ja) 2016-10-25
US20150124970A1 (en) 2015-05-07
JP2015500582A (ja) 2015-01-05
EP2787682B1 (en) 2018-09-05
CN102412971B (zh) 2015-04-29
KR101617561B1 (ko) 2016-05-02
US9313026B2 (en) 2016-04-12
KR20140105504A (ko) 2014-09-01
EP2787682A1 (en) 2014-10-08

Similar Documents

Publication Publication Date Title
WO2013078970A1 (zh) 基于sm2密钥交换协议的密钥协商方法及装置
US11050557B2 (en) Key agreement devices and method
WO2017202161A1 (zh) 基于无证书两方认证密钥协商方法、装置和存储介质
US10038561B2 (en) Method and device for generating digital signature
WO2018026323A1 (zh) 一种数据处理的方法和装置
CA2827519C (en) Incorporating data into cryptographic components of an ecqv certificate
JP6067932B2 (ja) 鍵共有デバイス及び方法
BR112019016779A2 (pt) Primeiro nó de rede eletrônico, método de troca de chave eletrônica para um primeiro nó de rede eletrônico, e mídia legível por computador
US8681986B2 (en) Single-round password-based key exchange protocols
WO2015035861A1 (zh) 无证书多重代理签名的方法和装置
CN111010277B (zh) 密钥交换方法、装置和存储介质、计算装置
WO2022120699A1 (zh) 单向代理重加密方法、装置、电子设备及系统
CN109698747B (zh) 一种基于双线性对的身份基身份匿藏密钥协商方法
JP2019537349A (ja) 複合デジタル署名
CN114338047A (zh) 基于国密的区块链工业数据加密方法、装置及存储介质
CN1464678A (zh) 基于半群上离散对数问题的数字签名及验证的方法
CN114726543B (zh) 基于报文链的密钥链生成、报文发送及接收方法及装置
CN116582265B (zh) 密钥协商方法和密钥协商系统
JP5295048B2 (ja) 情報共有システム、方法及びプログラム
WO2008148274A1 (fr) Procédé et système de codage et de décodage de message numérique
JP2015082804A (ja) デジタル署名システム、通信装置、デジタル署名方法およびプログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12852494

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2014543759

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 14361750

Country of ref document: US

WWE Wipo information: entry into national phase

Ref document number: 2012852494

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 20147017887

Country of ref document: KR

Kind code of ref document: A