Encrypt-then-MAC: a composed authenticated-encryption scheme #
Encrypt-then-MAC is the standard construction that turns a confidentiality-only
encryption scheme into an authenticated one: encrypt the message, then MAC the
resulting ciphertext, and transmit (ciphertext, tag). Decryption first checks
the tag and only decrypts if it verifies. Following Rosulek, The Joy of
Cryptography, §9-10 (MACs and authenticated encryption; Construction 10.9,
Claim 10.10).
This file gives the construction as a combinator on core's EncScheme, proves
its correctness generically, and then studies the XOR / one-time-pad
instantiation, for which it achieves perfect IND-CPA security (advantage
exactly 0).
The construction #
Given an encryption scheme E and a MAC macF : MacKey → E.Ciphertext → Tag,
EtM E … macF is the scheme with
Key = E.Key × MacKey,Ciphertext = E.Ciphertext × Tag;keyGensamples an encryption key and a MAC key independently;encrypt (ke, km) m = let c ← E.encrypt ke m; (c, macF km c);decrypt (ke, km) (c, t) = if t = macF km c then E.decrypt ke c else ⊥.
Main results #
EtM— the Encrypt-then-MAC combinator onEncScheme.EtM_correct— the combinator preserves correctness: ifEis correct, so isEtM E … macF. An honestly produced ciphertext always carries a matching tag, so decryption clears the tag check and recovers the message.BoolEtM— the XOR instantiation: OTP encryption composed with the XOR MACmacF km c = km ⊕ coverBool.boolEtM_correct—BoolEtMis correct (viaEtM_correctandotp_correct).boolEtM_perfect_indcpa—BoolEtMhas perfect IND-CPA security: every adversary has IND-CPA advantage exactly0.
On the Adv_CCA ≤ Adv_MAC + Adv_CPA + Adv_MAC bound #
The general Encrypt-then-MAC theorem bounds the authenticated (IND-CCA)
advantage by the MAC's forging advantage plus the base scheme's IND-CPA
advantage. Core currently exposes an IND-CPA game (INDCPA_Game) but no IND-CCA
game, so the cleanest core-provable headline is the perfect IND-CPA security of
the XOR instantiation, proved by the bijection-coupling technique of
OneTimePad.lean.
References #
- [Rosulek, The Joy of Cryptography, §9-10; Construction 10.9, Claim 10.10]
- [Bellare & Namprempre, Authenticated Encryption: Relations among Notions]
The Encrypt-then-MAC combinator #
Encrypt-then-MAC. Given an encryption scheme E and a deterministic MAC
macF : MacKey → E.Ciphertext → Tag, produce the authenticated scheme that
appends macF km c to each ciphertext c and refuses to decrypt a ciphertext
whose tag does not verify.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Correctness of the combinator #
Encrypt-then-MAC preserves correctness. An honestly generated ciphertext
(c, macF km c) carries the matching tag, so decryption passes the tag check and
falls through to E.decrypt, which recovers the message by hE.
The XOR / one-time-pad instantiation #
The XOR MAC over Bool: macF km c = km ⊕ c.
Equations
- CatCrypt.Examples.EncryptThenMAC.boolXorMac km c = (km ^^ c)
Instances For
BoolEtM is correct, by EtM_correct and correctness of the one-time pad.
Perfect IND-CPA security of the XOR instantiation #
The BoolEtM ciphertext as a pure function of the (encryption, MAC) key pair
and the message: k ↦ (k.1 ⊕ m, k.2 ⊕ (k.1 ⊕ m)).
Instances For
Coupling: the two IND-CPA games for BoolEtM are equidistributed.
The map (ke, km) ↦ (ke ⊕ (m₀ ⊕ m₁), km) is a bijection of the key space that
carries the m₀-ciphertext onto the m₁-ciphertext: the OTP component becomes
ke ⊕ (m₀ ⊕ m₁) ⊕ m₁ = ke ⊕ m₀, and the tag follows since it is a function of
that component and the (unchanged) MAC key.
BoolEtM has perfect IND-CPA security: every adversary has IND-CPA
advantage exactly 0.