Documentation

CslibFrontier.Crypto.Computational.Encryption.CCA.Malleability

Malleable encryption is not CCA secure #

A public-key scheme is malleable when anyone can transform a ciphertext into a different ciphertext whose plaintext is a known function of the original one. Such a scheme is not CCA secure: the adversary asks the Phase 2 decryption oracle to decrypt the transformed challenge, which the oracle must answer because it differs from the challenge, and reads off the hidden bit ([BS23], Section 12.2.1, pp. 469–470, which describes this adversary and notes that it has advantage 1).

maulAdversary msg₀ msg₁ maul target is that adversary for the single-challenge game Encryption.cca2GameOn. Phase 1 makes no query, chooses (msg₀ n pk, msg₁ n pk) and saves the public key. Phase 2 queries the decryption oracle once, on maul n pk ct, and outputs whether the reply is the word target n pk, reading only a reply prefix one bit longer than target n pk. A scheme instantiates it by supplying its transformation and the reply that world 1 produces.

Main definitions #

Main results #

References #

def Cslib.Crypto.Encryption.maulAdversary {Msg : Type} (msg₀ msg₁ : ℕ → List Bool → Msg) (maul : ℕ → List Bool → List Bool → List Bool) (target : ℕ → List Bool → List Bool) :

The one-query malleability adversary ([BS23], Section 12.2.1, pp. 469–470). Phase 1 makes no query, chooses (msg₀ n pk, msg₁ n pk) and saves the public key pk as its state. Phase 2 queries the decryption oracle once on maul n pk ct and outputs whether the reply is target n pk; it reads only a reply prefix one bit longer than target n pk.

theorem Cslib.Crypto.Encryption.isPPT_maulAdversary {Msg : Type} {encMsg : Msg ↪ List Bool} {msg₀ msg₁ : ℕ → List Bool → Msg} {maul : ℕ → List Bool → List Bool → List Bool} {target : ℕ → List Bool → List Bool} (hmsg₀ : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool) => match x with | (n, pk) => msg₀ n pk) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) encMsg) (hmsg₁ : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool) => match x with | (n, pk) => msg₁ n pk) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) encMsg) (hmaul : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool × List Bool) => match x with | (n, pk, ct) => maul n pk ct) encGuessInput Turing.MultiTapeTM.encBits) (htarget : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool) => match x with | (n, pk) => target n pk) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) :
CCA2AdversaryOf.IsPPT encMsg (maulAdversary msg₀ msg₁ maul target)

maulAdversary is strict oracle PPT whenever its message choices, transformation and target are computable in polynomial time.

theorem Cslib.Crypto.Encryption.eval_cca2GameOn_maulAdversary {Msg Out : Type} {valid : ℕ → List Bool → Msg → Msg → Bool} {encOut : Out ↪ List Bool} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encrypt : ℕ → List Bool → Msg → ProbComp (List Bool)} {decrypt : ℕ → List Bool → List Bool → Option Out} {msg₀ msg₁ : ℕ → List Bool → Msg} {maul : ℕ → List Bool → List Bool → List Bool} {target : ℕ → List Bool → List Bool} {n : ℕ} {bit : Bool} (hvalid : ∀ keys ∈ (keyGen n).eval.support, valid n keys.1 (msg₀ n keys.1) (msg₁ n keys.1) = true) (hmaul : ∀ keys ∈ (keyGen n).eval.support, ∀ ct ∈ (encrypt n keys.1 (if bit = true then msg₁ n keys.1 else msg₀ n keys.1)).eval.support, maul n keys.1 ct ≠ ct ∧ ((Turing.MultiTapeTM.encOption encOut) (decrypt n keys.2 (maul n keys.1 ct)) = target n keys.1 ↔ bit = true)) :
(cca2GameOn valid encOut keyGen encrypt decrypt (maulAdversary msg₀ msg₁ maul target) bit n).eval = PMF.pure bit

A malleable scheme loses the 1CCA game with certainty ([BS23], Section 12.2.1, pp. 469–470). Suppose the challenge pair of maulAdversary is admissible under every honest public key and that, for every honest key pair and every challenge ciphertext ct of world bit, the transformation maul changes ct and the decryption of maul n pk ct encodes to target exactly when bit = true. Then world bit outputs bit with probability 1.

theorem Cslib.Crypto.Encryption.advantage_cca2GameOn_maulAdversary {Msg Out : Type} {valid : ℕ → List Bool → Msg → Msg → Bool} {encOut : Out ↪ List Bool} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encrypt : ℕ → List Bool → Msg → ProbComp (List Bool)} {decrypt : ℕ → List Bool → List Bool → Option Out} {msg₀ msg₁ : ℕ → List Bool → Msg} {maul : ℕ → List Bool → List Bool → List Bool} {target : ℕ → List Bool → List Bool} {n : ℕ} (hvalid : ∀ keys ∈ (keyGen n).eval.support, valid n keys.1 (msg₀ n keys.1) (msg₁ n keys.1) = true) (hmaul : ∀ (bit : Bool), ∀ keys ∈ (keyGen n).eval.support, ∀ ct ∈ (encrypt n keys.1 (if bit = true then msg₁ n keys.1 else msg₀ n keys.1)).eval.support, maul n keys.1 ct ≠ ct ∧ ((Turing.MultiTapeTM.encOption encOut) (decrypt n keys.2 (maul n keys.1 ct)) = target n keys.1 ↔ bit = true)) :
Game.advantage (cca2GameOn valid encOut keyGen encrypt decrypt (maulAdversary msg₀ msg₁ maul target) false n).eval (cca2GameOn valid encOut keyGen encrypt decrypt (maulAdversary msg₀ msg₁ maul target) true n).eval = 1

Under the hypotheses of eval_cca2GameOn_maulAdversary for both worlds, maulAdversary has 1CCA advantage exactly 1.

theorem Cslib.Crypto.Encryption.not_indcca2On_of_maulAdversary {Msg Out : Type} {valid : ℕ → List Bool → Msg → Msg → Bool} {encMsg : Msg ↪ List Bool} {encOut : Out ↪ List Bool} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encrypt : ℕ → List Bool → Msg → ProbComp (List Bool)} {decrypt : ℕ → List Bool → List Bool → Option Out} {msg₀ msg₁ : ℕ → List Bool → Msg} {maul : ℕ → List Bool → List Bool → List Bool} {target : ℕ → List Bool → List Bool} (hmsg₀ : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool) => match x with | (n, pk) => msg₀ n pk) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) encMsg) (hmsg₁ : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool) => match x with | (n, pk) => msg₁ n pk) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) encMsg) (hmaulPoly : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool × List Bool) => match x with | (n, pk, ct) => maul n pk ct) encGuessInput Turing.MultiTapeTM.encBits) (htarget : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool) => match x with | (n, pk) => target n pk) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hvalid : ∀ (n : ℕ), ∀ keys ∈ (keyGen n).eval.support, valid n keys.1 (msg₀ n keys.1) (msg₁ n keys.1) = true) (hmaul : ∀ (n : ℕ) (bit : Bool), ∀ keys ∈ (keyGen n).eval.support, ∀ ct ∈ (encrypt n keys.1 (if bit = true then msg₁ n keys.1 else msg₀ n keys.1)).eval.support, maul n keys.1 ct ≠ ct ∧ ((Turing.MultiTapeTM.encOption encOut) (decrypt n keys.2 (maul n keys.1 ct)) = target n keys.1 ↔ bit = true)) :
¬INDCCA2On valid encMsg encOut keyGen encrypt decrypt

A malleable scheme is not 1CCA secure ([BS23], Section 12.2.1, pp. 469–470): if maulAdversary msg₀ msg₁ maul target has polynomial-time ingredients and satisfies the hypotheses of eval_cca2GameOn_maulAdversary in both worlds at every parameter, then the scheme fails INDCCA2On valid encMsg encOut.