Crypto 0 to hero - Episode 08 - Authenticated encryption In...

@mattpiz
Matthieu Pizenberg@mattpiz
17 views Jun 26, 2024 ~2 min read
Advertisement
1
Crypto 0 to hero - Episode 08 - Authenticated encryption

In previous episodes, we explained how encryption provide confidentiality, and MAC provides integrity. Today we discuss how combined they provide both confidentiality and integrity with authenticated encryption.

1/
Media image
2
In fact, without authentication, ciphers provide confidentiality only against passive eavesdropping, not active tampering attacks. For example, a man-in-the-middle may alter ciphertext in ways that are not detectable, to gain trust or inject malicious data. 2/
3
When describing the threat model, we say that authenticated encryption protects against "chosen ciphertext attacks" (CCA). The adversary is given the powerful capability to ask for the plaintext of ciphertext of his choice, except the ones he is trying to break. 3/
4
When giving both powers of chosen plaintext attack (CPA) and chosen ciphertext attack (CCA) the goal of the adversary is to break semantic security. That is to try to forge a successful pair of plaintext and ciphertext to fool other parties. 4/
5
Now a question! Which combination of encryption and MAC always provide secure authenticated encryption?

1. Encrypt the plaintext and compute MAC of the plaintext
2. Compute MAC then encrypt the plaintext + MAC
3. Encrypt the plaintext then compute MAC of the ciphertext

5/
6
Tough question right? Before giving the answer, you shall know that approach (1) "encrypt and MAC" is the one used in SSH, approach (2) "MAC then encrypt" is the one used in SSL, and (3) "encrypt then MAC" is used in IPsec. 6/
7
Approach (1) with the MAC of the plaintext does not necessarily provides confidentiality, because there is no confidentiality constraint imposed on the MAC of the plaintext. In case of "MAC then encrypt" (2) the vulnerabilities are more subtle. 7/
8
BEAST (Browser Exploit Against SSL/TLS) is a concrete attack, which targeted SSL/TLS protocols using a block cipher in CBC mode with MAC then encrypt. Exploiting the predictable initialization vector (IV) would result in a chosen plaintext attack. en.wikipedia.org/wiki/Transport… 8/
9
The correct answer is "encrypt then MAC" (3). There exists another scheme for authenticated encryption called OCB, which is quite efficient since it does not require two encryption passes. Unfortunately it has patent issues and so isn’t much used in open source software. 9/
10
Common libraries still provides very efficient implementations, based on fast MAC. As usual, do not try to make you own authenticated encryption. Stick to some of the standards, such as GCM, CCM or EAX, depending on your speed and code size constraints. 10/
11
That’s all for today! I hope you liked it. See you in the next episode! 11/11
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • Screenshot Tweet
Create Free Account

Includes 7-day Premium trial

Advertisement