SM2 digital signature
China's national elliptic-curve signature algorithm (GB/T 32918)
Overview
SM2 is the Chinese national standard for elliptic-curve public-key cryptography, covering signatures, key exchange and encryption. The signature part is an ECDSA-like scheme on a 256-bit prime curve, used with the SM3 hash function.
SM2 signatures use a dedicated 256-bit prime-field curve specified in the standard. Before hashing the message, the signer computes Z_A, a hash over the user's distinguishing identifier, curve parameters and public key, and prepends it to the message, binding signatures to a specific identity. The signing equation differs from ECDSA: the signature (r, s) satisfies s = (1 + d)^-1 (k - r*d), which avoids computing a modular inverse of the nonce.
SM2 is mandated for many applications in China and is registered for TLS 1.3 by RFC 8998, together with SM3 and SM4. One variant, sm2-sign, is present; NextSSL classifies it as research because it has not yet been verified against the full set of official vectors. Beyond signatures, the SM2 standard also defines a key exchange protocol and a public-key encryption scheme, which are not part of this family.
History
2010–2021SM2 published by the Chinese State Cryptography Administration
Standardised as GB/T 32918
Used in TLS 1.3 via RFC 8998
How it works
- KeyGen picks a scalar d and publishes P = dG on the SM2 curve.
- Sign computes e = SM3(Z_A || M), picks a nonce k, and sets r = (e + x(kG)) mod n.
- It computes s = (1 + d)^-1 (k - r*d) mod n and outputs (r, s).
- Verify computes t = r + s and checks that r equals e + x(sG + tP) mod n.
Security notes
Not post-quantum. Like ECDSA, nonce reuse or bias leaks the private key, and the identifier used in Z_A must match between signer and verifier for signatures to validate.
Typical uses
Variants in NextSSL
1| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| SM2-Sign sm2-sign |
research | pk 65 · sk 32 · sig 64 · seed 32 · ctx 0 | GB/T 32918.2, RFC 8998 | root |
Frequently asked questions
Which SM2 digital signature variants does NextSSL include?
NextSSL registers 1 SM2 digital signature variant: sm2-sign.