Repeating Ciphertexts under Chosen-Plaintext Attack #
This module formalizes Exercise 5.12 of
Boneh and Shoup, A Graduate Course in Applied Cryptography, Version 0.6
(Chapter 5, printed p. 211; Example 5.1's deterministic-cipher refutation
not_indcpa_of_deterministic lives in
CslibFrontier/Crypto/Computational/Encryption/Authenticated.lean):
- CPA security prevents ciphertext collisions (
repeatCiphertextGame,repeatToCPAAdversary,succProbability_repeatCiphertextGame_le_two_mul_advantage,INDCPA.negligible_repeatCiphertextGame): inrepeatCiphertextGame, an adaptive oracle adversary queriesE's encryption oracle (E.ciEncryptionOracle n k) on chosenn-bit messages and wins if any two returned ciphertexts are equal (!decide out.2.Nodup). An elementary CPA wrapperrepeatToCPAAdversaryforwards eachn-bit querymas(m, r)for a freshly sampled uniformr ← BitString.sampleList n, records(c, r)pairs, and outputstrueiff two recorded entries have equal ciphertexts and distinct random right-hand messages (p.1 == q.1 && p.2 != q.2). In Experimenttrue(b = 1), decryption completeness forcesp.1 = q.1 → p.2 = q.2, so the wrapper outputstruewith probability0; in Experimentfalse(b = 0) forn ≥ 1(|M| = 2^n ≥ 2), every ciphertext collision inrepeatCiphertextGamereceives distinct independentrvalues with probability1 - 2^{-n} ≥ 1/2. ThusRepeatAdv[A, E] ≤ 2 · CPAadv[B, E], andE.INDCPAimplies negligible winning probability inrepeatCiphertextGamefor everyIsOraclePPTadversary.
Model and scope notes relative to Boneh–Shoup #
n-bit message space and threshold1 ≤ n. InSymmetricCipher, the message space at security parameternis{0, 1}^nof size2^n, sampled uniformly in polynomial time viaBitString.sampleList n. Exercise 5.12's hypotheses ("Assume that there are at least two messages inM, that all messages have the same length, and that we can efficiently generate messages inMuniformly at random", printed p. 211) correspond quantitatively to1 ≤ n, which disappears in the asymptoticNegligibleconclusion.- Polymorphic adversary return type in
repeatCiphertextGame. Because winningrepeatCiphertextGamedepends only on the oracle's ciphertext log and ignores the adversary's final output value,repeatCiphertextGame,repeatToCPAAdversary, andINDCPA.negligible_repeatCiphertextGameare polymorphic in{α : Type}(IsOraclePPT encOut A), so callers withOracleDistinguisher(α = Bool),CIAdversary(α = List Bool), orUnitadversaries apply them directly without wrapping return values.
Main definitions #
Cslib.Crypto.SymmetricCipher.repeatCiphertextGame: adaptive repeated-ciphertext attack game ([BS23], Exercise 5.12, printed p. 211).Cslib.Crypto.SymmetricCipher.repeatToCPAAdversary: elementary CPA wrapper around a repeated-ciphertext adversary ([BS23], Exercise 5.12, printed p. 211).
Main results #
Cslib.Crypto.SymmetricCipher.isOraclePPT_repeatToCPAAdversary: strict uniform oracle-PPT certificate forrepeatToCPAAdversary.Cslib.Crypto.SymmetricCipher.succProbability_repeatCiphertextGame_le_two_mul_advantage,Cslib.Crypto.SymmetricCipher.INDCPA.negligible_repeatCiphertextGame: quantitative reductionRepeatAdv[A, E] ≤ 2 · CPAadv[B, E]and asymptotic repeated-ciphertext security fromINDCPA([BS23], Exercise 5.12, printed p. 211).
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 5.3, Example 5.1 (p. 182) and Section 5.8, Exercise 5.12 (p. 211).
The repeated-ciphertext attack experiment ([BS23], Exercise 5.12, printed p. 211):
sample k ← E.keyGen n, run A n [] against E.ciEncryptionOracle n k starting from [] (which
encrypts each n-bit query under k, logs the returned ciphertexts, and answers malformed queries
with [] without logging), and output true iff two logged ciphertexts are equal
(!decide out.2.Nodup).
Elementary CPA wrapper around a repeated-ciphertext adversary A ([BS23],
Exercise 5.12, printed p. 211): run A n [] against repeatWrapperStep n (ctBound n) starting from
[], and output true iff two recorded (ciphertext, randomMsg) pairs share the same truncated
ciphertext while having distinct right-hand random messages.
repeatToCPAAdversary ctBound A is uniformly strict oracle-PPT whenever ctBound is
computable in unary polynomial time and A is uniformly strict oracle-PPT.
Quantitative repeated-ciphertext reduction ([BS23], Exercise 5.12, printed
p. 211): for every 1 ≤ n (|M| = 2^n ≥ 2) where ctBound n bounds ciphertext lengths on n-bit
messages, RepeatAdv[A, E](n) ≤ 2 · CPAadv[repeatToCPAAdversary ctBound A, E](n).
CPA-secure symmetric ciphers have negligible ciphertext-collision probability
([BS23], Exercise 5.12, printed p. 211): if E satisfies INDCPA, then every uniform
strict IsOraclePPT adversary wins repeatCiphertextGame with negligible probability.