liveBook · Manning

Authenticated encryption with associated data

As explained in Real-World Cryptography

Authenticated encryption with associated data is a cryptographic construction that encrypts plaintext, authenticates the ciphertext, and authenticates optional associated data that remains unencrypted.

When encrypted data crosses an untrusted network, secrecy alone is not enough: an attacker might alter the ciphertext. Authenticated encryption with associated data (AEAD) encrypts plaintext, detects ciphertext changes, and authenticates optional metadata that remains visible. section 4.5.1 section 4.7

An AEAD exchange follows a small, practical contract:

  • The sender and receiver share the same symmetric key. section 4.5.1 section 4.7
  • The sender supplies plaintext and may supply associated data, such as a sender identity or protocol metadata. section 4.5.1
  • The construction returns ciphertext with an authentication tag; the associated data stays unencrypted. section 4.5.1
  • The receiver must provide the same associated data during decryption; altered ciphertext or incorrect associated data produces an error instead of plaintext. section 4.5.1

AES-GCM in JavaScript

A Web Crypto API operation generates an AES-GCM key, creates a random initialization value, encodes associated data and plaintext, encrypts them, and decrypts using the same parameters. The API is low-level, so safe nonce handling remains the developer’s responsibility. section 4.5.1

AES-GCM is the most widely used AEAD, while ChaCha20-Poly1305 is another widely adopted choice. AES-GCM combines AES-CTR encryption with GMAC authentication. Nonces must not be reused: reuse breaks AES-GCM and ChaCha20-Poly1305 authentication. Prefer all-in-one AEAD constructions over assembling encryption and MACs casually; AES-CBC-HMAC remains usable but is easy to misimplement. section 4.5.2 section 4.7 section 4.4

How Real-World Cryptography covers it

How deep it goes
Explains inputs, outputs, verification behavior, AES-GCM components, and nonce requirements without developing formal proofs.
Examples
Uses sender metadata, Alice-and-Bob message exchange, AES-CBC-HMAC comparison, and JavaScript Web Crypto API code.
What it assumes
Assumes message authentication codes and symmetric keys, while explaining AEAD’s interface and failure behavior from the basics.
What you can do after
Apply AEAD via AES-GCM or ChaCha20-Poly1305 while preserving associated data and preventing nonce reuse.
How it connects
Connects symmetric encryption, message authentication codes, AES-GCM, ChaCha20-Poly1305, nonces, and TLS.

Also explained in

Compare how 3 books explain authenticated encryption with associated data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.