Documentation

CslibFrontier.Crypto.Computational.Encryption.Hybrid.CCA

Adaptive decapsulation experiments #

The KEM experiments of [BS23], Exercise 12.5, reuse the real and ideal sampling continuations of Hybrid. After receiving (pk, (shownKey, ct)), the adversary may make adaptive decapsulation queries over a KEM ciphertext space ctSpace : ℕ → List Bool → Bool. Using cca2Phase2Oracle, both worlds reject the exact challenge word and every word outside ctSpace with [] (encOption encBits none) without invoking decaps, and encode every other Option reply, distinguishing rejection from an accepted empty key ([true]). When ctSpace is efficiently recognizable, an adversary can simulate out-of-space rejections itself, matching Exercise 12.5's restriction of decapsulation queries to C_kem (printed p. 513). There is no prechallenge decapsulation phase or additional challenge encapsulation.

These games still strengthen the exercise's printed KEM game (p. 513) in one way: its challenger sends only (k_b, c_kem), while here the distinguisher also receives pk (#5293). KEM security in these games is therefore a stronger premise than the printed exercise's (and as the KEMINDCPA counterexample shows, hybrid security needs pk given to the KEM distinguisher).

Security is expressed with the existing Game.Indistinguishable and IsOraclePPT predicates; these experiments introduce no new adversary or security structure. They specialize to the existing CPA games for adversaries that only sample closed programs.

Main definitions #

Main results #

References #

def Cslib.Crypto.Encryption.kemCCAContinuation (ctSpace : ℕ → List Bool → Bool) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : OracleDistinguisher) (n : ℕ) (sk pk k ct : List Bool) :

Interpret a KEM distinguisher using cca2Phase2Oracle restricted to ctSpace. The adversary receives the encoded public key, shown key and challenge ciphertext; sk remains internal to the challenger. Queries equal to ct or failing ctSpace n return [] (encOption encBits none) without calling decaps, matching Exercise 12.5's restriction of queries to C_kem \ {c_kem} when ctSpace is efficiently recognizable; Exercise 12.5's printed KEM challenger sends only the key and the encapsulation, without pk (#5293).

def Cslib.Crypto.Encryption.kemCCARealGame (ctSpace : ℕ → List Bool → Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : OracleDistinguisher) (n : ℕ) :

Real KEM experiment with adaptive postchallenge decapsulation queries restricted to ctSpace.

noncomputable def Cslib.Crypto.Encryption.kemCCAIdealGame (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : OracleDistinguisher) (n : ℕ) :

Ideal KEM experiment: replace only the shown key; the decapsulation oracle uses the same secret key, ctSpace guard, and challenge exclusion as the real experiment.

theorem Cslib.Crypto.Encryption.eval_kemCCARealGame_sample (ctSpace : ℕ → List Bool → Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : Distinguisher) (n : ℕ) :
(kemCCARealGame ctSpace keyGen encaps decaps (fun (n : ℕ) (input : List Bool) => ProbOracleComp.sample (distinguisher n input)) n).eval = (kemRealGame keyGen encaps distinguisher n).eval

A closed distinguisher ignores the decapsulation oracle, recovering the real CPA game.

theorem Cslib.Crypto.Encryption.eval_kemCCAIdealGame_sample (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (distinguisher : Distinguisher) (n : ℕ) :
(kemCCAIdealGame ctSpace keyLen keyGen encaps decaps (fun (n : ℕ) (input : List Bool) => ProbOracleComp.sample (distinguisher n input)) n).eval = (kemIdealGame keyLen keyGen encaps distinguisher n).eval

A closed distinguisher ignores the decapsulation oracle, recovering the ideal CPA game.