SM2 Encryption — Chinese Asymmetric Crypto Tool Online
SM2 elliptic curve cryptography tool for key generation, encryption, decryption, and digital signatures. Supports C1C3C2 and C1C2C3 modes.
Features
- ✓Generate SM2 key pairs (256-bit elliptic curve)
- ✓Encrypt data with public key
- ✓Decrypt ciphertext with private key
- ✓Sign messages with private key
- ✓Verify signatures with public key
- ✓Support C1C3C2 and C1C2C3 cipher modes
- ✓Compressed public key support (66 chars)
- ✓SM3 hash integration for signatures
- ✓Chinese national standard GM/T 0003
- ✓All operations performed locally in browser
How to Use
- 1Key Generation: Click 'Generate Key Pair' to create a new SM2 key pair.
- 2Encryption: Enter plaintext and public key, then click 'Encrypt'.
- 3Decryption: Enter ciphertext and private key, then click 'Decrypt'.
- 4Signing: Enter message and private key, then click 'Sign'.
- 5Verification: Enter message, signature, and public key, then click 'Verify'.
- 6Choose cipher mode: C1C3C2 (default, recommended) or C1C2C3 for compatibility with specific systems.
- 7Toggle compressed public key format (66 chars) vs uncompressed (130 chars) for space-efficient storage.
- 8Use SM3 hash integration for signatures — the tool automatically computes the message hash before signing.
Frequently Asked Questions
What is SM2?
∨
SM2 is a public-key cryptographic algorithm based on elliptic curves, published by the Chinese State Cryptography Administration (SCA) in 2010. It's part of the Chinese national cryptographic standard (GM/T 0003) and is mandatory for certain government and financial applications in China. SM2 provides 128-bit security level, comparable to RSA-3072 or NIST P-256.
What's the difference between C1C3C2 and C1C2C3 modes?
∨
These are two different ciphertext formats defined in the SM2 standard. C1C3C2 (mode 1) is the default and recommended format: C1 (elliptic curve point) + C3 (hash value) + C2 (encrypted data). C1C2C3 (mode 0) is an alternative format. Both provide the same security level. Use C1C3C2 unless you have specific compatibility requirements.
How does SM2 compare to RSA and ECDSA?
∨
SM2 is based on a 256-bit elliptic curve, providing 128-bit security. This is equivalent to RSA-3072 or NIST P-256 (ECDSA). SM2 is generally faster than RSA for the same security level. Compared to ECDSA, SM2 uses a different curve equation and hash function (SM3), making it independent of NIST standards.
Is SM2 secure?
∨
SM2 has been extensively analyzed by cryptographers worldwide. The curve parameters were chosen to resist known attacks, and no weaknesses have been found. SM2 is approved by the International Organization for Standardization (ISO) as ISO/IEC 14888-3 and is considered cryptographically strong. It's widely used in Chinese government, banking, and critical infrastructure.
Can I use SM2 for commercial applications?
∨
Yes, SM2 is free to use without licensing fees. The algorithm specifications are publicly available (GM/T 0003). For applications in China's financial or government sectors, SM2 may be mandatory under Chinese regulations. For international applications, consider compatibility requirements with existing systems.
What is the key length of SM2?
∨
SM2 uses a 256-bit elliptic curve, meaning the private key is 256 bits (32 bytes). The public key is 512 bits (64 bytes) uncompressed, or 264 bits (33 bytes) when compressed. This provides 128-bit security level, equivalent to RSA-3072 but with much smaller keys, making SM2 more efficient for storage and transmission.
How do I store SM2 private keys securely?
∨
Never share your private key. Store it in: a hardware security module (HSM), a password-protected encrypted file, a key management system (KMS), or environment variables in production. For development, consider encrypted keystores. The PEM format used by this tool can be imported into most key management systems.
What is the difference between signing and encryption?
∨
Encryption uses the public key to scramble data so only the private key holder can read it — this ensures confidentiality. Signing uses the private key to create a signature that anyone with the public key can verify — this ensures authenticity and non-repudiation. SM2 supports both operations.
How does SM2 compare to SM4?
∨
SM2 is asymmetric (public-key) cryptography: different keys for encrypting and decrypting, slower but enables secure key exchange without pre-shared secrets. SM4 is symmetric cryptography: same key for encrypting and decrypting, much faster, ideal for bulk data encryption. They're often used together: SM2 to exchange an SM4 session key, then SM4 for fast data encryption.
What is the SM3 hash function and how does it relate to SM2?
∨
SM3 is a cryptographic hash function, part of the Chinese national standard (GM/T 0004). It produces 256-bit (32-byte) hash values, similar to SHA-256. SM2 signatures use SM3 to hash the message before signing. The combination of SM2 + SM3 provides authenticated encryption that meets Chinese regulatory requirements.