Skip to content
Post-quantumml-dsa-87

ML-DSA-87

The largest ML-DSA parameter set (NIST Security Category 5): 2592-byte public key, 4627-byte signature. Required by CNSA 2.0.

Why it's safe

ML-DSA-87 gives the highest security margin and is the ML-DSA parameter set required for US national security systems under CNSA 2.0.

Used for
Signature
Family
Lattice (Module-LWE / Module-SIS)
Classical security
256 bits
Against a quantum computer
~256 bits
Standards
FIPS 204, CNSA 2.0, RFC 9881 (X.509)
Read the guideThe new standards: ML-KEM, ML-DSA, SLH-DSA and friends

Migration guides

How to adopt ML-DSA-87. Pick your stack.

OpenSSL 3.5+ (certificates) · configPrivate PKI: issue ML-DSA certificates with OpenSSL 3.5+ (RFC 9881), and know where they workExperimental

Why

Certificates authenticate servers, clients, devices and code. A quantum computer could recover a CA's or server's private key from its RSA/ECDSA public key and impersonate it. RFC 9881 standardises ML-DSA keys and signatures in X.509, and OpenSSL 3.5+ can create such certificates. The public web is not there yet: publicly trusted CAs do not issue ML-DSA certificates and browsers are exploring other designs (for example Merkle Tree Certificates). Private PKI (service mesh, IoT, internal mTLS, code signing) is where you can start, especially for long-lived roots.

Steps

  1. Inventory certificates and their lifetimes: npx -y pqe-cli scan . finds certificates and keys in repositories; also export from your CA and secret stores.
  2. Start with a lab CA hierarchy using ML-DSA-87 (root) and ML-DSA-65 (intermediate / leaf), and test every relying party.
  3. Keep classical chains in parallel until all clients can validate ML-DSA (dual hierarchies, or separate endpoints).
  4. Plan HSM support for the root key before production.

Before

bash
openssl req -x509 -newkey rsa:2048 -nodes -keyout ca.key -out ca.pem -days 3650 -subj "/CN=Example Root"

After

bash
# Root CA
openssl req -x509 -newkey ML-DSA-87 -nodes -keyout root.key -out root.pem \
  -days 3650 -subj "/CN=Example PQ Root" \
  -addext "basicConstraints=critical,CA:TRUE" -addext "keyUsage=critical,keyCertSign,cRLSign"

# Leaf key + CSR, signed by the root
openssl req -new -newkey ML-DSA-65 -nodes -keyout leaf.key -out leaf.csr -subj "/CN=svc.internal"
openssl x509 -req -in leaf.csr -CA root.pem -CAkey root.key -days 90 -out leaf.pem \
  -extfile <(printf "subjectAltName=DNS:svc.internal\nextendedKeyUsage=serverAuth")

openssl x509 -in leaf.pem -noout -text | grep "Signature Algorithm"   # ML-DSA-87 (issuer's)
openssl verify -CAfile root.pem leaf.pem

Gotchas

  • Client support is the bottleneck. TLS stacks, language runtimes, proxies, browsers and HSMs must all understand ML-DSA. Today that means OpenSSL 3.5+, BoringSSL/AWS-LC-based stacks, Go 1.27+ (crypto/x509, TLS 1.3 signature schemes), pyca/cryptography 49+, .NET 10 (with OS support) and others; test each.
  • ML-DSA in TLS needs TLS 1.3.
  • Size. Each ML-DSA-65 certificate carries a ~1.9 KB public key and a 3.3 KB signature; a three-certificate chain adds roughly 10-15 KB to every full handshake. Keep chains short.
  • Composite / hybrid certificates (ML-DSA combined with RSA or ECDSA in one certificate) are being standardised in the IETF LAMPS working group; tooling support varies.
  • Revocation and CT infrastructure (OCSP responders, CRL tooling, logs) must also handle the new algorithms.

Verify

openssl verify as above, then connect each real client (curl, your service mesh sidecar, your SDKs) to a test server presenting the ML-DSA chain.

cryptography (pyca) · pythonPython: sign and verify with ML-DSA-65 in pyca/cryptography (48+)Production-ready

Why

RSA, ECDSA and Ed25519 signatures become forgeable once a large quantum computer exists. ML-DSA (FIPS 204) is the standard replacement. pyca/cryptography added an ML-DSA module in 47.0.0 (AWS-LC/BoringSSL) and OpenSSL 3.5+ backend support in 48.0.0; 49.0.0 added X.509 certificate/CSR/CRL signing with ML-DSA keys, and 50.0.0 lets the X.509 verification APIs accept ML-DSA-44/65/87 (RFC 9881).

Steps

  1. pip install -U "cryptography>=48" (49+ if you need ML-DSA certificates).
  2. Put an algorithm identifier next to every stored signature so verifiers can support both old and new algorithms during the transition.
  3. Generate an ML-DSA-65 key, distribute the public key, and dual-sign (classical + ML-DSA) until all verifiers are upgraded.

Before

python
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey

key = Ed25519PrivateKey.generate()
sig = key.sign(b"release-1.2.3.tar.gz digest")     # 64 bytes
key.public_key().verify(sig, b"release-1.2.3.tar.gz digest")

After

python
from cryptography.hazmat.primitives.asymmetric.mldsa import MLDSA65PrivateKey, MLDSA65PublicKey
from cryptography.hazmat.primitives import serialization

key = MLDSA65PrivateKey.generate()
msg = b"release-1.2.3.tar.gz digest"
sig = key.sign(msg, context=b"myapp/release/v1")   # 3309 bytes; context is optional
pub = key.public_key()
pub.verify(sig, msg, context=b"myapp/release/v1")  # raises InvalidSignature on failure

# Distribute / store
pub_raw = pub.public_bytes_raw()                    # 1952 bytes
pub_pem = pub.public_bytes(serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo)
seed = key.private_bytes_raw()                      # 32-byte seed; protect it like any private key
same_key = MLDSA65PrivateKey.from_seed_bytes(seed)

Gotchas

  • Sizes. Signature 3,309 bytes, public key 1,952 bytes. Check column types, message limits and anything that embeds signatures in URLs or headers.
  • Context must match between signer and verifier.
  • Seed-only private keys. private_bytes* returns the seed form; some other tools expect the expanded key. Test interoperability with whatever else reads your keys (HSMs, OpenSSL, Go, Java).
  • Backend. A cryptography linked against an older system OpenSSL raises UnsupportedAlgorithm.
  • Large messages. For huge files, sign a SHA-512 digest with a clear domain label, or use the external-mu API (sign_mu, MLDSAMuHasher, 49+/50+) if you need streaming.

Verify

python
from cryptography.exceptions import InvalidSignature
try:
    pub.verify(sig, b"tampered", context=b"myapp/release/v1")
    raise SystemExit("should not verify")
except InvalidSignature:
    print("ok", len(sig))   # ok 3309