General-Cipher Hashed ElGamal ([BS23], Section 11.5, Theorem 11.5) #
This module generalizes Hashed ElGamal ([BS23], Section 11.5, pp. 445–446, Remark 11.1,
and Section 11.5.2, Theorem 11.5, pp. 448–451) from the one-time pad specialization in
Complexity/Crypto/Computational/ElGamal.lean to an arbitrary semantically secure symmetric cipher
$\mathcal{E}_s$.
- Paraphrase of [BS23], Section 11.5 (p. 445) and Remark 11.1 (p. 446): over a cyclic group $G$ of prime order $q$ with generator $g$, a symmetric cipher $\mathcal{E}_s = (E_s, D_s)$ over $(\mathcal{K}, \mathcal{M}, \mathcal{C})$, and a key-derivation hash function $H$, key generation samples $\alpha \leftarrow \mathbb{Z}_q$ and outputs $(pk = \alpha \cdot g, sk = \alpha)$. In the $\mathcal{E}'_{\mathrm{EG}}$ variant of Remark 11.1 (which derives $k$ from $w = \beta \cdot u$ alone), encryption of $m \in \mathcal{M}$ under $pk = u$ samples $\beta \leftarrow \mathbb{Z}_q$, sets $v = \beta \cdot g$, $w = \beta \cdot u$, $k = H(w)$, $c \leftarrow E_s(k, m)$, and outputs $(v, c)$; decryption of $(v, c)$ under $sk = \alpha$ sets $w = \alpha \cdot v$, $k = H(w)$, and outputs $D_s(k, c)$.
- Paraphrase of [BS23], Section 11.5.2, Theorem 11.5 and Equation (11.14) (pp. 449–451): if DDH holds for $G$, $H$ is a secure KDF, and $\mathcal{E}_s$ is semantically secure, then Hashed ElGamal is semantically secure; for every CPA adversary $\mathcal{A}$ there exist elementary wrapper adversaries $\mathcal{B}_{\mathrm{ddh}}$, $\mathcal{B}_{\mathrm{kdf}}$, and $\mathcal{B}_s$ such that $\mathrm{SSadv}[\mathcal{A}, \mathcal{E}_{\mathrm{EG}}] \le 2 \cdot \mathrm{DDHadv}[\mathcal{B}_{\mathrm{ddh}}, G] + 2 \cdot \mathrm{KDFadv}[\mathcal{B}_{\mathrm{kdf}}, H] + \mathrm{SSadv}[\mathcal{B}_s, \mathcal{E}_s]$.
Main definitions #
Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherEncrypt,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherDecrypt,Cslib.Crypto.PrimeOrderGroupFamily.encodeHashedElGamalCipherEncrypt,Cslib.Crypto.PrimeOrderGroupFamily.decodeHashedElGamalCipher: algebraic and word-level Hashed ElGamal encryption and decryption with a general symmetric cipher ([BS23], Section 11.5, pp. 445–446, Remark 11.1).Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherCPAGameOn,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherCPAGame,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherIdealDDHGameOn,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherUniformKeyGameOn: PMF-level IND-CPA experiments and hybrids for general-cipher Hashed ElGamal ([BS23], Section 11.5.2, Theorem 11.5, pp. 449–451).Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherToDDHDistinguisher,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherToDDHHiddenBitDistinguisher,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherToKDFDistinguisher,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherToKDFHiddenBitDistinguisher,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherToDEMAdversary,Cslib.Crypto.PrimeOrderGroupFamily.seededSetupProb: per-bit and hidden-bit DDH and KDF reductions, symmetric-cipher (DEMOneTimeINDCPAOn) reduction adversary, and executable seeded setup sampler for Theorem 11.5 ([BS23], Section 11.5.2, pp. 449–451).
Main results #
Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalCipherDecrypt_hashedElGamalCipherEncrypt,Cslib.Crypto.PrimeOrderGroupFamily.decodeHashedElGamalCipher_hashedElGamalCipherEncrypt: decryption correctness for general-cipher Hashed ElGamal.Cslib.Crypto.PrimeOrderGroupFamily.advantage_hashedElGamalCipherCPAGameOn_le,Cslib.Crypto.PrimeOrderGroupFamily.advantage_hashedElGamalCipherCPAGameOn_le_two_mul,Cslib.Crypto.PrimeOrderGroupFamily.advantage_hashedElGamalCipherUniformKeyGameOn_le_demGameOn,Cslib.Crypto.PrimeOrderGroupFamily.advantage_hashedElGamalCipherCPAGameOn_le_demGameOn: two-distinguisher and single hidden-bit distinguisher quantitative bounds for Theorem 11.5 (matching Equation(11.14)of [BS23], p. 449), together with the native approximate-sampling (sampleExp, adding4 / 2 ^ n) bridge to standalone symmetric-cipher security (Encryption.demGameOn).Cslib.Crypto.PrimeOrderGroupFamily.DDH.negligible_hashedElGamalCipherCPAGameOnand itsDEMOneTimeINDCPAOn/linearHashKDFspecializations (negligible_hashedElGamalCipherCPAGameOn_of_demOneTimeINDCPAOn,negligible_hashedElGamalCipherCPAGameOn_linearHashKDF): Theorem 11.5 IND-CPA security inhashedElGamalCipherCPAGameOnfromDDH,SecureKDF, andDEMOneTimeINDCPAOn, plus unconditional KDF instantiation vialinearHashKDF.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 11.5 (pp. 445–446, Remark 11.1) and Section 11.5.2 (pp. 448–451, Attack Game 11.3, Definition 11.5, Theorem 11.5).
Algebraic Hashed ElGamal encryption with a general deterministic symmetric cipher encSym
([BS23], Section 11.5, pp. 445–446, Remark 11.1): given key-derivation hash function
H : F.Desc × List Bool → List Bool, public key u : F.Carrier d, message m : Msg, and
randomness β : ZMod (F.order d), derive k = H (d, encode (β • u)) and output
(β • g, encSym k m).
Instances For
Under a genuine public key u = α • g, hashedElGamalCipherEncrypt derives the symmetric key
H (d, encode ((α * β) • g)).
Algebraic Hashed ElGamal decryption with a general symmetric cipher decSym
([BS23], Section 11.5, pp. 445–446, Remark 11.1): given secret key α : ZMod (F.order d)
and ciphertext (v, c), derive k = H (d, encode (α • v)) and recover decSym k c.
Instances For
General-cipher Hashed ElGamal decryption correctness: whenever decSym k (encSym k m) = m
holds for the derived key k = H (d, encode ((α * β) • g)), decrypting an encryption under
u = α • g with secret key α recovers m.
hashedElGamalEncrypt is the one-time pad specialization of hashedElGamalCipherEncrypt.
hashedElGamalDecrypt is the one-time pad specialization of hashedElGamalCipherDecrypt.
Word-level Hashed ElGamal encryption with a general symmetric cipher encSym: given
(d, encode u, m, b), derive k = H (d, encode (b • u)) and compute
(encode (b • g), encSym (k, m)).
Instances For
encodeHashedElGamalCipherEncrypt evaluates hashedElGamalCipherEncrypt on encoded group
elements.
Word-level general-cipher Hashed ElGamal encryption is computable in polynomial time whenever
H and encSym are.
Word-level Hashed ElGamal decryption with a general symmetric cipher decSym: given
(d, a, encode v, c), derive k = H (d, encode (a • v)) and compute decSym (k, c).
Instances For
decodeHashedElGamalCipher computes hashedElGamalCipherDecrypt on encoded group elements.
Word-level general-cipher Hashed ElGamal decryption of an honest encryption recovers m
whenever decSym inverts encSym on the derived key.
Word-level general-cipher Hashed ElGamal decryption is computable in polynomial time whenever
H and decSym are.
PMF-level general-cipher Hashed ElGamal IND-CPA games and Theorem 11.5 reductions #
The IND-CPA experiment for general-cipher Hashed ElGamal (Game 0, [BS23],
Section 11.5, pp. 445–446, Remark 11.1, and Section 11.5.2, Theorem 11.5, Figure 11.4,
pp. 449–450) with challenge-pair admissibility predicate valid: draw d ← setup n and a uniform
secret key α : ZMod (F.order d), and pass pk = (d, encode (α • g)) to adversary.choose. If
valid n pk m₀ m₁ holds, encrypt the selected message m under a fresh uniform exponent
β : ZMod (F.order d) and derived symmetric key k = H (d, encode ((α * β) • g)) via
c ← encryptSym n k m, and pass (encode (β • g), c) to adversary.guess; otherwise output
false, in both experiments.
Instances For
Unrestricted general-cipher Hashed ElGamal IND-CPA experiment: hashedElGamalCipherCPAGameOn
with every challenge pair admissible.
Instances For
hashedElGamalCPAGame is the specialization of hashedElGamalCipherCPAGame to one-time pad
XOR encryption.
Game 1 for general-cipher Hashed ElGamal ([BS23], Section 11.5.2, proof of
Theorem 11.5, p. 450): replace the Diffie–Hellman shared element (α * β) • g with an independent
uniform group element γ • g.
Instances For
Unrestricted Game 1 for general-cipher Hashed ElGamal.
Instances For
Game 2 for general-cipher Hashed ElGamal ([BS23], Section 11.5.2, proof of
Theorem 11.5, p. 450): replace the derived key H (d, encode (γ • g)) with an independent uniform
keyLen n-bit key k ← Cslib.BitString.uniformList (keyLen n).
Instances For
Unrestricted Game 2 for general-cipher Hashed ElGamal.
Instances For
Running the unrestricted hashedElGamalCipherCPAGame on adversary.restrict valid has the same
output distribution as running hashedElGamalCipherCPAGameOn valid on adversary.
Running the unrestricted hashedElGamalCipherIdealDDHGame on adversary.restrict valid has the
same output distribution as running hashedElGamalCipherIdealDDHGameOn valid on adversary.
Running the unrestricted hashedElGamalCipherUniformKeyGame on adversary.restrict valid has
the same output distribution as running hashedElGamalCipherUniformKeyGameOn valid on
adversary.
Per-bit DDH distinguisher constructed from a general-cipher Hashed ElGamal IND-CPA adversary
([BS23], Section 11.5.2, proof of Theorem 11.5, p. 450): given (d, u, v, w), pass
pk = (d, u) to adversary.choose, encrypt the selected message m under k = H (d, w) via
c ← encryptSym n k m, and return adversary.guess on (v, c).
Instances For
In the real DDH game, hashedElGamalCipherToDDHDistinguisher simulates
hashedElGamalCipherCPAGame exactly.
In the ideal DDH game, hashedElGamalCipherToDDHDistinguisher simulates
hashedElGamalCipherIdealDDHGame exactly.
hashedElGamalCipherToDDHDistinguisher is uniform strict PPT whenever H is polynomial time
and encryptSym and adversary are uniform strict PPT.
Single hidden-bit DDH distinguisher $\mathcal{B}_{\mathrm{ddh}}$ ([BS23],
Section 11.5.2, proof of Theorem 11.5, Figure 11.4 and Equation (11.17), p. 450): sample a uniform
challenge bit bit ← ProbComp.uniform Bool, run hashedElGamalCipherToDDHDistinguisher on bit,
and output guess ^^ bit.
Instances For
hashedElGamalCipherToDDHHiddenBitDistinguisher is uniform strict PPT whenever H is
polynomial time and encryptSym and adversary are uniform strict PPT.
Per-bit KDF distinguisher constructed from a general-cipher Hashed ElGamal IND-CPA adversary
([BS23], Section 11.5.2, proof of Theorem 11.5, pp. 450–451): given (d, u, v, k), pass
pk = (d, u) to adversary.choose, encrypt the selected message m under k via
c ← encryptSym n k m, and return adversary.guess on (v, c).
Instances For
In the real KDF game, hashedElGamalCipherToKDFDistinguisher simulates
hashedElGamalCipherIdealDDHGame exactly.
In the ideal KDF game, hashedElGamalCipherToKDFDistinguisher simulates
hashedElGamalCipherUniformKeyGame exactly.
hashedElGamalCipherToKDFDistinguisher is uniform strict PPT whenever encryptSym and
adversary are.
Single hidden-bit KDF distinguisher $\mathcal{B}_{\mathrm{kdf}}$ ([BS23],
Section 11.5.2, proof of Theorem 11.5, Equation (11.18), pp. 450–451): sample a uniform challenge
bit bit ← ProbComp.uniform Bool, run hashedElGamalCipherToKDFDistinguisher on bit, and output
guess ^^ bit.
Instances For
hashedElGamalCipherToKDFHiddenBitDistinguisher is uniform strict PPT whenever encryptSym and
adversary are.
Quantitative reduction of general-cipher Hashed ElGamal IND-CPA to DDH, SecureKDF, and
Game 2 via two per-bit distinguishers ([BS23], Section 11.5.2, Theorem 11.5,
pp. 449–451): the IND-CPA advantage in hashedElGamalCipherCPAGameOn valid is bounded by the sum of
the two per-bit DDH advantages, the two per-bit KDF advantages, and the Game 2 advantage in
hashedElGamalCipherUniformKeyGameOn valid.
Quantitative reduction of general-cipher Hashed ElGamal IND-CPA to DDH, SecureKDF, and
Game 2 via single hidden-bit distinguishers ([BS23], Section 11.5.2, Theorem 11.5,
Equation (11.14), p. 449):
$$\mathsf{SSadv}[\mathcal{A}, \mathcal{E}_{\mathrm{EG}}] \le 2 \cdot \mathsf{DDHadv}[\mathcal{B}_{\mathrm{ddh}}, \mathbb{G}] + 2 \cdot \mathsf{KDFadv}[\mathcal{B}_{\mathrm{kdf}}, H] + \mathsf{Adv}_{\mathrm{Game\,2}}[\mathcal{A}].$$
General-cipher Hashed ElGamal IND-CPA security from DDH, SecureKDF, and Game 2
indistinguishability ([BS23], Section 11.5.2, Theorem 11.5, pp. 449–451): whenever H
and valid are polynomial-time computable, encryptSym is uniform strict PPT, and every uniform
strict PPT adversary has negligible advantage in Game 2 (hashedElGamalCipherUniformKeyGameOn),
every uniform strict PPT adversary has negligible advantage in
hashedElGamalCipherCPAGameOn valid.
Reduction from Game 2 (hashedElGamalCipherUniformKeyGameOn) to DEMOneTimeINDCPAOn #
One-time symmetric-cipher reduction adversary $\mathcal{B}_s$ for general-cipher Hashed ElGamal
([BS23], Section 11.5.2, proof of Theorem 11.5, p. 451): given an efficiently samplable
group-description generator setupProb : ℕ → ProbComp F.Desc and a PKE adversary adversary,
choose n _ samples d ← setupProb n and a, b ← F.sampleExp n d, sets
u = encode (a • g) and v = encode (b • g), runs choice ← adversary.choose n (d, u), and saves
(v, choice.2); guess n state ctSym unpacks (v, st) and runs
adversary.guess n st (v, ctSym).
Instances For
hashedElGamalCipherToDEMAdversary setupProb adversary is an admissible uniform strict PPT
Encryption.AdversaryOf Msg whenever setupProb and adversary are.
For each bit bit : Bool, the Game 2 distribution hashedElGamalCipherUniformKeyGameOn over
fun m => ProbComp.eval (setupProb m) with keyLen n = n is within 2 / 2 ^ n in
Game.advantage of the standalone one-time symmetric experiment Encryption.demGameOn on
hashedElGamalCipherToDEMAdversary setupProb (adversary.restrict valid) (two approximate exponent
draws via sampleExp, each within 1 / 2 ^ n of uniform).
Quantitative bridge from Game 2 (hashedElGamalCipherUniformKeyGameOn) to standalone
symmetric-cipher security (Encryption.demGameOn): the Game 2 advantage is bounded by the
Encryption.demGameOn advantage of
hashedElGamalCipherToDEMAdversary setupProb (adversary.restrict valid) plus 4 / 2 ^ n.
Native approximate-sampling version of Equation (11.14) for Theorem 11.5 via DDH,
SecureKDF, and standalone symmetric-cipher security (Encryption.demGameOn) ([BS23],
Section 11.5.2, Theorem 11.5, Equation (11.14), p. 449): combining the exact PMF-level Equation
(11.14) bound advantage_hashedElGamalCipherCPAGameOn_le_two_mul with the sampleExp
Game 2 bridge advantage_hashedElGamalCipherUniformKeyGameOn_le_demGameOn adds 4 / 2 ^ n for the
two approximate exponent draws per branch:
$$\mathsf{SSadv}[\mathcal{A}, \mathcal{E}_{\mathrm{EG}}] \le 2 \cdot \mathsf{DDHadv}[\mathcal{B}_{\mathrm{ddh}}, \mathbb{G}] + 2 \cdot \mathsf{KDFadv}[\mathcal{B}_{\mathrm{kdf}}, H] + \mathsf{SSadv}[\mathcal{B}_s, \mathcal{E}_s] + \frac{4}{2^n}.$$
One-time symmetric IND-CPA security (Encryption.DEMOneTimeINDCPAOn) implies negligibility of
the Game 2 advantage (hashedElGamalCipherUniformKeyGameOn) whenever the setup law is efficiently
samplable (setupProb : ℕ → ProbComp F.Desc), keyLen n = n, and valid implies validSym.
Boneh–Shoup Theorem 11.5 from DDH, SecureKDF, and Encryption.DEMOneTimeINDCPAOn
([BS23], Section 11.5.2, Theorem 11.5, pp. 449–451): for any efficiently samplable setup
setupProb : ℕ → ProbComp F.Desc (setup n = ProbComp.eval (setupProb n)), keyLen n = n, and
admissibility predicate valid implying validSym, if F.DDH, F.SecureKDF, and
Encryption.DEMOneTimeINDCPAOn validSym encMsg encryptSym hold, then every uniform strict PPT
adversary has negligible advantage in hashedElGamalCipherCPAGameOn valid.
Executable ProbComp sampler for F.seededSetup: sample d ← setupProb n, then conditional on
d, sample a uniform seed s ← Cslib.BitString.sampleList (seedLen n d) and output (d, s).
Instances For
ProbComp.eval (F.seededSetupProb setupProb seedLen n) equals
F.seededSetup (fun m => ProbComp.eval (setupProb m)) seedLen n.
F.seededSetupProb setupProb seedLen is uniform strict PPT whenever setupProb is uniform
strict PPT and seedLen is computable in polynomial time in unary.
General-cipher Hashed ElGamal IND-CPA security with linearHashKDF from DDH and
Encryption.DEMOneTimeINDCPAOn alone ([BS23], Section 8.10.4, Theorem 8.11, p. 334, and
Section 11.5.2, Theorem 11.5, pp. 449–451): combining DDH.withSeed, secureKDF_linearHashKDF,
isPPTOn_seededSetupProb, and DDH.negligible_hashedElGamalCipherCPAGameOn_of_demOneTimeINDCPAOn
yields IND-CPA security of general-cipher Hashed ElGamal instantiated with linearHashKDF under
F.DDH and Encryption.DEMOneTimeINDCPAOn alone, with no separate KDF assumption.