Documentation

CslibFrontier.Crypto.Computational.Encryption.KEMFromPKE.CCA

CCA security of encrypted-key encapsulation #

The encrypted-key KEM of [BS23], Exercise 12.5(f), has the advantage of an explicit adversary in the equal-length PKE CCA experiment restricted to the ciphertext space ctSpace. The reduction samples two independent keys, retains the first, and forwards the KEM adversary's adaptive decapsulation queries unchanged. Both experiments reject the exact challenge word and any word outside ctSpace with [] (encOption encBits none), and preserve Option replies inside ctSpace, including the distinction between none ([]) and some [] ([true]).

Only postchallenge KEM queries are claimed. The source PKE notion permits queries in both phases; this reduction uses zero queries in its first phase. Correctness and honest algorithm efficiency are separate from indistinguishability. The security parameter remains n, while the sampled keys have length keyLen n, including length zero.

The security theorem is a step toward Exercise 12.5(f), printed p. 514, not the exercise itself: its premise WordINDCCA2 admits every pair of equal-length bit strings as a challenge, where the exercise's scheme E_a is defined over (K, C_a) and encrypts only KEM keys (#5293). Decryption queries outside ctSpace (C_a = C_kem) are answered with rejection [] without invoking decrypt, matching Attack Game 12.1 and Exercise 12.5 on an efficiently recognizable ctSpace.

Main definitions #

Main results #

References #

noncomputable def Cslib.Crypto.Encryption.kemToCCAAdversary (keyLen : ℕ → ℕ) (distinguisher : OracleDistinguisher) :

The CPA reduction's chosen-message sampler, followed by the oracle distinguisher with all its decapsulation queries forwarded unchanged. The first stage makes no external query.

The source PKE experiment's prechallenge oracle is unused by this reduction.

Native uniform strict oracle PPT for the reduction. The key-length computation is charged in unary; the reduction does not execute key generation, encryption or decryption.

theorem Cslib.Crypto.Encryption.eval_cca2GameOn_kemToCCAAdversary_false (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)) (decrypt : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : OracleDistinguisher) (n : ℕ) :
(cca2GameOn (fun (x : ℕ) (x_1 m₀ m₁ : List Bool) => m₀.length == m₁.length) Turing.MultiTapeTM.encBits keyGen encrypt (fun (n : ℕ) (sk ct : List Bool) => if ctSpace n ct = true then decrypt n sk ct else none) (kemToCCAAdversary keyLen distinguisher) false n).eval = (kemCCARealGame ctSpace keyGen (encryptKeyEncaps keyLen encrypt) decrypt distinguisher n).eval

The first chosen-message CCA experiment is the real KEM experiment, including all adaptive decapsulation replies.

theorem Cslib.Crypto.Encryption.eval_cca2GameOn_kemToCCAAdversary_true (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)) (decrypt : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : OracleDistinguisher) (n : ℕ) :
(cca2GameOn (fun (x : ℕ) (x_1 m₀ m₁ : List Bool) => m₀.length == m₁.length) Turing.MultiTapeTM.encBits keyGen encrypt (fun (n : ℕ) (sk ct : List Bool) => if ctSpace n ct = true then decrypt n sk ct else none) (kemToCCAAdversary keyLen distinguisher) true n).eval = (kemCCAIdealGame ctSpace keyLen keyGen (encryptKeyEncaps keyLen encrypt) decrypt distinguisher n).eval

The second chosen-message CCA experiment is the ideal KEM experiment. The same secret key, ctSpace guard, and ciphertext determine the oracle while the retained key is independent of the encrypted key.

theorem Cslib.Crypto.Encryption.advantage_encryptKeyEncaps_cca_eq (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)) (decrypt : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : OracleDistinguisher) (n : ℕ) :
Game.advantage (kemCCARealGame ctSpace keyGen (encryptKeyEncaps keyLen encrypt) decrypt distinguisher n).eval (kemCCAIdealGame ctSpace keyLen keyGen (encryptKeyEncaps keyLen encrypt) decrypt distinguisher n).eval = advantage (cca2GameOn (fun (x : ℕ) (x_1 m₀ m₁ : List Bool) => m₀.length == m₁.length) Turing.MultiTapeTM.encBits keyGen encrypt (fun (n : ℕ) (sk ct : List Bool) => if ctSpace n ct = true then decrypt n sk ct else none) (kemToCCAAdversary keyLen distinguisher)) n

Loss one in the adaptive CCA experiment restricted to ctSpace. There is no correctness premise and no error term: the reduction preserves both output distributions.

theorem Cslib.Crypto.Encryption.WordINDCCA2.indistinguishable_encryptKeyEncaps {ctSpace : ℕ → List Bool → Bool} {keyLen : ℕ → ℕ} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)} {decrypt : ℕ → List Bool → List Bool → Option (List Bool)} (hsecure : WordINDCCA2 keyGen encrypt fun (n : ℕ) (sk ct : List Bool) => if ctSpace n ct = true then decrypt n sk ct else none) (hkeyLen : Turing.MultiTapeTM.ComputableInPolyTime keyLen Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) :
Game.Indistinguishable (fun (D : OracleDistinguisher) (n : ℕ) => (kemCCARealGame ctSpace keyGen (encryptKeyEncaps keyLen encrypt) decrypt D n).eval) (fun (D : OracleDistinguisher) (n : ℕ) => (kemCCAIdealGame ctSpace keyLen keyGen (encryptKeyEncaps keyLen encrypt) decrypt D n).eval) (Probability.IsOraclePPT Turing.MultiTapeTM.encBool)

CCA-secure word PKE on ciphertext space ctSpace gives its encrypted-key KEM security against adaptive decapsulation queries on ctSpace: a step toward [BS23], Exercise 12.5(f), not the cited result, because the premise WordINDCCA2 covers every pair of equal-length messages, where the exercise assumes 1CCA security of a scheme over (K, C_a) (#5293).

The exercise's scheme E_a is defined over (K, C_a) (Exercise 11.9(e), printed p. 461), so its messages are only the KEM keys, and in Attack Game 12.1 (printed pp. 467–468) its decryption queries lie in C_a. Both the premise and the conclusion restrict decryption/decapsulation queries to ctSpace (C_a = C_kem), answering words outside ctSpace with rejection [] without invoking decrypt. However, WordINDCCA2 still admits every equal-length pair of bit strings as a challenge (#5293): a scheme that is 1CCA secure on K but leaks on messages of another length meets the exercise's premise and not this one. The reduction kemToCCAAdversary challenges only with keyLen n-bit keys, and it forwards the KEM adversary's decapsulation queries unchanged.

The KEM adversary receives one challenge and may query adaptively afterwards. The conclusion's KEM games give it pk alongside the challenge, which only strengthens the conclusion (and matches the KEM premise of hybrid_indcca2On). The security assertion uses the existing indistinguishability and native oracle PPT predicates.

theorem Cslib.Crypto.Encryption.isPPTOn_kemCCAGames_encryptKeyEncaps {ctSpace : ℕ → List Bool → Bool} {keyLen : ℕ → ℕ} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)} {decrypt : ℕ → List Bool → List Bool → Option (List Bool)} {distinguisher : OracleDistinguisher} (hctSpace : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => ctSpace p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool) (hkeyLen : Turing.MultiTapeTM.ComputableInPolyTime keyLen Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hkeyGen : Probability.IsPPTOn Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) keyGen) (hencrypt : Probability.IsPPTOn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits)) Turing.MultiTapeTM.encBits fun (p : ℕ × List Bool × List Bool) => encrypt p.1 p.2.1 p.2.2) (hdecrypt : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool × List Bool) => decrypt p.1 p.2.1 p.2.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits)) (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits)) (hdist : Probability.IsOraclePPT Turing.MultiTapeTM.encBool distinguisher) :

Both closed KEM experiments have native strict-PPT realizations when ctSpace, the honest algorithms, and the adversary do. The exact game equalities reuse the existing finite-machine certificates for the complete CCA experiment, including the cost of answering adaptive oracle requests.

theorem Cslib.Crypto.Encryption.decrypt_encryptKeyEncaps_some {keyLen : ℕ → ℕ} {encrypt : ℕ → List Bool → List Bool → ProbComp (List Bool)} (decrypt : ℕ → List Bool → List Bool → Option (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 = some m) (h : (k, ct) ∈ (encryptKeyEncaps keyLen encrypt n pk).eval.support) :
decrypt n sk ct = some k

Supported encrypted keys decrypt to some key; invalid ciphertexts may still return none. In particular successful decapsulation of an empty key is not rejection.