Home > Tools > SM2 Chinese Crypto

SM2 Chinese Cryptographic Algorithm

Elliptic curve cryptography per GM/T 0003-2012. Generate key pairs, encrypt/decrypt, sign/verify — all in-browser.

1. SM2 Key Pair

-
-

2. Encryption / Decryption

3. Sign / Verify

SM2 is an elliptic curve cryptographic algorithm standardized by the Chinese State Cryptography Administration (GM/T 0003-2012). It uses the SM2 curve (256-bit prime field) and is paired with SM3 hashing. This tool uses the sm-crypto JavaScript library.

SM2 encryption uses C1C2C3 format (hex output). Signatures use r||s format (raw concatenation). The public key is in compressed format (02/03 prefix + 64 hex chars).

How to Use

Encrypt: Generate a key pair. Enter plaintext, click "Encrypt with Public Key". The output is a hexadecimal C1C2C3 ciphertext string.

Decrypt: Paste a hex C1C2C3 ciphertext, ensure the private key matches, click "Decrypt with Private Key".

Sign: Enter a message, click "Sign with Private Key". The message is first hashed with SM3, then signed. Output is hex r||s (64 bytes = 128 hex chars).

Verify: Enter the original message and the hex signature, click "Verify with Public Key".

When to Use SM2 vs RSA vs ECDSA

Example Use Cases