Ring-LWE and Module-LWE Public-Key Encryption #
This module formalizes a Module-LWE public-key encryption scheme over the negacyclic polynomial
ring R_q = ℤ_q[X] / (X^n + 1) and modules R_q^k ([Reg09], [LPR10],
[DKL+18]), in which the public key is a Module-LWE sample and the ciphertext is a second
Module-LWE sample masked by the encoded message:
- Adjoint identity (
innerPoly_moduleSISMap_eq): the polynomial inner productinnerPoly b r = ∑ j, negacyclicMul (b j) (r j)and the commutative ring algebra ofnegacyclicMulare inCslibFrontier.Foundations.Algebra.Negacyclic. Here they giveinnerPoly (moduleSISMap A s) r = innerPoly (moduleSISMap Aᵀ r) s. - Polynomial-ring message encoding and centered-lift rounding (
encodePolyMsg,decodePolyMsg,decodePolyMsg_encodePolyMsg_add_noise): A message bit-vectorm : Fin n → Boolis encoded intoFin n → ZMod qby mappingfalse ↦ 0andtrue ↦ ⌊q / 2⌋, and decoded by lifting each coefficient to its centered representative in(-q/2, q/2](SIS.liftCentered) and testing whether its magnitude exceeds⌊q / 4⌋. Whenever4 * B + 2 < qand every coefficient of an integer error polynomialerrhas magnitude at mostB, decodingencodePolyMsg q m + errrecoversm(decodePolyMsg_encodePolyMsg_add_noise). - Module-LWE public-key encryption and bounded-noise correctness (
moduleLWEKeyGen,moduleLWEEncrypt,moduleLWEDecrypt,moduleLWEDecrypt_moduleLWEEncrypt_eq):- Key generation maps
(A, s, e)to the public key(A, b) = (A, moduleSISMap A s + e). - Encryption of
m : Fin n → Boolunderpk = (A, b)with ephemeral secretrand noises(e₁, e₂)outputs(u, v) = (moduleSISMap Aᵀ r + e₁, innerPoly b r + e₂ + encodePolyMsg q m). - Decryption under secret key
scomputesdecodePolyMsg (v - innerPoly u s). By the ring-bilinearity identityinnerPoly_moduleSISMap_add_sub, theA · s · rterms cancel and leaveencodePolyMsg q m + (innerPoly e r - innerPoly e₁ s + e₂). When the centered coefficients ofs, rare bounded byB_s, B_rand those ofe, e₁, e₂are bounded byB_ewith4 * (k * n * B_e * B_r + k * n * B_e * B_s + B_e) + 2 < q(in particular whenB_s ≤ B_rand4 * (2 * k * n * B_e * B_r + B_e) + 2 < q), decryption recoversmdeterministically (moduleLWEDecrypt_moduleLWEEncrypt_eq).
- Key generation maps
- Public-key pseudorandomness from
DecisionModuleLWEand Module-LWE advantage bounds for ciphertexts:- Replacing the honest public key
(A, A · s + e)with a uniform pair(A, b)is the word-level form ofDecisionModuleLWE k k n q noise(moduleLWEPublicKeyLaw_eq_sampleLaw,publicKey_indistinguishable_of_decisionModuleLWE, viaDecisionModuleLWEWith.encoded). - Under a uniform public key
(A, b), stackingbaboveAᵀviaextendPublicKeyMatrixandvaboveuviaextendCiphertextembeds(pk, moduleLWEEncrypt pk r e₁ e₂ m)into a(k + 1) × kModule-LWE sample masked by(0, Fin.cons (encodePolyMsg q m) 0)(extendCiphertext_moduleLWEEncrypt,uniformKeyEncryptionLaw_eq_sampleLaw_map). Replacing that(k + 1) × kModule-LWE sample with a uniform sample yields a completely uniform(pk, ct)distribution independent ofm(uniformSample_mask_eq_uniform), bounding single-encryption distinguishing advantage by twoModuleLWEadvantages (advantage_realEncryptionView_uniform_le,advantage_realEncryptionView_msg_le). - The two ciphertext bounds are inequalities between
Game.advantagevalues at one fixed(k, n, q), for an arbitrary functionDintoGamewith no efficiency condition. OnlypublicKey_indistinguishable_of_decisionModuleLWEhas aDecisionModuleLWEhypothesis; this module does not deriveComputationallyIndistinguishableencryption views from it.
- Replacing the honest public key
The statements of item 4 draw the secret s and the ephemeral secret r uniformly from R_q^k,
whereas the correctness theorems of item 3 assume centered bounds B_s and B_r on them. When
0 < k * n, bounds that hold for every s and r satisfy q / 2 ≤ B_s and q / 2 ≤ B_r, and
the hypothesis on q then forces B_e = 0, that is, e, e₁ and e₂ are zero. Hence, for
0 < k * n and nonzero noise, no choice of bounds makes the correctness theorems apply to every
s and r drawn in item 4.
Main definitions #
Cslib.Crypto.encodePolyMsg,Cslib.Crypto.decodePolyMsg:n-bit polynomial message encoding and centered-lift threshold decoding moduloq.Cslib.Crypto.ModuleLWEPublicKey,Cslib.Crypto.ModuleLWECiphertext: public-key and ciphertext types for rank-kModule-LWE encryption.Cslib.Crypto.moduleLWEKeyGen,Cslib.Crypto.moduleLWEEncrypt,Cslib.Crypto.moduleLWEDecrypt: key generation, encryption and decryption.Cslib.Crypto.moduleLWEErrorPoly: combined decryption noise polynomialinnerPoly e r - innerPoly e₁ s + e₂.Cslib.Crypto.extendPublicKeyMatrix,Cslib.Crypto.extendCiphertext: embedding of(A, b)and(u, v)into a(k + 1) × kModule-LWE instance.Cslib.Crypto.moduleLWEPublicKeyLaw,Cslib.Crypto.encryptionViewOfKeyLaw,Cslib.Crypto.realEncryptionView: explicit secret/ephemeral laws, defaulting to uniform.Cslib.Crypto.uniformKeyEncryptionLaw,Cslib.Crypto.hybridEncryptionView,Cslib.Crypto.uniformEncryptionView: public-key and encryption view distributions.
Main results #
Cslib.Crypto.innerPoly_moduleSISMap_eq,Cslib.Crypto.innerPoly_moduleSISMap_add_sub: adjoint identity formoduleSISMapand noisy bilinear cancellation.Cslib.Crypto.decodePolyMsg_encodePolyMsg_add_noise: bounded-error recovery fordecodePolyMsg.Cslib.Crypto.moduleLWEDecrypt_moduleLWEEncrypt_eq,Cslib.Crypto.moduleLWEDecrypt_moduleLWEEncrypt_eq_of_bounds: deterministic bounded-noise decryption correctness.Cslib.Crypto.publicKey_indistinguishable_of_decisionModuleLWE,Cslib.Crypto.uniformKeyEncryptionLaw_eq_sampleLaw_map,Cslib.Crypto.uniformSample_mask_eq_uniform,Cslib.Crypto.advantage_realEncryptionView_uniform_le,Cslib.Crypto.advantage_realEncryptionView_msg_le: public-key pseudorandomness underDecisionModuleLWE, and distribution identities andModuleLWEadvantage bounds for(pk, ct)views against an arbitrary function intoGame.
References #
Part 1: Bilinearity of innerPoly against moduleSISMap #
Part 2: Polynomial-Ring Message Encoding and Centered-Lift Rounding #
Bounded-error decoding correctness for encodePolyMsg and decodePolyMsg: if
4 * B + 2 < q and every coefficient of the integer error polynomial err : Fin n → ℤ satisfies
(err i).natAbs ≤ B, then decodePolyMsg recovers m from
encodePolyMsg q m + fun i => (err i : ZMod q).
Noiseless round-trip identity for encodePolyMsg and decodePolyMsg whenever 2 < q.
Part 3: Ring-LWE / Module-LWE Public-Key Encryption and Decryption Correctness #
A Module-LWE public key (A, b) of module rank k over ℤ_q[X] / (X^n + 1) consists of a
k × k polynomial matrix A and a length-k polynomial vector b = A · s + e.
A Module-LWE ciphertext (u, v) of module rank k over ℤ_q[X] / (X^n + 1) consists of a
length-k polynomial vector u and a single ring element v.
Deterministic Module-LWE encryption of m : Fin n → Bool under public key pk = (A, b) with
ephemeral secret r : Fin k → Fin n → ZMod q and noises e₁ : Fin k → Fin n → ZMod q and
e₂ : Fin n → ZMod q:
u = moduleSISMap Aᵀ r + e₁ and v = innerPoly b r + e₂ + encodePolyMsg q m.
Deterministic Module-LWE decryption of ciphertext ct = (u, v) using secret key s:
compute v - innerPoly u s and apply decodePolyMsg.
Algebraic noise cancellation in decryption: for
ct = moduleLWEEncrypt (moduleLWEKeyGen A s e) r e₁ e₂ m, the decryption phase
ct.2 - innerPoly ct.1 s equals encodePolyMsg q m + (innerPoly e r - innerPoly e₁ s + e₂).
Casting moduleLWEErrorPoly to ZMod q agrees with the modular error expression
innerPoly e r - innerPoly e₁ s + e₂ on the centered integer lifts.
Infinity-norm bound on moduleLWEErrorPoly: if ‖s‖_∞ ≤ B_s, ‖r‖_∞ ≤ B_r, and
‖e‖_∞, ‖e₁‖_∞, ‖e₂‖_∞ ≤ B_e, then every coefficient of moduleLWEErrorPoly s r e e₁ e₂ has
absolute value at most k * n * B_e * B_r + k * n * B_e * B_s + B_e.
Bounded-noise decryption correctness (general B_s, B_r, B_e bounds): when s, r, e, e₁
and e₂ satisfy the centered ℓ_∞ bounds B_s, B_r, B_e and
4 * (k * n * B_e * B_r + k * n * B_e * B_s + B_e) + 2 < q, decrypting an encryption of m
recovers m.
Bounded-noise decryption correctness: when s and r have centered ℓ_∞ norm bounded by
B_s and B_r with B_s ≤ B_r, e, e₁, e₂ have centered ℓ_∞ norm bounded by B_e, and
4 * (2 * k * n * B_e * B_r + B_e) + 2 < q, decrypting
moduleLWEEncrypt (moduleLWEKeyGen A s e) r e₁ e₂ m recovers m.
Part 4: Public-Key Pseudorandomness and Module-LWE Advantage Bounds for Ciphertexts #
Draw a secret from secretLaw, a uniform matrix, and independent polynomial errors, then
output the existing key generator's public key. The default secret law is uniform, exactly as
required by the ModuleLWE.sampleLaw identity and advantage bounds below.
The honest public-key distribution is the k × k Module-LWE sample law ModuleLWE.sampleLaw
with a uniform secret and independent polynomial errors drawn from noise.
Public-key pseudorandomness (DecisionModuleLWE Hop 1): under
DecisionModuleLWE k k n q noise, the encoded honest public-key ensemble is computationally
indistinguishable from the encoded uniform public-key ensemble
ModuleLWE.uniformEnsemble k k n q.
Recover a public key (A, b) from a (k + 1) × k module matrix by reading row 0 as b and
the transpose of the remaining k rows as A.
Equivalence between ModuleLWEPublicKey k n q and (k + 1) × k module matrices.
Embed a ciphertext ct = (u, v) into a length-(k + 1) polynomial vector by placing v at
coordinate 0 and u at coordinates Fin.succ i.
Recover a ciphertext (u, v) from a length-(k + 1) polynomial vector.
Equivalence between ModuleLWECiphertext k n q and Fin (k + 1) → Fin n → ZMod q.
Structural embedding of encryption into (k + 1) × k Module-LWE:
extendCiphertext (moduleLWEEncrypt pk r e₁ e₂ m) is the (k + 1) × k Module-LWE sample
ModuleLWE.sample (extendPublicKeyMatrix pk) r (Fin.cons e₂ e₁) masked by
Fin.cons (encodePolyMsg q m) 0.
Equivalence masking the second component of a (k + 1) × k Module-LWE sample by
Fin.cons (encodePolyMsg q m) 0.
Distribution of the extended (k + 1) × k pair
(extendPublicKeyMatrix pk, extendCiphertext (moduleLWEEncrypt pk r e₁ e₂ m)) when pk is drawn
uniformly, r is drawn uniformly, e₁ ← PMF.pi (fun _ => noise), and e₂ ← noise.
Second DecisionModuleLWE hop identity: under a uniform public key pk, the extended
encryption distribution uniformKeyEncryptionLaw k n q noise m is the pushforward by
maskExtendedSampleEquiv m of the (k + 1) × k Module-LWE sample law ModuleLWE.sampleLaw with a
uniform secret and independent polynomial errors drawn from noise.
Masking the second component of a uniform (k + 1) × k Module-LWE sample by
maskExtendedSampleEquiv m leaves the uniform distribution invariant, so the resulting
distribution is independent of m.
Complete encryption view (pk, ct) under an arbitrary public-key distribution pkLaw,
drawing r from ephemeralLaw, e₂ ← noise, and e₁ ← PMF.pi (fun _ => noise).
The default ephemeral law is uniform, as used by the advantage bounds below.
Real encryption view (pk, ct) with explicit long-term and ephemeral secret laws.
Both default to uniform. The ModuleLWE.sampleLaw identities and advantage bounds of Part 4
concern those defaults; this parameterization does not extend them to other secret distributions.
The correctness theorem moduleLWEDecrypt_moduleLWEEncrypt_eq_of_bounds assumes centered bounds
B_s and B_r on the two secrets; under its hypothesis on q, such bounds cover every value
of a uniform secret only when k * n * B_e = 0.
Ideal uniform encryption view (pk, ct), completely independent of the message m.
Equivalence unextending a masked (k + 1) × k Module-LWE pair (M, w) into a (pk, ct)
pair.
hybridEncryptionView k n q noise m is the pushforward under unextendMaskedSample m of the
(k + 1) × k Module-LWE sample law with a uniform secret and independent polynomial errors drawn
from noise.
Pushing forward the uniform (k + 1) × k sample distribution under unextendMaskedSample m
yields uniformEncryptionView k n q for every message m.
Two-hop ModuleLWE advantage bound for (pk, ct): for any semantic distinguisher
D : ModuleLWEPublicKey k n q × ModuleLWECiphertext k n q → Game and any message m, the
distinguishing advantage between realEncryptionView k n q noise m and
uniformEncryptionView k n q is bounded by the sum of:
- the
k × kModuleLWEadvantage (replacing the public key with uniform), and - the
(k + 1) × kModuleLWEadvantage (replacing the ciphertext with uniform).
Two-message CPA distinguishing bound via uniformEncryptionView: for any two messages
m₀, m₁ : Fin n → Bool and any semantic distinguisher D, the advantage between
realEncryptionView k n q noise m₀ and realEncryptionView k n q noise m₁ is bounded by their
respective distances to the message-independent uniformEncryptionView k n q.