MAC, encryption, and the Cryptographic Doom Principle
When combining a MAC with encryption, one of the following schemes is used:
- Encrypt-then-MAC (EtM): Here, the plaintext is encrypted, then the MAC is calculated on the ciphertext and sent together with the ciphertext.
- Encrypt-and-MAC (E&M): Here, the plaintext is encrypted, but the MAC is calculated on the plaintext instead of the ciphertext. The ciphertext and the MAC are then sent together.
- MAC-then-Encrypt (MtE): Here, the MAC is calculated on the plaintext. Concatenation of the plaintext and the MAC is then encrypted.
On the receiving side, the EtM scheme allows you to check the authenticity of the encrypted message before the decryption operation. The other two schemes require decryption of the whole plaintext before the MAC can be verified.
Security researchers regard EtM as the most secure scheme, provided that a strong and unforgeable MAC function is used. From a security point of view, it makes...