ML-KEM
Module-lattice KEM from FIPS 203.
from oxcrypto.kem.ml_kem import ML_KEM
private_key = ML_KEM.ML_KEM_768.generate()
ciphertext, shared_secret = private_key.public_key().encapsulate()
assert private_key.decapsulate(ciphertext) == shared_secret| Variant | Private key | Public key | Ciphertext | Shared secret |
|---|---|---|---|---|
ML_KEM_512 | 64 bytes | 800 bytes | 768 bytes | 32 bytes |
ML_KEM_768 | 64 bytes | 1184 bytes | 1088 bytes | 32 bytes |
ML_KEM_1024 | 64 bytes | 1568 bytes | 1568 bytes | 32 bytes |
Private keys serialize as the 64-byte seed d || z from FIPS 203. The
expanded decapsulation key format is not accepted; the upstream crate
deprecates it. load_public_key applies the FIPS 203 encapsulation key check
and raises ValueError for a key that fails it.
- Standard: FIPS 203 (August 2024).
- Crate: RustCrypto
ml-kem0.3.4, stable release, no published audit. Builds with Rust 1.88. - Vectors: NIST ACVP-Server
ML-KEM-keyGen-FIPS203andML-KEM-encapDecap-FIPS203(key generation, encapsulation, decapsulation, key checks). Encapsulation and decapsulation vectors and differential tests againstlibcrux-ml-kem0.0.10 run in Rust (tests/ml_kem.rs); libcrux is a development-only dependency and is not part of the wheel.
Zeroization
Retained state: the decapsulation key holds the PKE secret vector, the seed
d, the implicit-rejection value z and the public encapsulation key. With
the zeroize feature, ml-kem wipes the secret parts on drop.
Short-lived copies not wiped by the upstream crate: the decapsulation intermediates (decrypted message, re-encryption randomness, candidate shared keys) and the shared key array before oxcrypto copies it into a wiped buffer.
oxcrypto enables the zeroize features of sha3 and shake, so the upstream
SHA-3 and SHAKE states are wiped on drop.