Digital signatures

SM2-Sign

China's national elliptic-curve signature algorithm (GB/T 32918)

research Root API only
Research tier.

Experimental or unclassified. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.

About SM2-Sign

SM2-Sign is a digital signature scheme from the SM2 digital signature family. It uses a 65-byte public key, a 32-byte secret key, a 64-byte signature and a 32-byte seed. Its registry entry cites GB/T 32918.2 and RFC 8998. It is also known as sm2-dsa. NextSSL lists it in the research tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).

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–2021
  1. SM2 published by the Chinese State Cryptography Administration

  2. Standardised as GB/T 32918

  3. Used in TLS 1.3 via RFC 8998

How it works

  1. KeyGen picks a scalar d and publishes P = dG on the SM2 curve.
  2. Sign computes e = SM3(Z_A || M), picks a nonce k, and sets r = (e + x(kG)) mod n.
  3. It computes s = (1 + d)^-1 (k - r*d) mod n and outputs (r, s).
  4. 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

Compliance with Chinese commercial cryptography regulationsTLS 1.3 with ShangMi cipher suites (RFC 8998)Interoperability with Chinese PKI systems

Sizes

FieldBytesMeaning
pk65Public key
sk32Secret key
sig64Signature
seed32Seed
ctx0Context string

Use it

from nextssl_demo import NextSSL

root = NextSSL(root=True)   # tier 'research' is reachable from the root API only
pk, sk = root.call("sign_keygen", "sm2-sign", None, outs=2)
sig = root.call("sign_detached", "sm2-sign", None, sk, b"message", b"")[0]
ok  = root.check("verify_detached", "sm2-sign", None, pk, b"message", b"", sig)

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Similar names

Looking for something else?

Frequently asked questions

What is SM2-Sign?

SM2-Sign is a signature in the SM2 digital signature family. SM2 is the Chinese national standard for elliptic-curve public-key cryptography, covering signatures, key exchange and encryption. It is also known as sm2-dsa.

What are the SM2-Sign sizes?

In NextSSL, SM2-Sign uses: public key 65 bytes, signature 64 bytes.

Is SM2-Sign post-quantum?

No. SM2-Sign is a classical signature based on elliptic curves or discrete logarithms, which a large quantum computer running Shor's algorithm could break. For post-quantum use, look at ML-DSA or SLH-DSA.

Who designed SM2-Sign and when?

SM2-Sign belongs to the SM2 digital signature family, first published in 2010. Its origin: GB/T 32918.2 (China); RFC 8998.

Which standards define SM2-Sign?

SM2-Sign is referenced by GB/T 32918.2, RFC 8998.

Is SM2-Sign safe to use?

SM2-Sign is in the research tier. Experimental or unclassified. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).