Strict-PPT ElGamal Key Generation, KEM Encapsulation, and Encryption.INDCPAOn Bridges #
This module defines uniform strict-PPT (IsPPTOn) key generation, encapsulation, decapsulation,
and encryption for multiplicative ElGamal and Hashed ElGamal ([BS23], Section 11.5,
pp. 445–446, Remark 11.1, Section 11.5.2, Theorem 11.5, pp. 449–451, Exercise 11.5(a), p. 459, and
Exercise 11.9, pp. 460–461) using ProbComp.sampleModNat, and connects the PMF-level ElGamal games
in Complexity/Crypto/Computational/ElGamal.lean directly to Encryption.KEMINDCPA,
Encryption.INDCPAOf, Encryption.INDCPAOn, and Encryption.INDCPA.
- Paraphrase of [BS23], Section 11.5 (p. 445) and Remark 11.1 (p. 446): 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, encapsulation/encryption samples $\beta \leftarrow \mathbb{Z}_q$, sets $v = \beta \cdot g$ and $w = \beta \cdot u$, derives the symmetric key $k = H(w)$, and encrypts $m$ under $k$; decapsulation/decryption computes $w = \alpha \cdot v$, recovers $k = H(w)$, and decrypts $c$ under $k$.
- Paraphrase of [BS23], Exercise 11.5(a) (p. 459) and Exercise 11.9 (pp. 460–461):
multiplicative ElGamal encrypts a group element $m \in G$ as $(\beta \cdot g, \beta \cdot u + m)$
and is IND-CPA secure under DDH; Hashed ElGamal acts as an IND-CPA secure KEM under DDH and
SecureKDF, and composing it with any one-time semantically secure DEM yields an IND-CPA secure public-key encryption scheme.
Main definitions #
Cslib.Crypto.PrimeOrderGroupFamily.elGamalKeyGenProb: uniform strict-PPT ElGamal key generation.Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalEncapsProb,Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalDecaps: uniform strict-PPT Hashed ElGamal KEM encapsulation and deterministic polynomial-time decapsulation.Cslib.Crypto.PrimeOrderGroupFamily.kemToDDHDistinguisher,Cslib.Crypto.PrimeOrderGroupFamily.kemToKDFDistinguisher: DDH and KDF reductions from a KEM distinguisher.Cslib.Crypto.PrimeOrderGroupFamily.elGamalEncryptProb,Cslib.Crypto.PrimeOrderGroupFamily.elGamalDecryptDet: uniform strict-PPT multiplicative ElGamal encryption and deterministic polynomial-time decryption.
Main results #
Cslib.Crypto.PrimeOrderGroupFamily.hashedElGamalDecaps_hashedElGamalEncapsProb,Cslib.Crypto.PrimeOrderGroupFamily.elGamalDecryptDet_elGamalEncryptProb: support-level decapsulation and decryption correctness.Cslib.Crypto.PrimeOrderGroupFamily.advantage_kemGame_hashedElGamalEncapsProb_le,Cslib.Crypto.PrimeOrderGroupFamily.DDH.kemINDCPA_hashedElGamalEncapsProb: quantitative KEM advantage bound andEncryption.KEMINDCPAsecurity of Hashed ElGamal underDDHandSecureKDF.Cslib.Crypto.PrimeOrderGroupFamily.DDH.indcpaOf_hybrid_hashedElGamal,Cslib.Crypto.PrimeOrderGroupFamily.DDH.indcpaOn_hybrid_hashedElGamal,Cslib.Crypto.PrimeOrderGroupFamily.DDH.wordINDCPA_hybrid_hashedElGamal: Theorem 11.5 viaEncryption.INDCPAOf,Encryption.INDCPAOn, andEncryption.WordINDCPAfor any one-time semantically secure symmetric cipher (Encryption.DEMOneTimeINDCPAOf/Encryption.DEMOneTimeINDCPAOn/Encryption.DEMOneTimeWordINDCPA).Cslib.Crypto.PrimeOrderGroupFamily.DDH.indcpaOn_elGamalEncryptProb,Cslib.Crypto.PrimeOrderGroupFamily.DDH.indcpa_elGamalBitEncryptProb: multiplicative and bit ElGamal satisfyEncryption.INDCPAOnandEncryption.INDCPAunderDDH.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 11.5 (pp. 445–446, Remark 11.1), Section 11.5.2 (pp. 448–451, Theorem 11.5), Exercise 11.5(a) (p. 459), and Exercise 11.9 (pp. 460–461).
Probabilistic polynomial-time ElGamal key generation for a group description family
d : ℕ → F.Desc ([BS23], Section 11.5, p. 445, and Exercise 11.5, p. 459): sample
a ← sampleExp n (d n) and output
(encPair F.encDesc encBits (d n, encode (a • g)), encNat a).
Instances For
elGamalKeyGenProb is uniformly strict PPT whenever d is computable in polynomial time.
Probabilistic polynomial-time Hashed ElGamal KEM encapsulation for a group description family
d : ℕ → F.Desc ([BS23], Section 11.5, p. 445, Remark 11.1, p. 446, and Exercise 11.9,
pp. 460–461): sample b ← sampleExp n (d n), unpack u = dropFrame pk, and output
(H (d n, encode (b • u)), encode (b • g)).
Instances For
hashedElGamalEncapsProb is uniformly strict PPT whenever H and d are computable in
polynomial time.
Deterministic polynomial-time Hashed ElGamal KEM decapsulation ([BS23], Section 11.5,
p. 445, Remark 11.1, p. 446): given secret key sk = encNat a and KEM ciphertext
ctKem = encode (b • g), recover H (d n, encode (a • v)).
Instances For
hashedElGamalDecaps is computable in polynomial time whenever H and d are.
Hashed ElGamal KEM decapsulation correctness: for any n : ℕ, any (pk, sk) in the
support of elGamalKeyGenProb d n, and any (k, ctKem) in the support of
hashedElGamalEncapsProb H d n pk, hashedElGamalDecaps H d n sk ctKem = k.
DDH distinguisher constructed from a KEMAdversary (Distinguisher) for
(elGamalKeyGenProb d, hashedElGamalEncapsProb H d).
Instances For
KDF distinguisher constructed from a KEMAdversary (Distinguisher) for
(elGamalKeyGenProb d, hashedElGamalEncapsProb H d).
Instances For
ddhIdealGame for kemToDDHDistinguisher is identical to kdfRealGame for
kemToKDFDistinguisher.
kemToDDHDistinguisher is uniform strict PPT whenever H is polynomial time and
distinguisher is uniform strict PPT.
kemToKDFDistinguisher is uniform strict PPT whenever distinguisher is.
Quantitative KEM IND-CPA bound for Hashed ElGamal: the KEM distinguishing advantage of
distinguisher against (elGamalKeyGenProb d, hashedElGamalEncapsProb H d) is bounded by the DDH
advantage of kemToDDHDistinguisher H distinguisher plus the KDF advantage of
kemToKDFDistinguisher distinguisher plus 4 / 2 ^ n.
Hashed ElGamal KEM is Encryption.KEMINDCPA-secure under DDH and SecureKDF
([BS23], Section 11.5.2, Theorem 11.5, pp. 449–451, and Exercise 11.9, pp. 460–461): for
any group description family d : ℕ → F.Desc, if F.DDH (fun n => PMF.pure (d n)) and
F.SecureKDF (fun n => PMF.pure (d n)) H (fun n => n) hold and H is computable in polynomial
time, then (elGamalKeyGenProb d, hashedElGamalEncapsProb H d) satisfies Encryption.KEMINDCPA.
Theorem 11.5 via Encryption.INDCPAOf ([BS23], Section 11.5.2, Theorem 11.5,
pp. 449–451): combining DDH.kemINDCPA_hashedElGamalEncapsProb with KEMINDCPA.hybrid_indcpa,
Hashed ElGamal coupled with any uniform strict-PPT one-time semantically secure symmetric cipher
encryptSym (DEMOneTimeINDCPAOf encMsg encryptSym) satisfies Encryption.INDCPAOf.
Theorem 11.5 via Encryption.INDCPAOn ([BS23], Section 11.5.2, Theorem 11.5,
pp. 449–451): combining DDH.kemINDCPA_hashedElGamalEncapsProb with KEMINDCPA.hybrid_indcpaOn,
for any polynomial-time admissibility predicate valid that ignores the public key (such as
the equal-length predicate fun _ _ m₀ m₁ => m₀.length == m₁.length), Hashed ElGamal coupled with
any one-time semantically secure symmetric cipher encryptSym
(DEMOneTimeINDCPAOn valid encMsg encryptSym) satisfies Encryption.INDCPAOn.
Theorem 11.5 via Encryption.WordINDCPA ([BS23], Section 11.5.2, Theorem 11.5,
pp. 449–451): combining DDH.indcpaOn_hybrid_hashedElGamal with Attack Game 11.1's equal-length
rule (fun _ _ m₀ m₁ => m₀.length == m₁.length), Hashed ElGamal coupled with any equal-length
one-time semantically secure word cipher encryptSym (DEMOneTimeWordINDCPA encryptSym) satisfies
Encryption.WordINDCPA.
Probabilistic polynomial-time multiplicative ElGamal encryption for a group description family
d : ℕ → F.Desc and message encoder encodeMsg : F.Desc → Msg → List Bool
([BS23], Exercise 11.5, p. 459): sample b ← sampleExp n (d n), unpack
u = dropFrame pk, and output
encPair encBits encBits (encodeElGamalEncrypt (d n, u, encodeMsg (d n) m, b)).
Instances For
elGamalEncryptProb is uniformly strict PPT whenever encodeMsg and d are computable in
polynomial time.
Deterministic polynomial-time multiplicative ElGamal decryption on words: given secret key
sk = encNat a and ciphertext ct = encPair encBits encBits (v, e), compute
decodeElGamal (d n, ofBits sk, unframe ct, dropFrame ct).
Instances For
elGamalDecryptDet is computable in polynomial time whenever d is.
Multiplicative ElGamal decryption correctness on ProbComp outputs: for any (pk, sk) in
the support of elGamalKeyGenProb d n, any m : F.Carrier (d n), and any ct in the support of
elGamalEncryptProb (fun d x => x) d n pk (F.encode (d n) m),
elGamalDecryptDet d n sk ct = F.encode (d n) m.
The native Encryption.gameOn experiment for
(elGamalKeyGenProb d, elGamalEncryptProb encodeMsg d) is within statistical distance 2 / 2 ^ n
of the ideal exact-uniform PMF game
elGamalMsgCPAGameOn valid encodeMsg (fun n => PMF.pure (d n)).
Multiplicative ElGamal satisfies Encryption.INDCPAOn under DDH ([BS23],
Exercise 11.5(a), p. 459): for any polynomial-time group description family d : ℕ → F.Desc,
polynomial-time message encoder encodeMsg, and polynomial-time admissibility predicate valid
admitting only group elements (AdmitsGroupElements encodeMsg valid),
(elGamalKeyGenProb d, elGamalEncryptProb encodeMsg d) satisfies Encryption.INDCPAOn valid encMsg
whenever F.DDH (fun n => PMF.pure (d n)) holds.
Bit ElGamal satisfies Encryption.INDCPA under DDH ([BS23], Exercise 11.5(a),
p. 459): specialization of DDH.indcpaOn_elGamalEncryptProb to encodeBit.