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-----
MDQ0NjhmYmExYTU5MmRlYmMxZDIzNjk2MGY4MzA2ZDYwNWJmZGYzYmMzMjlmM2Ey
M2RmYmQ0OTM3MTg1NDQyMDY2ZWFhYmFlMjRlNjhiNGU3OWY2Zjg2YjZmYWRjOGIy
MGY3MjA3YWFkZWY3NjVjYTcwM2JjOWE5NWRiNDk2ODAwZg==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
ZjQ3YTQ5ZDljMGIwOWEyZDAwZWE5YjhlMTYyZTA4YWQxZTdkZTA3ZmI5ZTQyMzI5
MTc5N2ViOTdjZTVmYzY0OQ==
-----END PRIVATE KEY-----

Key Components

x: 468fba1a592debc1d236960f8306d605bfdf3bc329f3a23dfbd4937185442066

y: eaabae24e68b4e79f6f86b6fadc8b20f7207aadef765ca703bc9a95db496800f

d: f47a49d9c0b09a2d00ea9b8e162e08ad1e7de07fb9e423291797eb97ce5fc649

Key Pair #2

Public Key

-----BEGIN PUBLIC KEY-----
MDQ5MDc0NmM2ZWQwM2E5NDA1MWYzNWQ4ODdiYWE4YWU3MGFhYTM1NzEwZTRhZDVm
NzgyNGE1ZTExYjc5YWFkMmVhNTk5OWUwYWNkZmJmYzUzOWZlZWNmMzFiZDY2ZDZh
YjI1NmFkMTI3YTBhZDNiZDEyNzIzZGU5YzlkZWNmYzY4OQ==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
N2U3MGM5NmZjN2FkYjI4OTIxNjM2MzdhNDU2NWZlOWU2M2FlZTBiNmJiY2RkYzk4
MTI0OTNjNWU2MjQzNWU0ZQ==
-----END PRIVATE KEY-----

Key Components

x: 90746c6ed03a94051f35d887baa8ae70aaa35710e4ad5f7824a5e11b79aad2ea

y: 5999e0acdfbfc539feecf31bd66d6ab256ad127a0ad3bd12723de9c9decfc689

d: 7e70c96fc7adb2892163637a4565fe9e63aee0b6bbcddc9812493c5e62435e4e

Key Pair #3

Public Key

-----BEGIN PUBLIC KEY-----
MDQ5YzJkNzRmMTA0MjZhMjUzYTVjYzliMDUxZDJlNjJjZDM2OGVmMzhlY2Q3ZjYz
NzE0ZGY4NjZlYmU2ZWVhYTVkNTgzMDNjOGQ3NmMyMGNmYWQzOGYxOTc4NTI3MmZi
YTc1Yzk5ZjAzMmIzYjJiZjZkODU5ZTIwMjFhYTBlZDNhMg==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
N2I4MDlhYzc3MmU1MjMwNjAwODI5ZWU0MWExNGVhMWFkODdhMzJhMTQyYWZlZTgz
ZGRhMTM0ODZhMDRiMWRhYw==
-----END PRIVATE KEY-----

Key Components

x: 9c2d74f10426a253a5cc9b051d2e62cd368ef38ecd7f63714df866ebe6eeaa5d

y: 58303c8d76c20cfad38f19785272fba75c99f032b3b2bf6d859e2021aa0ed3a2

d: 7b809ac772e5230600829ee41a14ea1ad87a32a142afee83dda13486a04b1dac

Key Pair #4

Public Key

-----BEGIN PUBLIC KEY-----
MDRiYzllNjA1NTJhMjBjMmM3MTBkZDQ1ZDMwZjQxNzViM2Q4MzA0OTMyMmRmYTRh
MzhkYWNhMTc1ODUwNTEyNGQyNzQyYjk3NWZlNTY4MmE0ZmQ2NjY3NGFjZDJiNjA4
YmM2YWVhNWVhN2NlMGI3MmFhMGMyNTI3NjQzNzUwMzM0Nw==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
YjA3NDU3ZWE2YTIyYjlhMDI2NjJkMTA3MGM0ZDliOGZkMDAzMmQwZWFkZmM3NjAz
MjE5MTA5Y2FjNTdiOGNiNw==
-----END PRIVATE KEY-----

Key Components

x: bc9e60552a20c2c710dd45d30f4175b3d83049322dfa4a38daca1758505124d2

y: 742b975fe5682a4fd66674acd2b608bc6aea5ea7ce0b72aa0c25276437503347

d: b07457ea6a22b9a02662d1070c4d9b8fd0032d0eadfc7603219109cac57b8cb7

Key Pair #5

Public Key

-----BEGIN PUBLIC KEY-----
MDQ4NDcyNzQwM2IzMThiZjBjMmY0ZmFhODJiYzMyNzczYTk1YzVlOTcwZDY1NTFm
OWY4OGVhZjIwYjU1ZjEyZWJlYzY4NzlkY2UyMjFiMjc1M2U4M2FjMzEwNTE0MjNh
YzlmZTNmOGUyYzczYTA5ZDEzZGEzMjY2YzQyMTY1NTJhMw==
-----END PUBLIC KEY-----

Private Key

-----BEGIN PRIVATE KEY-----
MGM3NzgzN2I1ZTRiN2Q3NjcwYzQwMmNlZTRhMjA1MDVjZjgxYzc3NzJkMzI5MjY1
NWJmOGU5YzI3YTE1YjQyNg==
-----END PRIVATE KEY-----

Key Components

x: 84727403b318bf0c2f4faa82bc32773a95c5e970d6551f9f88eaf20b55f12ebe

y: c6879dce221b2753e83ac31051423ac9fe3f8e2c73a09d13da3266c4216552a3

d: 0c77837b5e4b7d7670c402cee4a20505cf81c7772d3292655bf8e9c27a15b426

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.