Authenticated Encryption and Adaptive Chosen-Ciphertext Security #
This module formalizes symmetric authenticated encryption (AuthenticatedEncryption) and adaptive
chosen-ciphertext security (INDCCA) following
Boneh and Shoup, A Graduate Course in Applied Cryptography, Version 0.6,
Chapter 5 (Sections 5.3 and 5.10) and Chapter 9 (Sections 9.1 and 9.2.2–9.2.3):
- Symmetric ciphers and adaptive/one-time CPA security (
SymmetricCipher,cpaGame,INDCPA,cpaOneTimeGame,OneTimeINDCPA,not_indcpa_of_deterministic,not_indcpa_of_ciphertext_length_eq) ([BS23], Section 2.2, Attack Game 2.1 and Definition 2.2; Section 5.3, Attack Game 5.2, Definition 5.2, and Example 5.1, printed pp. 181–182; Exercise 5.10(a), printed p. 211): a uniform symmetric cipher onn-bit messages at security parameternconsists of strict PPT key generationkeyGen, strict PPT encryptionencrypt, and deterministic polynomial-time decryptiondecryptreturningOption (List Bool)(encoded viaencOption encBits). IncpaGame, an adaptiveOracleDistinguishersubmits left-or-right pairs(m0, m1)ofn-bit messages and receivesencrypt n k (if bit then m1 else m0);cpaOneTimeGameandOneTimeINDCPArestrict the oracle to at most one valid encryption query. We also formalize Example 5.1 (not_indcpa_of_deterministic) for any cipher deterministic on0^nwith arbitrary polynomial ciphertext expansion via the 2-query distinguisherdetCPAAdversary ctBound, and deduce Exercise 5.10(a) (not_indcpa_of_ciphertext_length_eq) as its zero-expansion corollary. - Ciphertext integrity and authenticated encryption (
ciGame,CiphertextIntegrity,AuthenticatedEncryption,ciOneTimeGame,OneTimeCiphertextIntegrity,OneTimeAuthenticatedEncryption) ([BS23], Section 9.1, Attack Game 9.1 and Definitions 9.1–9.4, printed pp. 358–360): inciGame(and its single-query counterpartciOneTimeGame), an adaptiveCIAdversaryqueries an encryption oracle onn-bit messages (logging returned ciphertexts inqueriedCiphertexts) and wins by outputting a candidate ciphertextctsuch that!queriedCiphertexts.contains ctand(decrypt n k ct).isSome. A cipher providesAuthenticatedEncryptionwhen it satisfies bothINDCPAandCiphertextIntegrity, andOneTimeAuthenticatedEncryption(1AE) when it satisfies bothOneTimeINDCPAandOneTimeCiphertextIntegrity. - Adaptive chosen-ciphertext security, AE $\Rightarrow$ CCA, 1AE $\Rightarrow$ 1CCA, and
encryption-query preservation (
ccaGame,INDCCA,ccaOneTimeGame,OneTimeINDCCA,ccaToCPAAdversary,ccaToCIAdversary,ccaToCIHiddenBitAdversary,IsEncryptionQueryBounded,IsDecryptionQueryBounded,isQueryBounded_ccaToCPAAdversary_of_isEncryptionQueryBounded,isQueryBounded_ccaToCIAdversary_of_isEncryptionQueryBounded,advantage_ccaGame_le,advantage_ccaGame_le_two_mul,guessingAdvantage_guessBit_ccaGame_le,guessingAdvantage_guessBit_ccaGame_le_two_mul,AuthenticatedEncryption.indcca,advantage_ccaOneTimeGame_le,advantage_ccaOneTimeGame_le_two_mul,guessingAdvantage_guessBit_ccaOneTimeGame_le,OneTimeAuthenticatedEncryption.oneTimeINDCCA) ([BS23], Sections 9.2.2–9.2.3, Attack Game 9.2, Definitions 9.5–9.6, and Theorem 9.1, printed pp. 362–365): inccaGame(and its single-encryption-query counterpartccaOneTimeGame), a two-channelCCAAdversary(Operation = Bool) may interleave left-or-right encryption queries (false, recording challenge ciphertexts) with decryption queries (true, rejecting recorded challenge ciphertexts and returningencOption encBits (decrypt n k ct)on all other ciphertexts). Using the difference lemma (OracleComp.IdenticalUntilBad.advantage_le, [BS23], Theorem 4.7) betweenccaGameandccaRejectGame(and betweenccaOneTimeGameandccaOneTimeRejectGame), we prove bothAE ⇒ CCA(AuthenticatedEncryption.indcca) and1AE ⇒ 1CCA(OneTimeAuthenticatedEncryption.oneTimeINDCCA) with the book's bounds (9.3) and (9.4) in the numberQdof decryption queries, up to a power-of-two factor (see below), as well as encryption-query count preservation for the reductions $B_{\mathrm{cpa}}$ and $B_{\mathrm{ci}}$.
The generic Encrypt-then-MAC composition ([BS23], Section 9.4.1, Theorem 9.2,
printed pp. 367–368) and its concrete non-vacuous PRF-based cipher instance ([BS23],
Section 5.4.1, Example 5.2 and Theorem 5.2, printed pp. 183–187) are formalized in
CslibFrontier.Crypto.Computational.Encryption.EncryptThenMAC.
Specializations and losses relative to Boneh–Shoup Chapter 9 #
- Ciphertext space: a cipher declares its ciphertext space
ctSpace, every word by default, and decryption rejects outside it (decrypt_eq_none_of_ctSpace_eq_false). Attack Game 9.1 asks for a forgery inC, and Attack Game 9.2 for decryption queries inC. On a cipher withctSpace = C, a forgery outsideCloses and a decryption query outsideCis answered with a rejection, so the integrity games are the source's onC, andINDCCAandOneTimeINDCCAimply the source's CCA and 1CCA security onC(and are equivalent to them whenCis efficiently recognizable, as Definition 2.10 requires). - Fixed
n-bit plaintext domain at security parametern: encryption queries taken-bit messages (msg.length = ninciGame,m0.length = n ∧ m1.length = nincpaGameandccaGame). Malformed encryption queries return[]without invokingencryptor recording a challenge ciphertext. - Challenge-ciphertext decryption queries in
ccaOracle: in Section 9.2.2 (printed p. 362), the text stipulates that "The restriction we impose is that the adversary may not ask for the decryptions of any of these ciphertexts." InccaOracle, decryption queries on previously returned challenge ciphertexts (queriedCiphertexts) are instead answered with[] = encOption encBits none(rejection), which is equivalent for adversaries respecting the restriction and makesccaOraclea total function on all queries. - Power-of-two index range in Theorem 9.1: in equations (9.3) and (9.4) of [BS23]
(printed pp. 363–364), the CI term has coefficients
2 * QdandQd, whereQdbounds the decryption queries (IsDecryptionQueryBounded), and $B_{\mathrm{ci}}$ guesses the forging decryption query uniformly in{1, ..., Qd}. HereccaToCIAdversaryuses dyadic index samplingsampleDyadicIndex (Qd n - 1), scaling the CI term bydyadicSize (Qd n - 1):2whenQd n ≤ 1, and otherwise the least power of two that is at leastQd n. This is because a strict PPT sampler with fair coins and a fixed running time has dyadic probabilities. The bounds (9.3')advantage_ccaGame_le_two_muland (9.4')guessingAdvantage_guessBit_ccaGame_lecarry2 * dyadicSize (Qd n - 1)anddyadicSize (Qd n - 1);guessingAdvantage_guessBit_ccaGame_le_two_mulrestates (9.4') with2 * Qd n, sincedyadicSize (Qd n - 1) ≤ 2 * Qd nonceQd n ≥ 1. Encryption queries cost nothing in the decryption budget.
Main definitions #
Cslib.Crypto.CIAdversary,Cslib.Crypto.CCAAdversary: adaptive ciphertext-integrity and chosen-ciphertext adversaries.Cslib.Crypto.SymmetricCipher: uniform symmetric cipher onn-bit messages, with a ciphertext space outside which decryption rejects.Cslib.Crypto.SymmetricCipher.CiphertextLength,CiphertextLengthLE: exact and bounded ciphertext length onn-bit messages under keys supported bykeyGen n.Cslib.Crypto.SymmetricCipher.cpaGame,INDCPA,cpaOneTimeGame,OneTimeINDCPA,detCPAAdversary: adaptive and one-time symmetric CPA games, security predicates, and 2-query distinguisher truncating replies toctBound nbits ([BS23], Attack Game 5.2 / Definition 5.2 / Example 5.1 / Definition 9.4).cpaGameandINDCPAaresymmetricCPAGameOnandSymmetricINDCPAOn(SymmetricCPA.lean) on pairs ofn-bit messages.Cslib.Crypto.SymmetricCipher.ciGame,CiphertextIntegrity,AuthenticatedEncryption,ciOneTimeGame,OneTimeCiphertextIntegrity,OneTimeAuthenticatedEncryption: multi-query and one-time ciphertext-integrity games, CI predicates, and AE predicates ([BS23], Attack Game 9.1 / Definitions 9.1–9.4).Cslib.Crypto.SymmetricCipher.ccaGame,ccaRejectGame,INDCCA,ccaOneTimeGame,ccaOneTimeRejectGame,OneTimeINDCCA: adaptive and one-time CCA games, all-reject hybrid games, and CCA security predicates ([BS23], Attack Game 9.2 / Definitions 9.5–9.6).Cslib.Crypto.SymmetricCipher.ccaToCPAAdversary,ccaToCIHandler,encCCAToCIState,ccaToCIAtIndexAdversary,ccaToCIAdversary,ccaToCIHiddenBitAdversary,IsEncryptionQueryBounded,IsDecryptionQueryBounded: Theorem 9.1 reductions from CCA to CPA and CI,enc_structureencoding ofProbOracleComp.PlantedState (List Bool), and structural encryption- and decryption-query budget predicates.
Main results #
Cslib.Crypto.SymmetricCipher.exists_ciphertext_length_bound,Cslib.Crypto.SymmetricCipher.exists_ciphertext_length_bound_of_length_eq: a native cap indexed by the security parameter and actual message length (including messages outside the security domain), together with itsn-bit diagonal.Cslib.Crypto.SymmetricCipher.isPPTOn_cpaGame,isPPT_cpaGame,isPPTOn_cpaOneTimeGame,isPPT_cpaOneTimeGame,isPPTOn_ciGame,isPPT_ciGame,isPPTOn_ciOneTimeGame,isPPT_ciOneTimeGame,isPPTOn_ccaGame,isPPT_ccaGame,isPPTOn_ccaOneTimeGame,isPPT_ccaOneTimeGame: strict PPT certificates for the multi-query and one-time CPA, CI, and CCA experiments.Cslib.Crypto.SymmetricCipher.isOraclePPT_detCPAAdversary,Cslib.Crypto.SymmetricCipher.advantage_cpaGame_detCPAAdversary,Cslib.Crypto.SymmetricCipher.not_indcpa_of_deterministic,Cslib.Crypto.SymmetricCipher.encrypt_eq_of_ciphertext_length_eq,Cslib.Crypto.SymmetricCipher.exists_eval_encrypt_eq_pure_of_ciphertext_length_eq,Cslib.Crypto.SymmetricCipher.not_indcpa_of_ciphertext_length_eq: deterministic symmetric ciphers (even with arbitrary polynomial ciphertext expansion) and zero-expansion ciphers cannot satisfyINDCPA([BS23], Example 5.1 and Exercise 5.10(a)).Cslib.Crypto.SymmetricCipher.isOraclePPT_ccaToCPAAdversary,Cslib.Crypto.SymmetricCipher.isOraclePPT_ccaToCIAdversary,Cslib.Crypto.SymmetricCipher.isOraclePPT_ccaToCIHiddenBitAdversary,Cslib.Crypto.SymmetricCipher.isQueryBounded_ccaToCPAAdversary_of_isEncryptionQueryBounded,Cslib.Crypto.SymmetricCipher.isQueryBounded_ccaToCIAdversary_of_isEncryptionQueryBounded:IsOraclePPTand encryption-query preservation certificates for the Theorem 9.1 reductions.Cslib.Crypto.SymmetricCipher.advantage_ccaGame_le,Cslib.Crypto.SymmetricCipher.advantage_ccaGame_le_two_mul,Cslib.Crypto.SymmetricCipher.guessingAdvantage_guessBit_ccaGame_le,Cslib.Crypto.SymmetricCipher.guessingAdvantage_guessBit_ccaGame_le_two_mul,Cslib.Crypto.SymmetricCipher.AuthenticatedEncryption.indcca,Cslib.Crypto.SymmetricCipher.advantage_ccaOneTimeGame_le,Cslib.Crypto.SymmetricCipher.advantage_ccaOneTimeGame_le_two_mul,Cslib.Crypto.SymmetricCipher.guessingAdvantage_guessBit_ccaOneTimeGame_le,Cslib.Crypto.SymmetricCipher.OneTimeAuthenticatedEncryption.oneTimeINDCCA: quantitative bounds (9.3') and (9.4') in the decryption-query count, and asymptotic AE $\Rightarrow$ CCA and 1AE $\Rightarrow$ 1CCA security ([BS23], Theorem 9.1).
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 5.3 (pp. 181–182), Exercise 5.10(a) (p. 211), and Chapter 9, Sections 9.1 and 9.2.2–9.2.3 (pp. 357–365).
An adaptive ciphertext-integrity adversary receives the unary security parameter and an auxiliary word, queries an encryption oracle on chosen messages, and outputs a candidate ciphertext.
An adaptive chosen-ciphertext distinguisher receives the unary security parameter and an
auxiliary word, queries a left-or-right encryption oracle (false) and a decryption oracle
(true), and outputs a distinguishing bit.
A uniform symmetric cipher on n-bit messages at security parameter n, with strict
probabilistic polynomial-time key generation and encryption, deterministic polynomial-time
decryption (returning Option (List Bool)), a ciphertext space ctSpace outside which decryption
rejects, and perfect decryption completeness on supported keys, n-bit messages, and ciphertexts
([BS23], Sections 5.3 and 9.1).
A source cipher defined over (K, M, C) ([BS23], Section 2.3.2, Definition 2.10,
printed p. 31) decrypts only words of C. It is encoded with ctSpace n deciding C at
parameter n and with decrypt rejecting every other word, which
decrypt_eq_none_of_ctSpace_eq_false requires. The integrity and chosen-ciphertext games then
match the source's games on C (ciGame and ccaOracle say how). Both fields have defaults,
every word and its trivial proof, for a cipher whose decryption is meant for all words.
Definition 2.10 also requires C to be efficiently recognizable; ctSpace carries no complexity
certificate, since no theorem here needs one.
Sample a symmetric secret key
kat unary security parametern.Probabilistically encrypt a message
msgunder secret keykat security parametern.Deterministically decrypt a candidate ciphertext
ctunder secret keykat parametern, returningnoneon rejection andsome msgon acceptance.The ciphertext space at security parameter
n, as a membership test on words: the setCof the source cipher ([BS23], Definition 2.10). By default every word.Key generation is uniformly strict PPT in the unary security parameter.
- encrypt_ppt : Probability.IsPPTOn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits)) Turing.MultiTapeTM.encBits fun (x : ℕ × List Bool × List Bool) => match x with | (n, k, msg) => self.encrypt n k msg
Encryption is uniformly strict PPT in
(n, k, msg). - decrypt_polyTime : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool × List Bool) => match x with | (n, k, ct) => self.decrypt n k ct) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits)) (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits)
Decryption is computable in plain polynomial time on
(n, k, ct). - decrypt_encrypt (n : ℕ) (k : List Bool) : k ∈ (self.keyGen n).eval.support → ∀ (msg : List Bool), msg.length = n → ∀ ct ∈ (self.encrypt n k msg).eval.support, self.decrypt n k ct = some msg
Every ciphertext produced by
encrypton ann-bit message under a supported secret key at security parameterndecrypts tosome msg. - decrypt_eq_none_of_ctSpace_eq_false (n : ℕ) (k ct : List Bool) : self.ctSpace n ct = false → self.decrypt n k ct = none
Decryption rejects every word outside the ciphertext space, under every key.
E.keyGen composed with a plain polynomial-time parameter selector is uniformly strict PPT.
E.encrypt composed with plain polynomial-time parameter, key, and message selectors is
uniformly strict PPT.
E.decrypt composed with plain polynomial-time parameter, key, and ciphertext selectors is
computable in plain polynomial time.
The adaptive symmetric IND-CPA experiment ([BS23], Section 5.3, Attack Game 5.2):
symmetricCPAGameOn for E.keyGen and E.encrypt, admitting a pair (m₀, m₁) exactly when both
messages have n bits. A key k ← E.keyGen n is sampled, and each query on an admitted pair is
answered with E.encrypt n k (if bit then m₁ else m₀); any other query is answered with [].
Every encryption of an n-bit message under a key supported by E.keyGen n has exactly len
bits. Encrypt-then-MAC needs this to frame (ciphertext, tag) pairs canonically.
Every encryption of an n-bit message under a key supported by E.keyGen n has at most
bound bits; exists_ciphertext_length_bound_of_length_eq supplies a polynomial bound.
A unary polynomial-time ciphertext bound indexed separately by security parameter and message
length. The key is sampled at parameter n; the bound covers every message of length ℓ, even
outside the cipher's correctness and security domain of n-bit messages.
A unary polynomial-time ciphertext bound on n-bit messages at security parameter n,
derived as the diagonal of exists_ciphertext_length_bound.
A polynomial-time bound on encoded decryption replies, uniform over the actual key sampler. It bounds rejection and successful empty messages without identifying their encodings.
The symmetric CPA experiment is uniformly strict PPT in the unary security parameter.
The symmetric CPA experiment is uniformly strict PPT, independently of unused auxiliary input.
Adaptive chosen-plaintext security (INDCPA) for a symmetric cipher ([BS23],
Section 5.3, Attack Game 5.2 and Definition 5.2): SymmetricINDCPAOn on pairs of n-bit
messages, so every uniform strict IsOraclePPT encBool distinguisher has negligible advantage
between E.cpaGame adversary false and E.cpaGame adversary true.
Stateful one-time left-or-right CPA encryption oracle ([BS23], Section 2.2,
Attack Game 2.1 and Definition 2.2; Section 9.1.1, Definition 9.4, printed p. 360): answers at most
one valid n-bit left-or-right encryption query (!alreadyQueried && m0.length == n && m1.length == n), transitioning alreadyQueried from false to true, and returns [] on all
subsequent or malformed queries.
The one-time symmetric CPA (semantic security) experiment ([BS23], Section 2.2,
Attack Game 2.1 and Section 9.1.1, Definition 9.4): sample k ← E.keyGen n and run adversary n []
against E.oneTimeCPAEncryptionOracle n k bit starting from alreadyQueried = false.
Running an oracle-PPT distinguisher against oneTimeCPAEncryptionOracle is uniformly strict PPT
in (n, k) for each challenge bit bit.
The one-time symmetric CPA experiment is uniformly strict PPT in the unary security parameter.
The one-time symmetric CPA experiment is uniformly strict PPT, independently of unused auxiliary input.
One-time chosen-plaintext security (semantic security under a single encryption query,
OneTimeINDCPA) for a symmetric cipher ([BS23], Section 2.2, Attack Game 2.1 and
Definition 2.2; Section 9.1.1, Definition 9.4, printed p. 360): every uniform strict
IsOraclePPT encBool distinguisher has negligible advantage between
E.cpaOneTimeGame adversary false and E.cpaOneTimeGame adversary true.
Reduction from cpaOneTimeGame to cpaGame: run adversary n [] against
cpaOneTimeFilterHandler n (ctBound n) starting from alreadyQueried = false.
Running a WordOracleComp Unit adversary through a single-query Bool-state filter oracle
that forwards a request when !alreadyQueried && accept n req, truncates the oracle reply to
ctBound n bits, and applies a polynomial-time postprocessing map post preserves strict
oracle-PPT admissibility (IsOraclePPT).
cpaLimitToOneQuery preserves strict oracle-PPT admissibility (IsOraclePPT).
When ctBound n bounds all ciphertext lengths produced by E.encrypt n k on n-bit messages,
running cpaLimitToOneQuery ctBound adversary in cpaGame has the exact same output distribution
as cpaOneTimeGame adversary.
Multi-query INDCPA security implies one-time OneTimeINDCPA security.
Impossibility of Zero-Expansion CPA Security (Boneh–Shoup Example 5.1 & Exercise 5.10(a)) #
Zero ciphertext expansion forces deterministic encryption ([BS23],
Exercise 5.10(a), printed p. 211): if every supported ciphertext of an n-bit message under a
supported key ke at parameter n has length n, then decryption completeness
(E.decrypt_encrypt) gives an injection from the 2^n plaintexts BitString n into BitString n
by choosing one supported ciphertext per plaintext; by finiteness of BitString n, this map is
surjective, forcing all supported ciphertexts of any n-bit plaintext msg under ke to
coincide.
Under zero ciphertext expansion (E.CiphertextLength n n), encryption of any n-bit plaintext
msg under any supported key ke evaluates to a point mass PMF.pure c₀ ([BS23],
Section 5.8, Exercise 5.10(a), printed p. 211).
Two-query CPA distinguisher ([BS23], Section 5.3, Example 5.1, printed p. 182):
queries (0^n, 1^n) followed by (0^n, 0^n), truncates each reply to ctBound n bits, and
outputs true iff the two truncated replies coincide (c₁ == c₂).
detCPAAdversary ctBound is uniformly strict oracle-PPT whenever ctBound is computable in
unary polynomial time.
At any security parameter 1 ≤ n where ctBound n bounds ciphertext lengths on n-bit
messages and E.encrypt n k (0^n) is deterministic under every supported key k,
detCPAAdversary ctBound achieves CPA advantage 1
([BS23], Section 5.3, Example 5.1, printed p. 182).
No deterministic symmetric cipher is CPA-secure ([BS23], Section 5.3, Example 5.1,
printed p. 182): if from some security parameter n₀ onward, E.encrypt n k (0^n) is a point mass
for every key k in the support of E.keyGen n, then E cannot satisfy INDCPA.
No zero-expansion symmetric cipher is CPA-secure ([BS23], Section 5.8,
Exercise 5.10(a), printed p. 211): if for every security parameter n, every supported key ke,
and every n-bit message msg, every supported ciphertext of msg has length n, then E
cannot satisfy INDCPA (proved via Example 5.1's deterministic-cipher attack
not_indcpa_of_deterministic).
Ciphertext Integrity and Authenticated Encryption (ciGame, CiphertextIntegrity, #
Stateful encryption oracle for the ciphertext-integrity game ([BS23], Section 9.1,
Attack Game 9.1): if request.2.length == n, encrypt request.2 under k, prepend the resulting
ciphertext to queriedCiphertexts, and return it; otherwise return [] without modifying the
ciphertext log.
The ciphertext-integrity experiment ([BS23], Section 9.1, Attack Game 9.1):
sample k ← E.keyGen n, run adversary n [] with oracle access to E.ciEncryptionOracle n k, and
accept when the adversary outputs a candidate ciphertext ct that was never returned by the
encryption oracle (!out.2.contains out.1) and decrypts without rejection
((E.decrypt n k out.1).isSome).
This is Attack Game 9.1 on the ciphertext space C = E.ctSpace n: a candidate outside C
decrypts to none (decrypt_eq_none_of_ctSpace_eq_false) and loses, so the adversary wins
exactly when it outputs a fresh word of C that decrypts, which is the source's winning event. The
same holds for ciOneTimeGame.
Encryption-admission policies #
The full-query and one-time ciphertext-integrity and chosen-ciphertext games differ only in when
an encryption query is answered: always, or only while no ciphertext has been returned. The
private oracles ciEncryptionOracleOn, ccaOracleOn and ccaRejectOracleOn take this admission
policy allow on the ciphertext log as a parameter, so that the PPT certificates and the
bad-event argument of Theorem 9.1 are proved once. The public full-query oracles are the
instances at fun _ => true by definition, and the one-time oracles are equal to the instances at
List.isEmpty.
Running an oracle-PPT adversary against a stateful encryption oracle gated by
allow log && (request.2.length == n) that encrypts request.2 and prepends
logEntry request.2 ct to the word log is uniformly strict PPT in (n, k) whenever allow and
logEntry are computable in polynomial time.
Running an oracle-PPT CI adversary against ciEncryptionOracle is uniformly strict PPT in
(n, k).
The ciphertext-integrity experiment is uniformly strict PPT in the unary security parameter.
The ciphertext-integrity experiment is uniformly strict PPT, independently of unused auxiliary input.
Ciphertext integrity (CiphertextIntegrity, or CI) for a symmetric cipher
([BS23], Section 9.1, Attack Game 9.1 and Definition 9.1): every uniform strict
IsOraclePPT encBits adversary has negligible probability of outputting a fresh valid
ciphertext.
Ciphertext integrity gives negligible winning probability in ciGame for every oracle-PPT CI
adversary.
Establish CiphertextIntegrity by bounding every oracle-PPT CI adversary's winning
probability.
Authenticated encryption (AuthenticatedEncryption, or AE-security) for a symmetric cipher
([BS23], Section 9.1, Definition 9.2): the cipher satisfies both INDCPA and
CiphertextIntegrity.
Stateful one-time encryption oracle for the one-time ciphertext-integrity game
([BS23], Section 9.1.1, Definition 9.3, printed p. 360): if no ciphertext has been
returned yet (queriedCiphertexts.isEmpty) and request.2.length == n, encrypt request.2 under
k, record [ct], and return ct; otherwise return [] without modifying
queriedCiphertexts.
The one-time ciphertext-integrity experiment ([BS23], Section 9.1.1,
Definition 9.3, printed p. 360): sample k ← E.keyGen n, run adversary n [] with oracle access
to E.oneTimeCIEncryptionOracle n k, and accept when the adversary outputs a candidate ciphertext
ct that was not returned by the encryption oracle (!out.2.contains out.1) and decrypts without
rejection ((E.decrypt n k out.1).isSome).
Running an oracle-PPT CI adversary against oneTimeCIEncryptionOracle is uniformly strict PPT
in (n, k).
The one-time ciphertext-integrity experiment is uniformly strict PPT in the unary security parameter.
The one-time ciphertext-integrity experiment is uniformly strict PPT, independently of unused auxiliary input.
One-time ciphertext integrity (OneTimeCiphertextIntegrity, or 1CI) for a symmetric cipher
([BS23], Section 9.1.1, Definition 9.3, printed p. 360): every uniform strict
IsOraclePPT encBits adversary has negligible probability of outputting a fresh valid ciphertext
in ciOneTimeGame.
One-time ciphertext integrity gives negligible winning probability in ciOneTimeGame for every
oracle-PPT CI adversary.
Establish OneTimeCiphertextIntegrity by bounding every oracle-PPT CI adversary's winning
probability in ciOneTimeGame.
Reduction from ciOneTimeGame to ciGame: run adversary n [] against
ciOneTimeFilterHandler n (ctBound n) starting from alreadyQueried = false.
ciLimitToOneQuery preserves strict oracle-PPT admissibility (IsOraclePPT).
When ctBound n bounds all ciphertext lengths produced by E.encrypt n k on n-bit messages,
running ciLimitToOneQuery ctBound adversary in ciGame has the exact same output distribution as
ciOneTimeGame adversary.
Multi-query CiphertextIntegrity implies OneTimeCiphertextIntegrity.
One-time authenticated encryption (OneTimeAuthenticatedEncryption, or 1AE-security) for a
symmetric cipher ([BS23], Section 9.1.1, Definition 9.4, printed p. 360): the cipher
satisfies both OneTimeINDCPA (semantic security under a single encryption query) and
OneTimeCiphertextIntegrity.
Adaptive Chosen-Ciphertext Security (ccaGame, ccaRejectGame, INDCCA) #
Stateful two-channel oracle for the adaptive chosen-ciphertext experiment ([BS23], Section 9.2.2, Attack Game 9.2):
- On an encryption query
(false, req): decodem0 = unframe reqandm1 = dropFrame req; if both have lengthn, encryptif bit then m1 else m0underk, prepend the resulting ciphertextcttoqueriedCiphertexts, and returnct; otherwise return[]. - On a decryption query
(true, ct): ifqueriedCiphertexts.contains ctistrue, return[](prohibited challenge ciphertext); otherwise returnencOption encBits (E.decrypt n k ct).
Attack Game 9.2 takes decryption queries from the ciphertext space C = E.ctSpace n. A query
outside C is answered here with the rejection [] = encOption encBits none
(decrypt_eq_none_of_ctSpace_eq_false), and a query inside C as in the source, so an adversary
that asks only the source's queries sees the source's oracle and INDCCA implies CCA security on
C. Conversely, when C is efficiently recognizable, as [BS23], Definition 2.10
requires, an adversary can answer its queries outside C itself, so CCA security on C implies
INDCCA. The same holds for oneTimeCCAOracle.
The adaptive chosen-ciphertext experiment ([BS23], Section 9.2.2, Attack Game 9.2):
sample k ← E.keyGen n and run adversary n [] against E.ccaOracle n k bit.
Running an oracle-PPT CCA adversary against ccaOracle is uniformly strict PPT in (n, k) for
each challenge bit bit.
The adaptive CCA experiment is uniformly strict PPT in the unary security parameter.
The adaptive CCA experiment is uniformly strict PPT, independently of unused auxiliary input.
Adaptive chosen-ciphertext security (INDCCA, or CCA-security) for a symmetric cipher
([BS23], Section 9.2.2, Attack Game 9.2 and Definition 9.5, printed p. 362): every
uniform strict IsOraclePPT encBool CCA adversary has negligible advantage between
E.ccaGame adversary false and E.ccaGame adversary true.
In [BS23], Section 9.2.2, Definition 9.5 defines adaptive multi-query CCA security,
whereas one-time CCA security (OneTimeINDCCA, or 1CCA) is defined in Definition 9.6
(printed p. 363).
Stateful two-channel oracle for the one-time adaptive chosen-ciphertext experiment ([BS23], Section 9.2.2, Attack Game 9.2 and Definition 9.6, printed pp. 362–363):
- On an encryption query
(false, req): decodem0 = unframe reqandm1 = dropFrame req; if no challenge ciphertext has been returned yet (queriedCiphertexts.isEmpty) and both messages have lengthn, encryptif bit then m1 else m0underk, record[ct], and returnct; otherwise return[]. - On a decryption query
(true, ct): ifqueriedCiphertexts.contains ctistrue, return[](prohibited challenge ciphertext); otherwise returnencOption encBits (E.decrypt n k ct).
The one-time adaptive chosen-ciphertext experiment ([BS23], Section 9.2.2,
Attack Game 9.2 and Definition 9.6, printed pp. 362–363): sample k ← E.keyGen n and run
adversary n [] against E.oneTimeCCAOracle n k bit.
Running an oracle-PPT CCA adversary against oneTimeCCAOracle is uniformly strict PPT in
(n, k) for each challenge bit bit.
The one-time adaptive CCA experiment is uniformly strict PPT in the unary security parameter.
The one-time adaptive CCA experiment is uniformly strict PPT, independently of unused auxiliary input.
One-time adaptive chosen-ciphertext security (OneTimeINDCCA, or 1CCA-security) for a
symmetric cipher ([BS23], Section 9.2.2, Attack Game 9.2 and Definition 9.6,
printed p. 363): every uniform strict IsOraclePPT encBool CCA adversary has negligible advantage
between E.ccaOneTimeGame adversary false and E.ccaOneTimeGame adversary true.
Stateful filter handler that forwards all decryption queries (true, ct) (truncating replies to
decBound n ct) and at most one valid n-bit encryption query (false, req) (truncating replies
to ctBound) to an external multi-query CCA oracle.
Reduction from ccaOneTimeGame to ccaGame: run adversary n [] against
ccaOneTimeFilterHandler n (ctBound n) decBound starting from alreadyEncrypted = false.
ccaLimitToOneEncryptionQuery preserves strict oracle-PPT admissibility (IsOraclePPT).
When ctBound n bounds all ciphertext lengths produced by E.encrypt n k on n-bit messages
and decBound n ct bounds all encoded decryption replies encOption encBits (E.decrypt n k ct),
running ccaLimitToOneEncryptionQuery ctBound decBound adversary in ccaGame has the exact same
output distribution as ccaOneTimeGame adversary.
Multi-query INDCCA security implies one-time OneTimeINDCCA security.
Authenticated Encryption Implies Adaptive CCA Security (Boneh–Shoup Theorem 9.1) #
Structural encryption-query bound for a two-channel CCA computation (Operation = Bool,
where false is the encryption channel and true is the decryption channel): every execution path
makes at most Qe encryption-oracle queries ((false, _)), while allowing arbitrary random-coin
queries and decryption-oracle queries ([BS23], Section 9.2.3, Theorem 9.1,
printed p. 363).
Every total-query bound program.IsQueryBounded Q implies the encryption-query bound
IsEncryptionQueryBounded program Q.
Structural decryption-query bound for a two-channel CCA computation: every execution path
makes at most Qd decryption-oracle queries ((true, _)), while allowing arbitrary random-coin
queries and encryption-oracle queries. This is the budget Q_d of [BS23], Section 9.2.3,
Theorem 9.1, printed p. 363.
Every total-query bound program.IsQueryBounded Q implies the decryption-query bound
IsDecryptionQueryBounded program Q.
Hybrid two-channel oracle for Game 1 in the proof of [BS23], Theorem 9.1
(Section 9.2.3, printed pp. 363–364): encryption queries (false, req) behave identically to
ccaOracle, whereas every decryption query (true, _) immediately returns [] (rejection) without
invoking decrypt.
The all-reject hybrid CCA experiment (Game 1 in [BS23], Section 9.2.3,
Theorem 9.1): sample k ← E.keyGen n and run adversary n [] against
E.ccaRejectOracle n k bit.
Stateful handler for ccaToCPAAdversary ([BS23], Section 9.2.3, Theorem 9.1):
reject all decryption queries (true, _) with [], and forward valid left-or-right encryption
queries (false, req) to the external CPA encryption oracle (truncating replies to ctBound).
Reduction from the all-reject hybrid ccaRejectGame to the adaptive CPA experiment cpaGame
([BS23], Section 9.2.3, adversary $B_{\mathrm{cpa}}$ in Theorem 9.1): run adversary n []
against ccaToCPAHandler n (ctBound n).
ccaToCPAAdversary preserves strict oracle-PPT admissibility (IsOraclePPT).
When ctBound n bounds all ciphertext lengths produced by E.encrypt n k on n-bit messages,
running ccaToCPAAdversary ctBound adversary in cpaGame has the exact same output distribution as
ccaRejectGame adversary ([BS23], Section 9.2.3, equation (9.7) in the proof of
Theorem 9.1, printed p. 365).
Multi-tape encoding of ProbOracleComp.PlantedState (List Bool), matching the right-nested
tuple layout encPair encUnary (encPair encBool encBits) definitionally (rfl).
Stateful handler for ccaToCIAtIndexAdversary and ccaToCIAdversary
([BS23], Section 9.2.3, adversary $B_{\mathrm{ci}}$ in Theorem 9.1): execute one
CCA-to-CI query against the external CI encryption oracle, maintaining a named countdown-and-capture
record ProbOracleComp.PlantedState (List Bool).
- Once
state.hasCaptured = true, all subsequent queries return[]without calling the external CI encryption oracle and leavestateunchanged. - While
state.hasCaptured = false, a decryption query(true, ct)is answered with[](reject); it captures⟨0, true, ct⟩ifstate.rem == 0and otherwise steps to⟨state.rem - 1, false, []⟩. So the countdown runs over decryption queries only, and starting fromrem = jcaptures the decryption query with zero-based indexj. - While
state.hasCaptured = false, an encryption query(false, req)with(unframe req).length == n && (dropFrame req).length == nqueries the external CI encryption oracle onif bit then dropFrame req else unframe req(truncating the reply to its firstctBoundbits), and any other encryption query returns[]; neither changesstate.
Deterministic-index ciphertext-integrity reduction at decryption-query index j
([BS23], Section 9.2.3, Theorem 9.1): run adversary n [] against
ccaToCIHandler n (ctBound n) bit starting from ProbOracleComp.PlantedState.init j [] and output
the captured ciphertext candidate out.2.candidate, which is the decryption query with zero-based
index j when there is one and [] otherwise.
Reduction from decryption-oracle forgery in ccaRejectGame to the ciphertext-integrity game
ciGame for fixed challenge bit bit ([BS23], Section 9.2.3, adversary $B_{\mathrm{ci}}$
in Theorem 9.1): for a decryption-query budget Qd, sample a decryption-query index uniformly from
{0, ..., dyadicSize (Qd n - 1) - 1} with
ProbOracleComp.sample (ProbComp.sampleDyadicIndex (Qd n - 1)) and run
ccaToCIAtIndexAdversary ctBound j bit adversary. The book samples from {1, ..., Qd}; with fair
coins a fixed-time sampler draws from a power-of-two range, and dyadicSize (Qd - 1) is the least
power of two that is at least Qd when 2 ≤ Qd.
Single-adversary ciphertext-integrity reduction that samples a hidden challenge bit uniformly
via BitString.sampleList 1 and invokes ccaToCIAdversary ([BS23], Section 9.2.3,
proof of Theorem 9.1, printed p. 364).
ccaToCIAdversary preserves strict oracle-PPT admissibility (IsOraclePPT).
ccaToCIHiddenBitAdversary preserves strict oracle-PPT admissibility (IsOraclePPT).
Difference-Lemma Hop and Query-Budget Induction for Theorem 9.1 #
The argument is the same for the full-query and the one-time games, so it is proved for an
admission policy allow and instantiated at fun _ => true here and at List.isEmpty in the
one-time section below.
Decryption-rejection hop. If a CCA adversary makes at most Qd n decryption queries and
ctBound n bounds the ciphertext lengths of n-bit messages, its advantage between ccaGame and
ccaRejectGame (which rejects every decryption query) at bit bit is at most the sum over
j < Qd n of the CI winning probabilities of ccaToCIAtIndexAdversary ctBound j bit adversary
([BS23], Section 9.2.3, the bound $|\Pr[W_0] - \Pr[W_1]| \leq \Pr[Z]$ in the proof of
Theorem 9.1, printed p. 364, for a fixed bit).
Use it with sum_succProbability_ccaToCIAtIndexAdversary_le to remove the decryption oracle
from a reduction to CiphertextIntegrity.
Running ccaToCIAdversary in ciGame averages ccaToCIAtIndexAdversary uniformly over
Fin (dyadicSize (Qd n - 1)).
The sum of CI winning probabilities over the decryption-query indices j < Qd n is at most
dyadicSize (Qd n - 1) times the CI winning probability of the single adversary
ccaToCIAdversary, which samples the index uniformly below dyadicSize (Qd n - 1) ≥ Qd n. Use it
after advantage_ccaGame_ccaRejectGame_le_sum to bound the decryption-rejection hop by one CI
adversary.
Quantitative AE $\Rightarrow$ CCA bound with one CI adversary per bit ([BS23],
Section 9.2.3, Theorem 9.1, printed pp. 363–365): for any CCAAdversary making at most Qd n
decryption queries at security parameter n, the adaptive CCA distinguishing advantage is bounded
by the CPA advantage of ccaToCPAAdversary plus dyadicSize (Qd n - 1) times the
ciphertext-integrity winning probabilities of ccaToCIAdversary for bit = false and
bit = true.
Running ccaToCIHiddenBitAdversary in ciGame averages ccaToCIAdversary uniformly over
bit : Bool.
Quantitative AE $\Rightarrow$ CCA bound ([BS23], Section 9.2.3, Theorem 9.1,
equation (9.3), printed p. 363): for any CCAAdversary making at most Qd n decryption queries at
security parameter n,
CCAadv ≤ CPAadv[ccaToCPAAdversary] + 2 * dyadicSize (Qd n - 1) * CIadv[ccaToCIHiddenBitAdversary].
The book's factor 2 Qd becomes 2 * dyadicSize (Qd n - 1): ccaToCIHiddenBitAdversary draws
its decryption-query index uniformly from fair coins, so the range is 2 when Qd n ≤ 1, and
otherwise the least power of two that is at least Qd n (at most 2 * Qd n once Qd n ≥ 1).
Bit-guessing AE $\Rightarrow$ CCA bound ([BS23], Section 9.2.3, Theorem 9.1,
equation (9.4), printed p. 364): for any CCAAdversary making at most Qd n decryption queries at
security parameter n, CCAadv* ≤ CPAadv*[ccaToCPAAdversary] + dyadicSize (Qd n - 1) * CIadv[ccaToCIHiddenBitAdversary], where the starred advantages are the
guessing advantages of the bit-guessing games Experiment.guessBit. The book's factor Qd
becomes dyadicSize (Qd n - 1), which is 2 when Qd n ≤ 1, and otherwise the least power of two
that is at least Qd n, because the CI adversary draws its index uniformly from fair coins.
Bit-guessing AE $\Rightarrow$ CCA bound with factor 2 * Qd: equation (9.4) of
[BS23], Theorem 9.1 (printed p. 364), with the book's factor Qd replaced by 2 * Qd n,
CCAadv* ≤ CPAadv*[ccaToCPAAdversary] + 2 * Qd n * CIadv[ccaToCIHiddenBitAdversary]. For
Qd n ≥ 1 this follows from guessingAdvantage_guessBit_ccaGame_le and
dyadicSize (Qd n - 1) ≤ 2 * Qd n. For Qd n = 0 that factor is 2, so the proof uses instead
that an adversary without decryption queries has the same advantage in ccaGame as in
ccaRejectGame.
Authenticated encryption implies adaptive CCA security ([BS23], Section 9.2.3,
Theorem 9.1, printed pp. 363–365): every symmetric cipher satisfying AuthenticatedEncryption
(INDCPA ∧ CiphertextIntegrity) also satisfies INDCCA.
Encryption-Query Preservation for Theorem 9.1 Reductions #
Encryption-query preservation for ccaToCPAAdversary ([BS23], Section 9.2.3,
Theorem 9.1, printed p. 363): if adversary n [] makes at most Qe encryption queries, then
ccaToCPAAdversary ctBound adversary n aux makes at most Qe CPA encryption queries.
If adversary n [] makes at most Q total oracle queries, then
ccaToCPAAdversary ctBound adversary n aux makes at most Q CPA encryption queries.
Encryption-query preservation for ccaToCIAtIndexAdversary ([BS23],
Section 9.2.3, Theorem 9.1, printed p. 363): if adversary n [] makes at most Qe encryption
queries, then ccaToCIAtIndexAdversary ctBound j bit adversary n aux makes at most Qe CI
encryption queries.
If adversary n [] makes at most Q total oracle queries, then
ccaToCIAtIndexAdversary ctBound j bit adversary n aux makes at most Q CI encryption queries.
Encryption-query preservation for ccaToCIAdversary ([BS23], Section 9.2.3,
Theorem 9.1, printed p. 363): if adversary n [] makes at most Qe encryption queries, then
ccaToCIAdversary ctBound Qd bit adversary n aux makes at most Qe CI encryption queries.
If adversary n [] makes at most Q total oracle queries, then
ccaToCIAdversary ctBound Qd bit adversary n aux makes at most Q CI encryption queries.
Encryption-query preservation for ccaToCIHiddenBitAdversary ([BS23],
Section 9.2.3, Theorem 9.1, printed p. 363): if adversary n [] makes at most Qe encryption
queries, then ccaToCIHiddenBitAdversary ctBound Qd adversary n aux makes at most Qe CI
encryption queries.
If adversary n [] makes at most Q total oracle queries, then
ccaToCIHiddenBitAdversary ctBound Qd adversary n aux makes at most Q CI encryption queries.
One-Time Authenticated Encryption Implies One-Time CCA Security (Boneh–Shoup Theorem 9.1) #
Hybrid two-channel oracle for the one-time Game 1 in the proof of [BS23],
Theorem 9.1 (Section 9.2.3, printed pp. 363–364): encryption queries (false, req) behave
identically to oneTimeCCAOracle, whereas every decryption query (true, _) immediately returns
[] (rejection) without invoking decrypt.
The one-time all-reject hybrid CCA experiment (one-time Game 1 in [BS23],
Section 9.2.3, Theorem 9.1): sample k ← E.keyGen n and run adversary n [] against
E.oneTimeCCARejectOracle n k bit.
When ctBound n bounds all ciphertext lengths produced by E.encrypt n k on n-bit messages,
running ccaToCPAAdversary ctBound adversary in cpaOneTimeGame has the exact same output
distribution as ccaOneTimeRejectGame adversary ([BS23], Section 9.2.3, Theorem 9.1).
Running ccaToCIAdversary in ciOneTimeGame averages ccaToCIAtIndexAdversary uniformly over
Fin (dyadicSize (Qd n - 1)).
Quantitative 1AE $\Rightarrow$ 1CCA bound ([BS23], Section 9.2.3, Theorem 9.1,
printed pp. 363–365): for any CCAAdversary making at most Qd n decryption queries at security
parameter n, the one-time CCA distinguishing advantage in ccaOneTimeGame is bounded by the
one-time CPA advantage of ccaToCPAAdversary in cpaOneTimeGame plus dyadicSize (Qd n - 1)
times the one-time ciphertext-integrity winning probabilities of ccaToCIAdversary in
ciOneTimeGame for bit = false and bit = true.
Running ccaToCIHiddenBitAdversary in ciOneTimeGame averages ccaToCIAdversary uniformly
over bit : Bool.
Single-adversary quantitative 1AE $\Rightarrow$ 1CCA bound ([BS23],
Section 9.2.3, Theorem 9.1, equation (9.3) for one-time security, printed pp. 363–364): for any
CCAAdversary making at most Qd n decryption queries, the one-time games satisfy
1CCAadv ≤ 1CPAadv + 2 * dyadicSize (Qd n - 1) * 1CIadv, where the CPA and CI adversaries are
ccaToCPAAdversary and ccaToCIHiddenBitAdversary.
As in advantage_ccaGame_le_two_mul, the book's factor 2 Qd becomes 2 * dyadicSize (Qd n - 1)
because the CI adversary samples its index from fair coins.
Bit-guessing 1AE $\Rightarrow$ 1CCA bound ([BS23], Section 9.2.3, Theorem 9.1,
equation (9.4) for one-time security, printed p. 364): for any CCAAdversary making at most Qd n
decryption queries, 1CCAadv* ≤ 1CPAadv*[ccaToCPAAdversary] + dyadicSize (Qd n - 1) * 1CIadv[ccaToCIHiddenBitAdversary], where the starred advantages are the
guessing advantages of the bit-guessing one-time games Experiment.guessBit. The book's factor
Qd becomes dyadicSize (Qd n - 1) as in guessingAdvantage_guessBit_ccaGame_le.
One-time authenticated encryption implies one-time adaptive CCA security
([BS23], Section 9.2.3, Theorem 9.1, printed pp. 363–365): every symmetric cipher
satisfying OneTimeAuthenticatedEncryption (OneTimeINDCPA ∧ OneTimeCiphertextIntegrity,
Definition 9.4) also satisfies OneTimeINDCCA (1CCA, Definition 9.6).