RandomKeygen
Free · Private · Client-sideGenerated locally — never transmitted

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.

Standard & OID

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…

NIST Category 5 (~AES-256 security) — required by NSA CNSA 2.0 for maximum quantum margin

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

AlgorithmQuantum Safe?Public KeyCiphertextRecommended Use
X25519 (ECDH)No32 B32 BPair with ML-KEM-768 in hybrid TLS/SSH
RSA-4096No512 B512 BLegacy compatibility only
ML-KEM-512Yes (Level 1)800 B768 BConstrained IoT / tight packet budgets
ML-KEM-768Yes (Level 3)1,184 B1,088 BCommercial web default (TLS 1.3 X25519MLKEM768)
ML-KEM-1024Yes (Level 5 · CNSA 2.0)1,568 B1,568 BNSA 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.pem

Extract SPKI public key (also verifies PEM downloaded above)

$openssl pkey -in ml-kem-1024-private.pem -pubout -out ml-kem-1024-public.pem

Encapsulate a 256-bit shared secret with the public key

$openssl pkeyutl -encap -inkey ml-kem-1024-public.pem -pubin -out ct.bin -secret ss1.bin

Decapsulate 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.bin

Go 1.24+ Standard Library (crypto/mlkem)

mlkem_demo.go
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)

mlkem.ts
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 HKDF

Related Post-Quantum & Encryption Tools

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

01
Select a FIPS 203 parameter set
Choose ML-KEM-1024 (default) for NSA CNSA 2.0 compliance and maximum quantum security, or ML-KEM-768 for standard TLS 1.3 and general web applications.
02
Export in PEM, Base64, or Hex
PEM exports standard RFC 9935 SPKI public keys and compact 64-byte PKCS#8 seed private keys accepted directly by OpenSSL 3.5+ and Go 1.24+.
03
Test encapsulation locally
Use the built-in encapsulation playground below to verify that a sender and recipient derive the exact same 256-bit shared secret without any network call.

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.