Documentation

CslibFrontier.Crypto.Computational.Encryption.KEMFromPKE

Key encapsulation from public-key encryption #

encryptKeyEncaps keyLen encrypt samples a uniform keyLen n-bit key and encrypts it using encrypt. This is the construction of [BS23], Exercise 11.9(e), p. 461, with the source key space represented by fixed-length bit words. A WordINDCPA scheme gives KEMINDCPA with exact reduction loss one: a step toward Exercise 11.9(e), not the cited result, because WordINDCPA admits every equal-length pair of bit strings as a challenge, where the exercise's E_a is defined over (K, C_a) and so encrypts only KEM keys (#5293). The conclusion KEMINDCPA also gives the distinguisher pk, which the printed KEM game does not; a stronger conclusion implies the printed one. The reduction samples two keys of the same length and retains one alongside the public key; therefore it respects the existing equal-length challenge rule, including at key length zero.

Key generation and the total deterministic decryptor are reused unchanged. Correctness is a separate supported-output theorem, and no failure symbol is added to this total-decapsulation model. Native strict-PPT certificates for encapsulation and for the reduction expose the unary polynomial-time key-length premise. Security itself does not assert correctness or sampleability of the honest key generator.

Main definitions #

Main results #

References #

noncomputable def Cslib.Crypto.Encryption.encryptKeyEncaps (keyLen : ℕ → ℕ) (encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)) (n : ℕ) (pk : List Bool) :

Sample a uniform symmetric key and encrypt it under the public key ([BS23], Exercise 11.9(e)).

theorem Cslib.Crypto.Encryption.decrypt_encryptKeyEncaps {keyLen : ℕ → ℕ} {encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)} (decrypt : ℕ → List Bool → List Bool → List Bool) {n : ℕ} {pk sk k ct : List Bool} (hcorrect : ∀ (m c : List Bool), m.length = keyLen n → c ∈ (encrypt n pk m).eval.support → decrypt n sk c = m) (h : (k, ct) ∈ (encryptKeyEncaps keyLen encrypt n pk).eval.support) :
decrypt n sk ct = k

The original total decryptor recovers every supported encapsulated key when it correctly decrypts supported encryptions of words of length keyLen n.

noncomputable def Cslib.Crypto.Encryption.kemToPKEChoose (keyLen : ℕ → ℕ) (n : ℕ) (pk : List Bool) :

The common chosen-message stage of the CPA and CCA reductions: sample two independent keys of equal length and retain the public key together with the first key.

noncomputable def Cslib.Crypto.Encryption.kemToPKEAdversary (keyLen : ℕ → ℕ) (distinguisher : Distinguisher) :

Reduce KEM distinguishing to word chosen-message encryption: choose independent keys k₀, k₁, store (pk, k₀), and give the distinguisher (pk, (k₀, ct)) after encryption.

The KEM-to-PKE reduction is native uniform strict PPT, including its saved public key and symmetric key, when the distinguisher and the unary key-length schedule are.

theorem Cslib.Crypto.Encryption.eval_gameOn_kemToPKEAdversary_false (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)) (distinguisher : Distinguisher) (n : ℕ) :
(gameOn (fun (x : ℕ) (x_1 m₀ m₁ : List Bool) => m₀.length == m₁.length) keyGen encrypt (kemToPKEAdversary keyLen distinguisher) false n).eval = (kemRealGame keyGen (encryptKeyEncaps keyLen encrypt) distinguisher n).eval

The first PKE experiment is exactly the real KEM experiment.

theorem Cslib.Crypto.Encryption.eval_gameOn_kemToPKEAdversary_true (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)) (distinguisher : Distinguisher) (n : ℕ) :
(gameOn (fun (x : ℕ) (x_1 m₀ m₁ : List Bool) => m₀.length == m₁.length) keyGen encrypt (kemToPKEAdversary keyLen distinguisher) true n).eval = (kemIdealGame keyLen keyGen (encryptKeyEncaps keyLen encrypt) distinguisher n).eval

The second PKE experiment is exactly the ideal KEM experiment: the retained key is independent of the key encrypted in the ciphertext.

theorem Cslib.Crypto.Encryption.advantage_encryptKeyEncaps_eq (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)) (distinguisher : Distinguisher) (n : ℕ) :
Game.advantage (kemRealGame keyGen (encryptKeyEncaps keyLen encrypt) distinguisher n).eval (kemIdealGame keyLen keyGen (encryptKeyEncaps keyLen encrypt) distinguisher n).eval = advantage (gameOn (fun (x : ℕ) (x_1 m₀ m₁ : List Bool) => m₀.length == m₁.length) keyGen encrypt (kemToPKEAdversary keyLen distinguisher)) n

Exact loss-one reduction for the encrypted-key KEM: a step toward [BS23], Exercise 11.9(e), not the cited result, which is the asymptotic statement whose premise is discussed at WordINDCPA.kemINDCPA_encryptKeyEncaps (#5293).

The reduction challenges only with keyLen n-bit keys, so the right-hand side stays in the exercise's message space K; the message-space gap lies in that theorem's premise, not here. The two games use the same keyLen n key space and the same security parameter n.

Semantically secure word encryption gives a secure encrypted-key KEM: a step toward [BS23], Exercise 11.9(e), not the cited result, because the premise WordINDCPA admits every pair of equal-length bit strings as a challenge, where the exercise's E_a is defined over (K, C_a) and encrypts only KEM keys (#5293).

A scheme that is semantically secure on K but leaks on messages of another length meets the exercise's premise and not this one. The conclusion KEMINDCPA gives the distinguisher pk, which the printed KEM game (printed p. 460) does not; a stronger conclusion implies the printed one, so this is harmless. The native reduction only samples keys and runs the supplied distinguisher.