K-PKE, the public-key encryption scheme inside ML-KEM #
K-PKE (NIST, Section 5, Algorithms 13–15) is Module-LWE encryption over
R_q = ℤ_q[X] / (X^n + 1) with centered-binomial secrets and errors and lossy ciphertext
compression:
- key generation samples
A ∈ R_q^{k×k},s, e ← CBD_{η₁}^kand publishes(A, A s + e); - encryption of
m ∈ {0,1}^nwith coinsr ← CBD_{η₁}^k,e₁ ← CBD_{η₂}^k,e₂ ← CBD_{η₂}computesu = Aᵀ r + e₁andv = bᵀ r + e₂ + Decompress_1(m)and outputs(Compress_{d_u}(u), Compress_{d_v}(v)); - decryption outputs
Compress_1(v' - sᵀ u')for the decompressed(u', v').
The uncompressed ciphertext is the existing moduleLWEEncrypt ciphertext of the all-zero message
shifted by the FIPS 203 message polynomial (encryptRaw_eq_moduleLWEEncrypt_add); the two encodings
differ because FIPS 203 rounds q / 2 up. Public keys reuse ModuleLWEPublicKey, and the scheme is
packaged through the shared ExplicitCoinPKE interface (toExplicitCoinPKE) for later use by the
Fujisaki–Okamoto layer.
Correctness is deterministic: decryption recovers m whenever every coefficient of the decryption
noise decryptionNoise, which collects the Module-LWE error terms and both compression errors, has
centered magnitude at most B with 4 * B + 2 < q (decrypt_encrypt_eq_of_noise_le). The
compression errors are bounded by natAbs_valMinAbs_decompress_compress_sub_le.
Model differences #
- The matrix
Ais sampled uniformly rather than expanded from a seed bySampleNTT, and the secrets and errors are sampled bysampleCenteredBinomialrather than derived from a seed byPRF; byte encodings are omitted. - Polynomials are in coefficient form and multiplied with
negacyclicMul; FIPS 203 stores them in the NTT domain, which is a ring isomorphism and does not change the scheme. - The ring degree
nand modulusqare parameters (FIPS 203 fixesn = 256,q = 3329), so small instances can be checked by evaluation.
Main definitions #
Cslib.Crypto.MLKEM.Params,Cslib.Crypto.MLKEM.mlkem512,Cslib.Crypto.MLKEM.mlkem768,Cslib.Crypto.MLKEM.mlkem1024: parameter sets of NIST, Section 8, Table 2.Cslib.Crypto.MLKEM.encryptRaw,Cslib.Crypto.MLKEM.encrypt,Cslib.Crypto.MLKEM.decrypt: deterministic K-PKE encryption (before and after compression) and decryption.Cslib.Crypto.MLKEM.samplePolyCBD,Cslib.Crypto.MLKEM.keyGen,Cslib.Crypto.MLKEM.sampleCoins: centered-binomial sampling programs.Cslib.Crypto.MLKEM.toExplicitCoinPKE: K-PKE as an explicit-coin public-key scheme.
Main results #
Cslib.Crypto.MLKEM.decrypt_encrypt_phase: the decryption phase is the message polynomial plusdecryptionNoise.Cslib.Crypto.MLKEM.decrypt_encrypt_eq_of_noise_le: bounded-noise decryption correctness.
References #
Parameters #
ML-KEM parameters: ring degree n, modulus q, module rank k, centered-binomial widths
η₁ (secrets and encryption randomness) and η₂ (encryption errors), and compression widths
d_u, d_v. The degree and modulus default to the FIPS 203 values 256 and 3329.
- n : ℕ
Ring degree
n. - q : ℕ
Modulus
q. - k : ℕ
Module rank
k. - η₁ : ℕ
Centered-binomial width
η₁of the secret, key error and encryption randomness. - η₂ : ℕ
Centered-binomial width
η₂of the encryption errors. - du : ℕ
Compression width
d_uof the vector part of a ciphertext. - dv : ℕ
Compression width
d_vof the scalar part of a ciphertext.
ML-KEM-512 (NIST, Section 8, Table 2): k = 2, η₁ = 3, η₂ = 2,
d_u = 10, d_v = 4.
ML-KEM-768 (NIST, Section 8, Table 2): k = 3, η₁ = 2, η₂ = 2,
d_u = 10, d_v = 4.
ML-KEM-1024 (NIST, Section 8, Table 2): k = 4, η₁ = 2, η₂ = 2,
d_u = 11, d_v = 5.
The parameter sets approved by FIPS 203.
Instances For
Keys, ciphertexts and deterministic algorithms #
K-PKE public keys (A, b) are Module-LWE public keys.
K-PKE secret keys s ∈ R_q^k.
Encryption coins (r, e₁, e₂) ∈ R_q^k × R_q^k × R_q.
Compressed ciphertexts (c₁, c₂) with d_u-bit coefficients in c₁ ∈ (ℤ_{2^{d_u}}^n)^k and
d_v-bit coefficients in c₂ ∈ ℤ_{2^{d_v}}^n.
Compress both parts of an uncompressed ciphertext.
Decompress both parts of a ciphertext.
Deterministic K-PKE encryption K-PKE.Encrypt(pk, m; (r, e₁, e₂))
(NIST, Section 5, Algorithm 14), with explicit coins.
K-PKE decryption K-PKE.Decrypt(s, c) = Compress_1(v' - sᵀ u')
(NIST, Section 5, Algorithm 15), reading coefficient 1 as the bit true.
The existing Module-LWE encoding of the all-zero message is zero.
Relation to moduleLWEEncrypt: uncompressed K-PKE encryption is Module-LWE encryption of
the all-zero message, shifted by the FIPS 203 message polynomial.
Bounded-noise correctness #
The decryption noise of an honest encryption: the Module-LWE error
eᵀ r - sᵀ e₁ + e₂, plus the scalar compression error c_v, minus sᵀ c_u for the vector
compression error c_u.
Decryption phase: for an honest key and encryption, v' - sᵀ u' equals the message
polynomial plus decryptionNoise.
Bounded-noise correctness of K-PKE: if every coefficient of decryptionNoise has centered
magnitude at most B and 4 * B + 2 < q, decryption of an honest encryption recovers the
message.
Centered-binomial sampling programs #
SamplePolyCBD_η (NIST, Section 4.2.2, Algorithm 8) as a program: n
independent centered-binomial coefficients of width η, reduced modulo q.
K-PKE key generation (NIST, Section 5, Algorithm 13) with a uniform matrix:
A uniform, s, e ← CBD_{η₁}^k, output ((A, A s + e), s).
K-PKE encryption coins (NIST, Section 5, Algorithm 14):
r ← CBD_{η₁}^k, e₁ ← CBD_{η₂}^k, e₂ ← CBD_{η₂}.
K-PKE as an explicit-coin public-key encryption scheme. Decryption never fails.