SM2 public key from private key

Derive the SM2 public key (Q = d·G) from a private scalar or PKCS#8 PEM — sm2p256v1 (GM/T 0003). Get SEC1 hex and SPKI PEM. Runs in your browser; nothing is uploaded.

Public key

About this tool

SM2 public key from private key derives the public key for a private key on the SM2 elliptic curve — the Chinese national standard GM/T 0003 scheme mandated by OSCCA, using curve sm2p256v1. The public point is computed as Q = d·G (one scalar multiplication of the curve's base point), so the result is fully deterministic — the same private key always yields the same public key.

Privacy

Everything runs in your browser via WebAssembly — your private key never leaves the device. The tool only ever returns public key material; the private key is used solely to compute the public point and is never echoed back. Also available from the gizza CLI and in chat.

Need a new key instead?

If you don't already have a private key, use the sm2-keypair-generate tool to create a fresh SM2 key pair (private + public, PEM + hex) with a secure random number generator.

FAQ

What exactly can I paste as the private key?

Either a raw 32-byte scalar as exactly 64 hex characters (a leading 0x is fine — anything else in length is rejected), or a PKCS#8 PEM block starting with -----BEGIN PRIVATE KEY-----. With the input format on auto the tool detects which one you pasted; set it to hex or pem to force the interpretation.

Compressed or uncompressed — which output should I use?

They encode the same point: uncompressed SEC1 is 04 ‖ x ‖ y (130 hex chars), compressed is 02/03 ‖ x (66 hex chars, the prefix records y's parity). Use whichever your target system expects — many GM/T toolchains default to uncompressed — or pick all to get both plus the SPKI PEM and the raw x/y coordinates.

Can I feed in a NIST P-256 private key?

A 32-byte P-256 scalar will be accepted (it's just a number in range), but the point is computed on sm2p256v1, SM2's own curve — so the result is a valid SM2 public key, not your P-256 public key. The two curves are different; use an SM2 key with this tool.

Is my private key ever exposed?

No. Derivation runs entirely in your browser via WebAssembly, and the tool only returns public key material — the private scalar is used for the single Q = d·G multiplication and never echoed back or transmitted.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool sm2-public-from-private "3945208F7B2144B13F36E38AC6D39F95889393692860B51A42FB81EF4DF7C5B8"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/sm2-public-from-private/?private_key=3945208F7B2144B13F36E38AC6D39F95889393692860B51A42FB81EF4DF7C5B8&input_format=auto&output_format=all

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.