Key encapsulation

ML-KEM-512

NIST's primary post-quantum key encapsulation mechanism, standardised in FIPS 203

safe Safe API Specified in a FIPS standard Post-quantum

About ML-KEM-512

ML-KEM-512 is one of 3 ML-KEM variants in the NextSSL registry, a key encapsulation mechanism. It uses an 800-byte public key, a 1,632-byte secret key, a 768-byte ciphertext, a 32-byte shared secret and a 64-byte seed. Its registry entry cites FIPS 203. It is also known as mlkem512. It is designed to resist attacks by large quantum computers. NextSSL lists it in the safe tier and exposes it through the safe API.

Overview

ML-KEM is the Module-Lattice-Based Key-Encapsulation Mechanism standardised by NIST in FIPS 203. It lets two parties establish a shared secret that is believed to resist attacks by both classical and quantum computers, and it is the default choice for post-quantum key establishment.

ML-KEM is derived from CRYSTALS-Kyber, the lattice-based KEM that NIST selected at the end of the third round of its post-quantum standardisation process. Its security rests on the Module Learning With Errors problem: recovering a secret vector from noisy linear equations over a polynomial ring. Arithmetic takes place in the ring of polynomials of degree below 256 with coefficients modulo 3329, which allows fast multiplication with the number-theoretic transform.

The scheme starts from an IND-CPA public-key encryption scheme and turns it into an IND-CCA2 secure KEM with a variant of the Fujisaki-Okamoto transform. Decapsulation re-encrypts the recovered message and compares the result with the received ciphertext; on mismatch it returns a pseudorandom value derived from a secret seed (implicit rejection), so invalid ciphertexts reveal nothing useful to an attacker.

Three parameter sets are defined. ML-KEM-512 targets NIST security category 1 (comparable to AES-128), ML-KEM-768 targets category 3 and ML-KEM-1024 targets category 5. ML-KEM-768 is the most widely deployed set and is the one used in the X25519MLKEM768 hybrid key exchange for TLS 1.3. Public keys range from 800 to 1568 bytes and ciphertexts from 768 to 1568 bytes. Secret keys are larger, up to 3168 bytes, because they embed the public key and its hash.

History

2016–2025
  1. NIST calls for post-quantum KEMs and signatures

    NIST Post-Quantum Cryptography standardisation
  2. CRYSTALS-Kyber submitted to NIST PQC

  3. 26 candidates advance to round 2

    NIST Post-Quantum Cryptography standardisation
  4. Round 3 finalists and alternates announced

    NIST Post-Quantum Cryptography standardisation
  5. Kyber selected by NIST

  6. Draft FIPS 203 released

  7. ML-KEM published as FIPS 203

  8. HQC selected as a second KEM

    NIST Post-Quantum Cryptography standardisation

How it works

  1. KeyGen samples a public matrix A from a seed and small secret and error vectors s and e, and publishes t = As + e.
  2. Encaps picks a random message m, derives encryption randomness from m and the public key, and encrypts m under the public key.
  3. The shared secret is derived from m with SHA-3 based functions, and the ciphertext is sent to the key holder.
  4. Decaps decrypts to recover m, re-encrypts it and checks the result matches the ciphertext.
  5. On a mismatch, decapsulation returns a pseudorandom secret derived from a stored rejection seed instead of an error.

Security notes

ML-KEM is considered sound and is NIST's recommended post-quantum KEM. Implementations must be constant time: timing leaks in decapsulation (for example the KyberSlash division issue in several Kyber libraries) have allowed key recovery. During the transition it is commonly deployed in hybrid mode alongside X25519 or ECDH.

Typical uses

Post-quantum or hybrid key exchange in TLS 1.3, SSH and VPNsProtecting long-lived data against harvest-now, decrypt-later attacksKEM component of HPKE-style public-key encryption

Sizes

FieldBytesMeaning
pk800Public key
sk1,632Secret key
ct768Ciphertext
ss32Shared secret
seed64Seed
coins32Encapsulation randomness

Use it

from nextssl_demo import NextSSL

ns = NextSSL()              # safe API: safe and standard tiers
pk, sk = ns.call("kem_keygen", "ml-kem-512", None, outs=2)
ct, ss = ns.call("kem_encaps", "ml-kem-512", None, pk, outs=2)
assert ss == ns.call("kem_decaps", "ml-kem-512", None, sk, ct)[0]

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Other ML-KEM variants

2

Frequently asked questions

What is ML-KEM-512?

ML-KEM-512 is a KEM in the ML-KEM family. ML-KEM is the Module-Lattice-Based Key-Encapsulation Mechanism standardised by NIST in FIPS 203. It is also known as mlkem512.

What are the ML-KEM-512 sizes?

In NextSSL, ML-KEM-512 uses: public key 800 bytes, ciphertext 768 bytes, shared secret 32 bytes.

Is ML-KEM-512 post-quantum?

Yes. ML-KEM-512 is a post-quantum kem: it is designed to resist attacks by large quantum computers. Its tier in NextSSL is safe.

Who designed ML-KEM-512 and when?

ML-KEM-512 belongs to the ML-KEM family, first published in 2024 by Roberto Avanzi, Joppe Bos, Léo Ducas, Eike Kiltz, Tancrède Lepoint, Vadim Lyubashevsky, John M. Schanck, Peter Schwabe, Gregor Seiler, Damien Stehlé (CRYSTALS-Kyber team). Its origin: NIST PQC standard (FIPS 203).

Which standards define ML-KEM-512?

ML-KEM-512 is referenced by FIPS 203. It is specified in a FIPS standard.

Is ML-KEM-512 safe to use?

ML-KEM-512 is in the safe tier. Modern and recommended. The default choice for new designs. It can be called from the safe API.

What other ML-KEM variants are there?

NextSSL also registers ml-kem-1024, ml-kem-768 in the ML-KEM family.