Documentation

CslibFrontier.Crypto.Computational.Encryption.PlaintextIntegrity

Chosen-ciphertext security and plaintext integrity imply authenticated encryption #

Plaintext integrity weakens ciphertext integrity: "the PI game is identical to the CI game except that the winning condition is relaxed to: D(k, c) ≠ reject, and D(k, c) ∉ {m₁, m₂, …}" ([BS23], Exercise 9.15, printed p. 395). In this library it is SymmetricCipher.EncForge. Part (b) of the exercise asks to "prove that a system that is CCA- and PI-secure is also AE-secure". This module proves it: INDCCA and EncForge give CiphertextIntegrity, and with SymmetricCipher.INDCCA.indcpa they give AuthenticatedEncryption.

Given a CI adversary A that makes at most Q encryption queries, the proof uses two reductions. Both draw Q independent uniform n-bit messages r₁, …, r_Q.

When the bit is false, the rᵢ are independent of everything A sees, so the CCA reduction outputs true whenever A wins, except with probability at most Q / 2ⁿ. When the bit is true, it outputs true only when the plaintext-integrity reduction wins. Hence CIadv[A] ≤ PIadv[ciToRandEncForgeAdversary] + CCAadv[ciToCCAAdversary] + Q / 2ⁿ (succProbability_ciGame_le_encForge_add_indcca).

The exercise says that the proof "only needs a weak version of CCA, namely where the adversary issues a single decryption query and is told whether the ciphertext is accepted or rejected". The reduction here makes one decryption query, and it uses the plaintext that the query returns. The hypothesis is the library's INDCCA; no one-query notion is defined. The exercise also allows "a super-poly-sized message space"; here the messages at parameter n are the n-bit strings, and the Q / 2ⁿ term is the cost.

Main definitions #

Main results #

References #

The two reductions #

noncomputable def Cslib.Crypto.SymmetricCipher.ciToCCAAdversary (ctBound Q : ℕ → ℕ) (adversary : CIAdversary) :

The CCA reduction for Exercise 9.15(b). It draws Q n uniform n-bit messages rᵢ and runs the CI adversary, answering its i-th encryption query mᵢ with an encryption of mᵢ or of rᵢ from the CCA oracle (replies truncated to ctBound n bits). It then makes one decryption query, on the adversary's forgery, and outputs true when the decryption is accepted and is none of the rᵢ.

noncomputable def Cslib.Crypto.SymmetricCipher.ciToRandEncForgeAdversary (ctBound Q : ℕ → ℕ) (adversary : CIAdversary) :

The plaintext-integrity reduction for Exercise 9.15(b). It draws Q n uniform n-bit messages rᵢ, runs the CI adversary, answering its i-th encryption query with an encryption of rᵢ (replies truncated to ctBound n bits), and outputs the adversary's forgery.

theorem Cslib.Crypto.SymmetricCipher.succProbability_ciGame_le_encForge_add_indcca (E : SymmetricCipher) (ctBound Q : ℕ → ℕ) (adversary : CIAdversary) (n : ℕ) (hq : ProbOracleComp.IsQueryBounded (adversary n []) (Q n)) (hctBound : E.CiphertextLengthLE n (ctBound n)) :
↑(Game.succProbability (E.ciGame adversary n).eval) ≤ ↑(Game.succProbability (E.encForgeGame (ciToRandEncForgeAdversary ctBound Q adversary) n).eval) + ↑(Game.advantage (E.ccaGame (ciToCCAAdversary ctBound Q adversary) false n).eval (E.ccaGame (ciToCCAAdversary ctBound Q adversary) true n).eval) + ↑(Q n) / 2 ^ n

Concrete bound for Exercise 9.15(b). For a Q-query CI adversary and a ciphertext-length bound ctBound, the CI advantage is at most the plaintext-integrity advantage of ciToRandEncForgeAdversary, plus the CCA advantage of ciToCCAAdversary, plus Q n / 2^n.

CCA security and plaintext integrity imply ciphertext integrity ([BS23], Exercise 9.15(b), printed p. 395).

CCA security and plaintext integrity imply authenticated encryption ([BS23], Exercise 9.15(b), printed p. 395).