ML-KEM Post-Quantum Key Generator (FIPS 203)
Generate real NIST FIPS 203 ML-KEM (formerly CRYSTALS-Kyber) post-quantum key encapsulation pairs locally in your browser. Exports OpenSSL 3.5+ and RFC 9935 compatible SPKI & PKCS#8 seed PEM keys.
FIPS 203 · 2.16.840.1.101.3.4.4.3
Generated ML-KEM key pairML-KEM-1024CNSA 2.0
Generating your ML-KEM-1024 key pair…
Live KEM Encapsulation & Decapsulation Test
Unlike RSA encryption, a Key Encapsulation Mechanism (KEM) generates a fresh 256-bit shared secret and wraps it into a ciphertext for AES-256-GCM.
Click Run Encapsulate → Decapsulate to simulate a sender encapsulating a random 32-byte shared secret to your ML-KEM-1024 public key and your private key recovering the identical secret.
ML-KEM Parameter Comparison vs. Classical Key Exchange
| Algorithm | Quantum Safe? | Public Key | Ciphertext | Recommended Use |
|---|---|---|---|---|
| X25519 (ECDH) | No | 32 B | 32 B | Pair with ML-KEM-768 in hybrid TLS/SSH |
| RSA-4096 | No | 512 B | 512 B | Legacy compatibility only |
| ML-KEM-512 | Yes (Level 1) | 800 B | 768 B | Constrained IoT / tight packet budgets |
| ML-KEM-768 | Yes (Level 3) | 1,184 B | 1,088 B | Commercial web default (TLS 1.3 X25519MLKEM768) |
| ML-KEM-1024 | Yes (Level 5 · CNSA 2.0) | 1,568 B | 1,568 B | NSA CNSA 2.0, defense, long-lived confidentiality |
Generate & Use Locally (OpenSSL 3.5+, Go, Node.js)
Generate ML-KEM-1024 private key locally (OpenSSL 3.5+)
openssl genpkey -algorithm ML-KEM-1024 -out ml-kem-1024-private.pemExtract SPKI public key (also verifies PEM downloaded above)
openssl pkey -in ml-kem-1024-private.pem -pubout -out ml-kem-1024-public.pemEncapsulate a 256-bit shared secret with the public key
openssl pkeyutl -encap -inkey ml-kem-1024-public.pem -pubin -out ct.bin -secret ss1.binDecapsulate with the private key and confirm identical secrets
openssl pkeyutl -decap -inkey ml-kem-1024-private.pem -in ct.bin -out ss2.bin && cmp ss1.bin ss2.binGo 1.24+ Standard Library (crypto/mlkem)
package main
import (
"crypto/mlkem"
"fmt"
)
func main() {
dk, err := mlkem.GenerateKey1024()
if err != nil {
panic(err)
}
ek := dk.EncapsulationKey()
// Sender encapsulates a fresh 32-byte shared secret for AES-256-GCM
sharedSecret, ciphertext := ek.Encapsulate()
// Recipient decapsulates the exact same 32-byte shared secret
recovered, err := dk.Decapsulate(ciphertext)
if err != nil {
panic(err)
}
fmt.Printf("Matched: %v (%d-byte key)\n", string(sharedSecret) == string(recovered), len(recovered))
}TypeScript / Node.js (@noble/post-quantum)
import { ml_kem1024 } from '@noble/post-quantum/ml-kem.js'
const { publicKey, secretKey } = ml_kem1024.keygen()
const { cipherText, sharedSecret } = ml_kem1024.encapsulate(publicKey)
const recovered = ml_kem1024.decapsulate(cipherText, secretKey)
// Use recovered (32 bytes) as an AES-256-GCM key via HKDFRelated Post-Quantum & Encryption Tools
X-Wing Hybrid KEM →
ML-KEM-768 + X25519 & ML-KEM-1024 + P-384 defense-in-depth.
ML-DSA Signing Keys →
FIPS 204 post-quantum digital signatures (ML-DSA-44/65/87).
SLH-DSA Hash Keys →
FIPS 205 SPHINCS+ hash-only signatures (zero lattice risk).
PQC Algorithm Comparison →
Byte budgets & when to choose ML-KEM, ML-DSA, SLH-DSA, or X-Wing.
Frequently Asked Questions
What is the difference between ML-KEM-768 and ML-KEM-1024?
Both are standardized in NIST FIPS 203. ML-KEM-768 targets NIST Category 3 (~AES-192) and is the default inside TLS 1.3 hybrid X25519MLKEM768. ML-KEM-1024 targets NIST Category 5 (~AES-256) and is the mandatory key-establishment parameter set under the NSA’s CNSA 2.0 standard.
Why is the private key PEM only ~100 bytes when ML-KEM-1024 secret keys are 3,168 bytes?
Per RFC 9935 and modern OpenSSL 3.5+ / Go conventions, ML-KEM private keys are stored as a 64-byte random seed (d || z) inside PKCS#8. Any compliant library deterministically expands that 64-byte seed into the full 3,168-byte decapsulation key on load, saving space and preventing key-mismatch bugs.
Can I encrypt an arbitrary message directly with ML-KEM?
No—ML-KEM is a Key Encapsulation Mechanism (KEM), not a direct message cipher. Use ML-KEM to establish a 32-byte shared secret, pass it through HKDF if needed, and encrypt your payload with AES-256-GCM or ChaCha20-Poly1305.
How to use this ML-KEM generator
100% client-side · OpenSSL 3.5+ & CNSA 2.0 compatible
Keys are generated locally in your browser using crypto.getRandomValues() entropy and the audited @noble/post-quantum FIPS 203 implementation—zero network calls. Private PEMs use the compact 64-byte RFC 9935 seed-only PKCS#8 format supported by OpenSSL 3.5+ and Go 1.24+. For production secrets, generate keys directly on your target host or HSM.