Principle and Implementation of SM2 Algorithm

The crisis of the RSA algorithm is that it is purely an exponential algorithm, and there is generally no sub-exponential attack algorithm for the ECC algorithm.

SM2 elliptic curve public key cryptographic algorithm: a commercial cryptographic algorithm with independent intellectual property rights in my country, which is a type of ECC (Elliptic Curve Cryptosystem) algorithm, based on the elliptic curve discrete logarithm problem, the computational complexity is exponential, and the solution is more difficult, equivalent Under the requirement of security level, elliptic curve cryptography is much smaller than other public keys in seconds.

ECC algorithm description:

  1. User A selects an elliptic curve Ep(a,b) suitable for encryption (eg: y2=x3+ax+b), and takes a point on the elliptic curve as the base point G. 2. User A selects a private key k and generates a public key (public key PB) K=kG. 3. User A transmits Ep(a, b) and points (public keys) K and G to user B. 4. After receiving the information, user B encodes the plaintext (M) to be transmitted to a point M on Ep(a, b), and generates a random integer r (r<n). Encryption starts 5. User B calculates points C1=M+rK; C2=rG. 6. User B transmits C1 and C2 to user A. 7. After receiving the information, user A calculates C1-kC2, and the result is point M. Because C1-kC2=M+rK-k(rG)=M+rK-r(kG)=M and then decoding point M can get the plaintext.

  In cryptography, to describe an elliptic curve on Fp, six parameters are commonly used: T=(p,a,b,G,n,h). (p, a, b are used to determine an elliptic curve, G is the base point, n is the order of point G, h is the integer part of the division of m and n, the number of all points on the elliptic curve)

  The choice of the values ​​of these parameters directly affects the security of encryption. The parameter value generally needs to meet the following conditions:

  1. Of course, the larger p is, the safer it is, but the larger the value, the slower the calculation speed. About 200 bits can meet the general security requirements;

  2、p≠n×h;

  3. pt≠1 (mod n), 1≤t<20; 4. 4a3+27b2≠0 (mod p); 5. n is a prime number; 6. h≤4.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325235796&siteId=291194637