SM2 Key Pair Generator

Generate SM2 public and private key pairs with various formats according to the GB/T 32918-2016 standard

CryptoSM2CryptographySecurityKeyEncryptDecryptGeneratorKey Pair
Successfully generated 5 SM2 key pairs

Generation Settings

SM2 standard uses 256-bit key length

Generated Keys

Key Pair #1

Public Key

-----BEGIN PUBLIC KEY-----
MDQ2OTBlODEyZDJjYjcyNDBjOTExZDExM2VmOTcyNTI5NzBiODg0ODI0OTg3Y2Q0
Y2ZmZTNjMTRmOGNmZGJmMWEzNjE0NTcwYTkwY2Y3ZWJlNDQ3NDZmNmRhMGM2MTY4
YTZlYjM0NWE3NmEzZDUxM2FlZjEzODZlNGYxZjY0OTE1ZA==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
MGQ1NWI4YTMwMWIxNWVjMjBlOTBmYjRhMjhlMWRmODg5MGUxY2M2YWRlZTk2NWEx
ZTAxYWVkNDgzOWE3MTgyNQ==
-----END PRIVATE KEY-----

Key Components

x: 690e812d2cb7240c911d113ef97252970b884824987cd4cffe3c14f8cfdbf1a3

y: 614570a90cf7ebe44746f6da0c6168a6eb345a76a3d513aef1386e4f1f64915d

d: 0d55b8a301b15ec20e90fb4a28e1df8890e1cc6adee965a1e01aed4839a71825

Key Pair #2

Public Key

-----BEGIN PUBLIC KEY-----
MDQxNzA2ODI2YmE5Mjk0ZGVhOGJkMTY5ZjZlZjFkZTc1Nzc2ODc1NGU2ZmEzNzYz
MGFlNzhhMGU2NmQ2Njg5M2Q4Y2IyZDA0M2YxODhkMDkxMDkwMTgyYjU4MDFhZmZl
MGE2NGFkNTgzMTVjMGU4YTk2MWJhZjhjYWMxMTc1ZDhmNA==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
MmQxNzczNzU5MmJhNmZiN2JkMDE0MGMyYTJhOWM1MGJlMGNhZDA0MjA3ZTlhZDhj
ZDhkMjhhMDY2NTc5NDVjNQ==
-----END PRIVATE KEY-----

Key Components

x: 1706826ba9294dea8bd169f6ef1de757768754e6fa37630ae78a0e66d66893d8

y: cb2d043f188d091090182b5801affe0a64ad58315c0e8a961baf8cac1175d8f4

d: 2d17737592ba6fb7bd0140c2a2a9c50be0cad04207e9ad8cd8d28a06657945c5

Key Pair #3

Public Key

-----BEGIN PUBLIC KEY-----
MDRjYzJiOWQ1YzcwZjk5YmVmNjM2Yjk0OTE2NmZjM2QxZDdhZGRmYmQ5Mzg2NWRh
Mjk1ZTE5MjI1ZmMyMTk3OWM4MzNmNDA3ZDAwOWUzNmFkZjkzNTQyYWIyYWUxMzli
OWNiOGVkMjEzZmQ4OGNiODY0ZDcyNGYxYjYwYmNkOWIwZA==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
NjhlNDliNWI0NTYwODZiMjJjNjBmM2I2MzVkNmU0OThiZGUzNjllYTA0YTEzNTE4
ZTI2OGQ0YjYwZmY4MWM1Mw==
-----END PRIVATE KEY-----

Key Components

x: cc2b9d5c70f99bef636b949166fc3d1d7addfbd93865da295e19225fc21979c8

y: 33f407d009e36adf93542ab2ae139b9cb8ed213fd88cb864d724f1b60bcd9b0d

d: 68e49b5b456086b22c60f3b635d6e498bde369ea04a13518e268d4b60ff81c53

Key Pair #4

Public Key

-----BEGIN PUBLIC KEY-----
MDQzMzNmZmM0NmRlYzQ3MDNmZjczN2M5ZDU2YzgxYTU0OWJlNzZjNDllNjlkYWFh
ZjQxMDgzMDA2NWU3Mzc3YzA3NWJkMjViM2YzOTY4NGRjNDJlNTUwMTFjNDE5ZTA4
YzM2YWIwNjc1NGI5NjgzZDVmZWRlNmE1YzY2NTFjYjA2MA==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
NjNlZmZjMWFkMjQ1ODFkZmEzNzI3NGIxYjBjN2NkYjg3NjIxMjdkZWZkMjEzNDQz
NzI3M2JlNzE3ODE0MTI1OQ==
-----END PRIVATE KEY-----

Key Components

x: 333ffc46dec4703ff737c9d56c81a549be76c49e69daaaf410830065e7377c07

y: 5bd25b3f39684dc42e55011c419e08c36ab06754b9683d5fede6a5c6651cb060

d: 63effc1ad24581dfa37274b1b0c7cdb8762127defd2134437273be7178141259

Key Pair #5

Public Key

-----BEGIN PUBLIC KEY-----
MDQzZTAxNWEyNWQ1MDk1ZDA3MjU2NzBhOTJmOTk3M2E3Zjc4OTE5YWRiNmU5YmEx
NTk4YTllNTFlZWRjNzc3ODg5NzFmMWJmYThhZDY5YjBhNTQ4NzJiODFiY2RiYzg1
YzMwN2JlOGNjYjI0NzE0NGQ2NTVhNGI3NzkxNTljODkzZg==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
ZTQyNmUxOTY2ZDVjZDA3YTJlYWMxMzUwZTg0ZGMwNDRhODMwNTFlYTE0YzgzZjMx
ZGRmMmRiMjBiMTA1ZDUxNQ==
-----END PRIVATE KEY-----

Key Components

x: 3e015a25d5095d0725670a92f9973a7f78919adb6e9ba1598a9e51eedc777889

y: 71f1bfa8ad69b0a54872b81bcdbc85c307be8ccb247144d655a4b779159c893f

d: e426e1966d5cd07a2eac1350e84dc044a83051ea14c83f31ddf2db20b105d515

SM2 Key Pair Generator: A Complete Guide to Chinese Cryptographic Standard

What is SM2 Key Pair Generator and Why Use It?

The SM2 Key Pair Generator is a specialized cryptographic tool that creates secure public and private key pairs based on China's national standard cryptographic algorithm (GB/T 32918-2016). Unlike international standards like RSA or ECC, SM2 is specifically designed and approved by Chinese regulatory authorities, making it essential for organizations operating within China's regulatory framework.

Our SM2 key generation tool allows users to easily generate cryptographically secure SM2 key pairs without requiring specialized knowledge of the underlying algorithms. The tool supports various output formats including PEM, HEX, and Base64, making it versatile for different development and security environments.

Key Applications and Use Cases

  • Financial services compliance: Banks and fintech companies operating in China need to use SM2 encryption for regulatory compliance when securing financial transactions and customer data.
  • Government and enterprise information systems: Chinese government agencies and large enterprises must implement SM2 for secure communications, document signing, and identity verification.
  • Cross-border e-commerce: Businesses engaging in trade with China often need to implement SM2 cryptography for secure data exchange and regulatory compliance.
  • Mobile application security: Developers creating apps for the Chinese market need SM2 key pairs for secure authentication and data protection mechanisms.

The SM2 algorithm is part of the ShangMi (SM) suite of cryptographic algorithms that includes SM2 (public key cryptography), SM3 (hashing), and SM4 (symmetric encryption). These standards are increasingly important as China continues to develop its own cybersecurity framework independent of international standards.

How to Use the SM2 Key Pair Generator

Following this step-by-step guide will help you generate secure SM2 key pairs quickly and efficiently. Each generated key pair includes both the public and private components necessary for encryption, decryption, signing, and verification operations.

Step 1: Select Key Parameters

The SM2 standard uses a fixed key length of 256 bits, which provides strong security while maintaining good performance. This is pre-selected in our tool and cannot be changed as it follows the official standard.

Step 2: Choose Output Format

Select your preferred output format:

  • PEM: The standard format for cryptographic certificates and keys, easily recognized by most systems and applications.
  • HEX: Hexadecimal representation, useful for direct implementation in code.
  • Base64: Compact representation that's often used in web applications and API communications.

Step 3: Specify Number of Key Pairs

Decide how many key pairs you need. This is particularly useful for testing or when setting up multiple secure channels.

Step 4: Generate and Manage Keys

Click the 'Generate Key Pairs' button and wait for the process to complete. Once generated, you can view, copy, or export your keys. Make sure to store your private keys securely and never share them with unauthorized parties.

Related Cryptographic Tools

For comprehensive security implementation, you might want to explore these complementary tools:

Frequently Asked Questions about SM2 Cryptography

What is the difference between SM2 and other public key cryptography algorithms like RSA?

SM2 is an elliptic curve-based public key cryptography algorithm developed by Chinese authorities. Compared to RSA, SM2 offers comparable security with shorter key lengths (256 bits vs 2048+ bits for RSA), resulting in better performance. The main distinction is that SM2 is specifically required for regulatory compliance in China, while RSA is more widely used internationally. The mathematical foundations also differ: SM2 is based on elliptic curve cryptography, while RSA relies on the difficulty of factoring large prime numbers.

Is SM2 encryption secure for international business applications?

Yes, SM2 provides strong cryptographic security that meets international standards. With its 256-bit key length, it offers security equivalent to RSA 3072-bit keys. SM2 has undergone extensive cryptanalysis by Chinese authorities and is considered secure against known attacks. However, for international interoperability, some organizations might prefer widely adopted international standards like RSA or ECDSA. The choice often depends on your specific compliance requirements and where your application will be deployed.

How can I verify that my SM2 key pair is working correctly?

To test your SM2 key pair, you can perform a simple encryption and decryption test: encrypt a test message with the public key and then decrypt it with the corresponding private key. If the decrypted message matches the original, your key pair is working correctly. Alternatively, you can sign a message with the private key and verify the signature using the public key. Our tool ensures that all generated key pairs are mathematically valid according to the SM2 standard specifications.

Can SM2 keys be used with standard SSL/TLS implementations?

SM2 support in SSL/TLS depends on the specific implementation. China has developed a variant called TLCP (Transport Layer Cryptography Protocol) that uses SM2/SM3/SM4 algorithms instead of the international standards. Major browsers within China often support these standards. For international systems, you may need specialized libraries or configurations to enable SM2 support. OpenSSL versions 1.1.1 and later include support for SM2 cryptography, making integration more straightforward for many systems.

What are the key components x, y, and d in the SM2 key pair?

In SM2 key pairs, these components represent important mathematical values:
  • x and y: These are the coordinates of a point on the elliptic curve that represents your public key. Together, they form the complete public key that can be shared openly.
  • d: This is your private key, a large random number that must be kept secret. It's used in decryption and signing operations.
Unlike RSA which has multiple components like p, q, d, e, n, the SM2 private key is simpler with just the scalar value d, while the public key consists of the point coordinates (x,y).

Additional Resources

To learn more about SM2 cryptography and Chinese cryptographic standards, these authoritative sources provide valuable information:

Conclusion

The SM2 Key Pair Generator provides a user-friendly way to create cryptographically secure keys that comply with Chinese national standards. Whether you're developing applications for the Chinese market, implementing secure communication channels, or meeting regulatory requirements, our tool simplifies the complex process of SM2 key generation. By supporting multiple output formats and providing comprehensive key management features, this SM2 cryptography tool helps organizations implement strong security measures while maintaining compliance with Chinese cryptographic regulations.