Documentation

CslibFrontier.Crypto.Computational.ElGamal.StronglyUnpredictable

Strong ciphertext unpredictability of ElGamal encryption #

Over a PrimeOrderGroupFamily, both multiplicative ElGamal encryption (elGamalEncryptProb) and hybrid Hashed ElGamal encryption (Encryption.hybridEncrypt (F.hashedElGamalEncapsProb H d) encryptSym) have strongly unpredictable ciphertexts ([BS23], §21.4.1, p. 872) whenever the reciprocal group order (F.order (d n) : ℝ≥0)⁻¹ is negligible along the parameter schedule d.

Neither elGamalEncryptProb nor hashedElGamalEncapsProb checks whether pk is a well-formed group element: the ciphertext prefix β • g depends only on the fresh ephemeral exponent b, and the modular sampling error 1 / 2 ^ n from sampleExp gives the explicit single-invocation hit bound (F.order (d n) : ℝ≥0)⁻¹ + 1 / 2 ^ n. Whenever the deterministic group schedule fun n => PMF.pure (d n) satisfies F.DDH, DDH.negligible_expected_inv_order implies that (F.order (d n) : ℝ≥0)⁻¹ is negligible.

Main results #

References #

theorem Cslib.Crypto.PrimeOrderGroupFamily.eval_bind_sampleExp_apply_le (F : PrimeOrderGroupFamily) {α : Type} (n : ℕ) (d : F.Desc) (body : ℕ → ProbComp α) (x : α) (hdet : ∀ (b₁ b₂ : ℕ), (body b₁).eval x ≠ 0 → (body b₂).eval x ≠ 0 → ↑b₁ = ↑b₂) :
((do let b ← F.sampleExp n d body b).eval x).toNNReal ≤ (↑(F.order d))⁻¹ + 1 / 2 ^ n

Shared hit-bound lemma for any computation that binds b ← F.sampleExp n d and whose output x uniquely determines (b : ZMod (F.order d)).

theorem Cslib.Crypto.PrimeOrderGroupFamily.ciphertextHitBound_elGamalEncryptProb (F : PrimeOrderGroupFamily) {Msg : Type} (encodeMsg : F.Desc → Msg → List Bool) (d : ℕ → F.Desc) (n : ℕ) :
Encryption.CiphertextHitBound (fun (pk : List Bool) (m : Msg) => some <$> F.elGamalEncryptProb encodeMsg d n pk m) ((↑(F.order (d n)))⁻¹ + 1 / 2 ^ n)

At each security parameter n, multiplicative ElGamal encryption elGamalEncryptProb has ciphertext hit bound (F.order (d n) : ℝ≥0)⁻¹ + 1 / 2 ^ n, uniformly over all public keys and messages.

theorem Cslib.Crypto.PrimeOrderGroupFamily.stronglyUnpredictable_elGamalEncryptProb (F : PrimeOrderGroupFamily) {Msg : Type} (encodeMsg : F.Desc → Msg → List Bool) (d : ℕ → F.Desc) (hord : Negligible fun (n : ℕ) => (↑(F.order (d n)))⁻¹) :
Encryption.StronglyUnpredictable fun (n : ℕ) (pk : List Bool) (m : Msg) => some <$> F.elGamalEncryptProb encodeMsg d n pk m

Multiplicative ElGamal encryption elGamalEncryptProb has strongly unpredictable ciphertexts ([BS23], §21.4.1, p. 872) whenever (F.order (d n) : ℝ≥0)⁻¹ is negligible. In particular, hord follows from F.DDH (fun n => PMF.pure (d n)) via DDH.negligible_expected_inv_order.

theorem Cslib.Crypto.PrimeOrderGroupFamily.ciphertextHitBound_hybrid_hashedElGamal (F : PrimeOrderGroupFamily) {Msg : Type} (H : F.Desc × List Bool → List Bool) (encryptSym : ℕ → List Bool → Msg → ProbComp (List Bool)) (d : ℕ → F.Desc) (n : ℕ) :
Encryption.CiphertextHitBound (fun (pk : List Bool) (m : Msg) => some <$> Encryption.hybridEncrypt (F.hashedElGamalEncapsProb H d) encryptSym n pk m) ((↑(F.order (d n)))⁻¹ + 1 / 2 ^ n)

At each security parameter n, hybrid Hashed ElGamal encryption Encryption.hybridEncrypt (F.hashedElGamalEncapsProb H d) encryptSym has ciphertext hit bound (F.order (d n) : ℝ≥0)⁻¹ + 1 / 2 ^ n, uniformly over all public keys, messages, and symmetric encryption components encryptSym.

theorem Cslib.Crypto.PrimeOrderGroupFamily.stronglyUnpredictable_hybrid_hashedElGamal (F : PrimeOrderGroupFamily) {Msg : Type} (H : F.Desc × List Bool → List Bool) (encryptSym : ℕ → List Bool → Msg → ProbComp (List Bool)) (d : ℕ → F.Desc) (hord : Negligible fun (n : ℕ) => (↑(F.order (d n)))⁻¹) :

Hybrid Hashed ElGamal encryption has strongly unpredictable ciphertexts ([BS23], §21.4.1, p. 872) whenever (F.order (d n) : ℝ≥0)⁻¹ is negligible. In particular, hord follows from F.DDH (fun n => PMF.pure (d n)) via DDH.negligible_expected_inv_order.