Documentation

CslibFrontier.Crypto.Computational.ElGamal.Malleability

Multiplicative ElGamal is not CCA secure #

The native multiplicative ElGamal scheme of CslibFrontier/Crypto/Computational/ElGamal/ProbComp.lean, (elGamalKeyGenProb d, elGamalEncryptProb encodeMsg d) with decryption elGamalDecryptDet d, is IND-CPA secure under DDH (DDH.indcpa_elGamalBitEncryptProb, DDH.indcpaOn_elGamalEncryptProb), but it is malleable and therefore not CCA secure. This module proves that unconditionally, by an explicit strict oracle-PPT adversary with 1CCA advantage exactly 1 at every security parameter.

Multiplicative ElGamal ([BS23], Exercise 11.5, p. 459) encrypts m as (v, e) = (β • g, β • u + m) (written additively) and decrypts (v, e) to e - α • v. The adversary elGamalMaulAdversary is the generic malleability adversary Encryption.maulAdversary of CslibFrontier/Crypto/Computational/Encryption/CCA/Malleability.lean, instantiated as follows. It submits two challenge messages encoding distinct group elements x₀ ≠ x₁, maps the challenge ciphertext (v, e) to (v, e + g) (elGamalMaulCiphertext), whose decryption differs because g ≠ 0, asks the Phase 2 decryption oracle for it, receives x_b + g, and outputs whether this is x₁ + g. The proofs supply only these malleability facts to the generic lemmas.

Mapping to the source #

Main definitions #

Main results #

References #

Multiplicative ElGamal decryption as the Option-valued decryptor of the CCA games (Encryption.cca2GameOn): it never rejects and returns elGamalDecryptDet d n sk ct, as the decryption algorithm of [BS23], Exercise 11.5 (p. 459) is defined on all of G².

The word-level malleability map of multiplicative ElGamal: send an encoded ciphertext encPair encBits encBits (v, e) to encPair encBits encBits (v, F.add (d, e, encode g)). On encoded group elements it maps (v, e) to (v, e + g), combining the ciphertext with the randomness-free encryption (0, g) of g by the homomorphism of [BS23], Exercise 11.5(c) (p. 459).

Malleability of multiplicative ElGamal: the mauled encryption of m decrypts to m + g under the matching secret key.

def Cslib.Crypto.PrimeOrderGroupFamily.elGamalMaulAdversary (F : PrimeOrderGroupFamily) {Msg : Type} (encodeMsg : F.Desc → Msg → List Bool) (d : ℕ → F.Desc) (msg₀ msg₁ : ℕ → Msg) :

The 1CCA malleability adversary against multiplicative ElGamal ([BS23], Exercise 12.1, p. 512): the generic Encryption.maulAdversary with messages (msg₀ n, msg₁ n), transformation elGamalMaulCiphertext (d n) and target the encoded decryption some (encodeMsg (d n) (msg₁ n) + g) that world 1 produces. Phase 2 queries the decryption oracle once, on the mauled challenge, and outputs whether the reply is that target.

elGamalMaulAdversary is strict oracle PPT whenever the group family, the message encoder and both message choices are computable in polynomial time.

theorem Cslib.Crypto.PrimeOrderGroupFamily.eval_cca2GameOn_elGamalMaulAdversary (F : PrimeOrderGroupFamily) {Msg : Type} {valid : ℕ → List Bool → Msg → Msg → Bool} {encodeMsg : F.Desc → Msg → List Bool} {d : ℕ → F.Desc} {msg₀ msg₁ : ℕ → Msg} {n : ℕ} (hvalid : ∀ (u : List Bool), valid n ((Turing.MultiTapeTM.encPair F.encDesc Turing.MultiTapeTM.encBits) (d n, u)) (msg₀ n) (msg₁ n) = true) {x₀ x₁ : F.Carrier (d n)} (hx₀ : encodeMsg (d n) (msg₀ n) = F.encode (d n) x₀) (hx₁ : encodeMsg (d n) (msg₁ n) = F.encode (d n) x₁) (hne : x₀ ≠ x₁) (bit : Bool) :

World bit of the 1CCA game against multiplicative ElGamal outputs bit ([BS23], Exercise 12.1, p. 512): if both challenge messages are admissible under every honest public key and encode distinct group elements, elGamalMaulAdversary outputs the challenge bit with probability 1.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_cca2GameOn_elGamalMaulAdversary (F : PrimeOrderGroupFamily) {Msg : Type} {valid : ℕ → List Bool → Msg → Msg → Bool} {encodeMsg : F.Desc → Msg → List Bool} {d : ℕ → F.Desc} {msg₀ msg₁ : ℕ → Msg} {n : ℕ} (hvalid : ∀ (u : List Bool), valid n ((Turing.MultiTapeTM.encPair F.encDesc Turing.MultiTapeTM.encBits) (d n, u)) (msg₀ n) (msg₁ n) = true) {x₀ x₁ : F.Carrier (d n)} (hx₀ : encodeMsg (d n) (msg₀ n) = F.encode (d n) x₀) (hx₁ : encodeMsg (d n) (msg₁ n) = F.encode (d n) x₁) (hne : x₀ ≠ x₁) :

elGamalMaulAdversary has 1CCA advantage 1 against multiplicative ElGamal ([BS23], Exercise 12.1, p. 512), under the hypotheses of eval_cca2GameOn_elGamalMaulAdversary.

theorem Cslib.Crypto.PrimeOrderGroupFamily.not_indcca2On_elGamalEncryptProb (F : PrimeOrderGroupFamily) {Msg : Type} {encMsg : Msg ↪ List Bool} {valid : ℕ → List Bool → Msg → Msg → Bool} {encodeMsg : F.Desc → Msg → List Bool} {d : ℕ → F.Desc} {msg₀ msg₁ : ℕ → Msg} (hencMsg : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : F.Desc × Msg) => encodeMsg p.1 p.2) (Turing.MultiTapeTM.encPair F.encDesc encMsg) Turing.MultiTapeTM.encBits) (hd : Turing.MultiTapeTM.ComputableInPolyTime d Turing.MultiTapeTM.encUnary F.encDesc) (hmsg₀ : Turing.MultiTapeTM.ComputableInPolyTime msg₀ Turing.MultiTapeTM.encUnary encMsg) (hmsg₁ : Turing.MultiTapeTM.ComputableInPolyTime msg₁ Turing.MultiTapeTM.encUnary encMsg) (hvalid : ∀ (n : ℕ) (u : List Bool), valid n ((Turing.MultiTapeTM.encPair F.encDesc Turing.MultiTapeTM.encBits) (d n, u)) (msg₀ n) (msg₁ n) = true) (hdistinct : ∀ (n : ℕ), ∃ (x₀ : F.Carrier (d n)) (x₁ : F.Carrier (d n)), encodeMsg (d n) (msg₀ n) = F.encode (d n) x₀ ∧ encodeMsg (d n) (msg₁ n) = F.encode (d n) x₁ ∧ x₀ ≠ x₁) :

Multiplicative ElGamal is not 1CCA secure, general form ([BS23], Exercise 12.1, p. 512): for a polynomial-time group family d and message encoder encodeMsg, if polynomial-time message choices msg₀ msg₁ are admissible under valid at every honest public key and encode distinct group elements at every parameter, then (elGamalKeyGenProb d, elGamalEncryptProb encodeMsg d, elGamalDecryptOpt d) fails Encryption.INDCCA2On valid encMsg encBits.

Bit ElGamal is not 1CCA secure ([BS23], Exercise 12.1, p. 512, for the bit messages 0 and g of encodeBit): for every prime-order group family F and polynomial-time group family d, the scheme (elGamalKeyGenProb d, elGamalEncryptProb encodeBit d), which is IND-CPA secure under DDH (DDH.indcpa_elGamalBitEncryptProb), with decryptor elGamalDecryptOpt d fails Encryption.INDCCA2Of encBool encBits. The adversary elGamalMaulAdversary with messages false and true has advantage 1 at every parameter.

Group-element ElGamal is not 1CCA secure ([BS23], Exercise 12.1, p. 512): for a polynomial-time group family d and any admissibility predicate valid that admits the encoded pair (0, g) under every honest public key (in particular any predicate admitting all pairs of group elements, the message space of Exercise 11.5), the scheme (elGamalKeyGenProb d, elGamalEncryptProb (fun _ m => m) d, elGamalDecryptOpt d) fails Encryption.INDCCA2On valid encBits encBits.

Group-element ElGamal is not CCA secure in the interleaved multi-challenge sense of [BS23], Attack Game 12.1 and Definition 12.1 (pp. 467–468), under the hypotheses of not_indcca2On_elGamalGroupEncryptProb.