Documentation

CslibFrontier.Crypto.Computational.Encryption.EncForge

Fresh-Message Encryption Unforgeability #

This module defines fresh-message encryption unforgeability (EncForge) for symmetric ciphers, following Katz and Lindell, Introduction to Modern Cryptography, 3rd ed., Section 5.2, Definition 5.2 (printed p. 151). In encForgeGame, an adaptive CIAdversary queries an encryption oracle on n-bit plaintexts (logging the queried plaintexts queriedMsgs) and wins by outputting a candidate ciphertext ct that decrypts to some m for a fresh plaintext !queriedMsgs.contains m.

Ciphertext integrity (ciGame, [BS23], Definition 9.1) implies EncForge (succProbability_encForgeGame_le_ciGame, CiphertextIntegrity.encForge). For encryptThenMAC E M hctLen, ordinary fresh-message MAC unforgeability (M.EUFCMA, without M.SUFCMA) already suffices for (encryptThenMAC E M hctLen).EncForge (succProbability_encForgeGame_encryptThenMAC_le, encForge_encryptThenMAC, [KL20], Exercise 5.5, printed p. 165).

The generic composition separations stated in terms of EncForge are in CslibFrontier/Crypto/Computational/Encryption/CompositionCounterexamples.lean.

Main definitions #

Main results #

References #

Fresh-Message Encryption Unforgeability (encForgeGame, EncForge, KL Definition 5.2) #

Stateful encryption oracle for the fresh-message encryption unforgeability game ([KL20], Section 5.2, Definition 5.2, printed p. 151): if request.2.length == n, encrypt request.2 under k, prepend request.2 to queriedMsgs, and return the ciphertext; otherwise return [] without modifying queriedMsgs.

Pair-logging encryption oracle recording (msg, ct) pairs for each valid n-bit query. Projecting Prod.fst yields encForgeOracle and projecting Prod.snd yields ciEncryptionOracle.

The fresh-message encryption unforgeability experiment Enc-Forge ([KL20], Section 5.2, Definition 5.2, printed p. 151): sample k ← E.keyGen n, run adversary n [] against E.encForgeOracle n k, and accept when E.decrypt n k out.1 succeeds with a plaintext m that was never queried (!out.2.contains m).

The fresh-message encryption unforgeability experiment is uniformly strict PPT in the unary security parameter.

The fresh-message encryption unforgeability experiment is uniformly strict PPT, independently of unused auxiliary input.

Fresh-message encryption unforgeability (EncForge, [KL20]): every uniform strict IsOraclePPT encBits adversary has negligible probability of outputting a ciphertext that decrypts to an unqueried plaintext. This is plaintext integrity, [BS23], Exercise 9.15 (p. 395): the ciphertext integrity game, Attack Game 9.1 (pp. 358–359), won when the output decrypts to a message that was never queried. Encryption queries on words other than n-bit messages are answered with [].

EncForge gives negligible winning probability in encForgeGame for every oracle-PPT adversary.

Establish EncForge by bounding every oracle-PPT adversary's winning probability.

Running an adaptive program against encForgeOracle produces the exact same distribution as running it against ciPairOracle and projecting the pair log via Prod.fst.

Running an adaptive program against ciEncryptionOracle produces the exact same distribution as running it against ciPairOracle and projecting the pair log via Prod.snd.

Quantitative EncForge vs. CiphertextIntegrity bound: for every SymmetricCipher, adaptive adversary, and security parameter n, the fresh-message forgery probability in encForgeGame is at most the fresh-ciphertext forgery probability in ciGame.

Ciphertext integrity (CiphertextIntegrity) implies fresh-message encryption unforgeability (EncForge).

KL Exercise 5.5: Encrypt-then-MAC with an EUFCMA MAC Satisfies EncForge #

theorem Cslib.Crypto.succProbability_encForgeGame_encryptThenMAC_le (E : SymmetricCipher) (M : MACScheme) (hctLen : ∀ (n : ℕ), E.CiphertextLength n (M.msgLen n)) (tagBound : ℕ → ℕ) (adversary : CIAdversary) (n : ℕ) (htagBound : ∀ km ∈ (M.keyGen n).eval.support, ∀ (c : List Bool), c.length = M.msgLen n → ∀ tag ∈ (M.sign km c).eval.support, tag.length ≤ tagBound n) :

Quantitative EncForge to EUFCMA bound for Encrypt-then-MAC ([KL20], Exercise 5.5, printed p. 165): when tagBound n bounds all MAC tag lengths on M.msgLen n-bit ciphertexts under supported keys at security parameter n, the encForgeGame winning probability of adversary against encryptThenMAC E M hctLen is at most the eufCmaGame winning probability of etmToMACForger E M tagBound adversary against M.

theorem Cslib.Crypto.encForge_encryptThenMAC (E : SymmetricCipher) (M : MACScheme) (hctLen : ∀ (n : ℕ), E.CiphertextLength n (M.msgLen n)) (heuf : M.EUFCMA) :

Encrypt-then-MAC EncForge security under EUFCMA ([KL20], Exercise 5.5, printed p. 165): if M satisfies ordinary fresh-message existential unforgeability (M.EUFCMA), then encryptThenMAC E M hctLen satisfies fresh-message encryption unforgeability (EncForge), without requiring M.SUFCMA or E.INDCPA.