China's Guomi Cryptographic Algorithms: SM1, SM2, SM3, SM4 Explained with Comparisons and Use Cases
This article details China's national cryptographic algorithms (SM1, SM2, SM3, SM4), their design principles, operational mechanisms including key exchange and digital signatures, performance comparisons with DES, AES, RSA, and SHA standards, and deployments in AD-WAN and 4G/5G VPDN networks.
What Are Guomi Algorithms?
Guomi algorithms refer to cryptographic algorithm standards issued by China's State Cryptography Administration to safeguard national information security. The published commercial cryptographic standards include SM1 (SCB2), SM2, SM3, SM4, SM7, SM9, and the ZUC algorithm. They are widely applied in finance, e-government, and security sectors to protect confidentiality, integrity, and availability of sensitive data while reducing reliance on foreign cryptographic products.
Why Are Guomi Algorithms Needed?
Background
During network information transmission and storage, data confidentiality and security are critical. International standard encryption algorithms, while secure, cannot guarantee source code security, posing risks of external infiltration or tampering. To build a secure industry network environment and enhance the "secure and controllable" capability of national information systems, China began developing Guomi algorithm standards in 2007 and officially released them in 2010. After years of development, they have become China's independently developed cryptographic standards, widely adopted across industries, significantly enhancing China's core competitiveness in cryptographic technology.
Characteristics
High Security: Based on rigorous cryptographic principles and complex operations, providing reliable protection for encryption, digital signatures, and hashing against traditional and modern attacks.
Efficiency and Flexibility: High encryption speed and operational efficiency, adaptable to different ciphertext and key lengths for various scenarios.
Wide Standardization: Recognized by national standardization bodies, meeting basic requirements of international cryptographic standards, with capabilities comparable to international algorithms. Widely promoted domestically as a foundational core algorithm.
Independent Innovation: Independently developed, giving China full control over implementation and promotion, reducing external dependence and improving autonomous defense.
Multi-Domain Applicability: Suitable for finance, e-commerce, communications, IoT, blockchain, and other fields.
How Do Guomi Algorithms Work?
Guomi algorithms include SM1 (SCB2), SM2, SM3, SM4, SM7, SM9, and ZUC. SM1, SM4, SM7, and ZUC are symmetric algorithms; SM2 and SM9 are asymmetric; SM3 is a hash algorithm. The following focuses on the commonly used SM1, SM2, SM3, and SM4.
SM1 Algorithm: Implementation and Application
SM1 is a symmetric encryption algorithm using the same key for encryption and decryption. It is not publicly disclosed and exists only as an IP core (Intellectual Property Core) embedded in chips. SM1 is mainly used for small-data encryption, widely applied in smart IC cards, cryptographic keys, access cards, and encryption cards.
SM2 Algorithm: Implementation and Application
SM2 is an asymmetric encryption algorithm based on Elliptic Curve Cryptography (ECC), comprising SM2-1 (elliptic curve digital signature algorithm), SM2-2 (elliptic curve key exchange protocol), and SM2-3 (elliptic curve public key encryption algorithm), used for digital signatures, key agreement, and data encryption respectively. Applications include e-commerce (protecting user information), internet finance (digital payments, electronic banking), and IoT (securing device communication).
Data Encryption
In asymmetric encryption, the public key can be published while the private key is kept secret. The sender encrypts with the receiver's public key; the receiver decrypts with their private key.
Key Agreement
Due to the high computational complexity of elliptic curves, SM2 plays a key role in key agreement. The process:
Both parties generate their private keys (random numbers).
Each party computes their public key from their private key and the ECC parameter G.
Both parties exchange public keys openly. Attackers cannot derive private keys from public keys and G due to the elliptic curve discrete logarithm problem.
Each party combines their private key with the other's public key to compute the same session key, which can be used as a shared key for symmetric encryption (e.g., SM4).
Digital Signature
Digital signatures verify integrity, authenticity, and origin. The sender signs with their private key; the receiver verifies with the sender's public key. In practice, SM2 is often used with SM3 for hashing.
SM3 Algorithm: Implementation and Application
SM3 is a hash algorithm that compresses arbitrary-length messages into a fixed-length digest. Digests are unique: different messages produce different digests, and the original message cannot be recovered from the digest, nor can a forged message produce the same digest. SM3 is widely used for digital signatures, data integrity checks, and message authentication. Applications include protecting cryptographic protocols, digital certificates, electronic signatures, blockchain block generation and transaction verification, and cryptographic random number generation.
Combined SM2 and SM3 digital signature and integrity verification process:
User A's data is hashed with SM3 to produce digest A.
Digest A is encrypted with User A's private key to generate the digital signature.
The plaintext data and signature are encrypted (using SM1, SM2, or SM4; example uses SM2 asymmetric encryption) and sent to User B.
User B decrypts the ciphertext to recover plaintext and signature.
User B decrypts the signature using User A's public key:
Success: legitimate source, obtains digest A.
Failure: not from User A, discard data.
User B hashes the received plaintext with SM3 to produce digest A'. Compare:
Digest A' = Digest A: data intact.
Digest A' ≠ Digest A: data tampered, discard.
SM4 Algorithm: Implementation and Application
SM4 is a block symmetric encryption algorithm, similar to SM1 but with a public implementation. It divides plaintext into fixed-length blocks, encrypts each block with the same key, and decrypts similarly. SM4 is simple, fast, and resource-efficient, suitable for large-data encryption such as static storage or data transmission channels. Applications include network security (protecting bank card info, passwords), IoT (device communication encryption), and blockchain (transaction security).
Encryption Modes
SM4 supports ECB, CBC, CFB, and other block modes. The two basic modes are described below.
ECB Mode
SM4 encryption/decryption process in ECB mode:
Sender divides plaintext into fixed-length blocks, encrypts each block with the same key to produce ciphertext blocks. The complete ciphertext is the concatenation of all blocks.
Receiver divides ciphertext into blocks, decrypts each with the same key to produce plaintext blocks, then concatenates them.
ECB is simple, allows parallel processing, but identical plaintext blocks produce identical ciphertext blocks, failing to provide strict confidentiality.
CBC Mode
SM4 encryption process in CBC mode:
Divide plaintext into fixed-length blocks.
XOR the first plaintext block with an initialization vector (IV), then encrypt with the key to produce the first ciphertext block.
For each subsequent plaintext block, XOR with the previous ciphertext block, then encrypt to produce the corresponding ciphertext block.
Concatenate all ciphertext blocks to form the complete ciphertext.
SM4 decryption process in CBC mode:
Divide ciphertext into blocks and process in reverse order.
Decrypt the last ciphertext block with the key, then XOR with the previous ciphertext block to obtain the last plaintext block.
Similarly, decrypt each preceding ciphertext block and XOR with the previous ciphertext block to obtain the corresponding plaintext block.
For the first block, decrypt with the key and XOR with the IV to obtain the first plaintext block.
Concatenate all plaintext blocks in order to form the complete plaintext.
CBC provides higher security than ECB but does not allow parallel encryption of plaintext blocks, and errors propagate.
Comparison of Guomi Algorithms with International Standards
Guomi algorithms and international standards are both widely used in modern cryptography, but differ in technical parameters and strengths. The following tables compare key parameters.
Symmetric Algorithms: DES, AES, SM1, SM4
Comparison Item | DES | AES | SM1 | SM4
----------------|-----|-----|-----|----
Computational Structure | Difficult, based on standard arithmetic/logic, no non-linear transformation | Extremely difficult, based on byte substitution, row shifting, no non-linear transformation | Not public | Extremely difficult, based on basic round function + iteration, includes non-linear transformation
Block Length | 64 bits | 128 bits | 128 bits | 128 bits
Key Length | 64 bits (3DES: 128 bits) | 128/192/256 bits | 128 bits | 128 bits
Rounds | 16 (3DES: 48) | 10/12/14 | Not public | 32
Security | Low (3DES: high) | High | Comparable to AES | HighAsymmetric Algorithms: RSA vs SM2
Comparison Item | RSA | SM2
----------------|-----|-----
Computational Structure | Difficult, based on reversible modular exponentiation | Extremely difficult, based on elliptic curve discrete logarithm problem
Computational Complexity | Sub-exponential | Fully exponential
Key Length (equivalent security) | Longer | Shorter
Key Generation Speed | Slow | Over 100x faster than RSA
Security | Moderate | HigherHash Algorithms: SHA1, SHA256, SM3
Comparison Item | SHA1 | SHA256 | SM3
----------------|------|--------|-----
Computational Structure | Similar function structure, but SM3 design more complex
Digest Length | 160 bits | 256 bits | 256 bits
Speed | Faster | Slightly slower than SHA1 | Slightly slower than SHA1
Security | Moderate | High | Higher than SHA256Typical Application Scenarios
AD-WAN Longitudinal IP/MPLS Networking
Guomi algorithms can be combined with AD-WAN technology for IP/MPLS longitudinal networks. Through the AD-WAN intelligent O&M platform, Guomi configuration is pushed with one click, building Guomi data encryption channels in the network to achieve end-to-end IPsec tunnel protection based on Guomi algorithms.
Working principle in end-to-end IPsec tunnels:
IKE Key Negotiation Phase: Use IKE protocol for key negotiation, employing SM2 to generate session keys.
Identity Authentication Phase: Local end uses SM2 and SM3 to generate digital signatures of identity information, encrypts identity info and signature with SM1 or SM4 and the session key; remote end decrypts with the same session key, then authenticates via SM2 and SM3.
Data Transmission Phase: Local end uses SM2 and SM3 to generate digital signatures of user data, encrypts data and signature with SM1/SM4 and session key; remote end decrypts with session key, then verifies integrity via SM2 and SM3.
4G/5G VPDN Service Networking
4G/5G VPDN (Virtual Private Dialup Network) uses dial-up over 4G/5G wireless networks to build a virtual private network. It employs L2TP to create tunnels isolated from the Internet, meeting branch-to-headquarters communication needs. VPDN also supports combining L2TP with IPsec: L2TP handles user authentication for access security, while IPsec protects communication data.
Networking process:
Branch gateway is a 4G/5G router that dials into the carrier network.
Carrier authenticates the router's APN, account, and SIM/USIM information.
After authentication, the carrier identifies the router as a VPDN user. The carrier AAA server sends L2TP tunnel attributes to the LAC (L2TP Access Concentrator), which initiates a tunnel establishment request to the LNS (L2TP Network Server) at headquarters.
After L2TP tunnel establishment, LAC transparently passes user authentication info to LNS. LNS performs secondary authentication with the headquarters AAA server, assigns an enterprise internal IP address upon success. Branch terminals and headquarters can now communicate.
Both branch and headquarters gateways are equipped with Guomi cryptographic cards. They negotiate an end-to-end IPsec tunnel using Guomi algorithms to encrypt data packets and perform integrity checks.
IPsec-encrypted packets are encapsulated with L2TP at the LAC and transmitted over the L2TP tunnel to the LNS.
LNS receives packets, decapsulates L2TP, then decrypts via IPsec to restore the original packet, and forwards based on destination IP.
}
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Linux Tech Enthusiast
Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
