Skip to main content
Module 5 · Lesson 3 of 418/42 in the course~16 min
Module lessons (3/4)

Authenticated Encryption (AES-GCM) & Nonce Reuse

Lesson preview6 hands-on exercises readyApplication & Web Security · Module 5 — Applied Cryptography in Browser & Node

Recover plaintext without the key when AES-GCM reuses an IV, then build safe encrypt/decrypt helpers with random 96-bit IVs and AAD.

What you'll learn in this lesson

  • Explain why AES-GCM provides confidentiality + authenticity (AEAD) via a unique 96-bit IV (nonce) and optional Associated Authenticated Data (AAD).
  • Exploit real crypto.subtle AES-GCM nonce reuse via XOR keystream cancellation without touching the encryption key.
  • Generate fresh 12-byte CSPRNG IVs, bind contextual metadata in additionalData, and serialize versioned AEAD envelopes safely.

Overview

Under the hood, AES-GCM generates a deterministic XOR keystream K derived from (key, IV) and tags every block with GHASH. If you ever encrypt two different messages with the same (key, IV) pair, both plaintexts are XORed against the identical keystream K, letting any observer compute P2 = C1 XOR C2 XOR P1 with zero knowledge of the AES…

Trace the math and modern Web Crypto defense:

Sections covered in this lesson

  1. 11. Stream Keystream Cancellation, Fresh Nonces & AAD
  2. 22. Interactive Explorer: AES-GCM Nonce Reuse Simulator
  3. 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
  4. 44. Checkpoints & Code Review
Pro Lesson · Module 5 — Applied Cryptography in Browser & Node

Unlock "Authenticated Encryption (AES-GCM) & Nonce Reuse" and the full Application & Web Security curriculum

Recover plaintext without the key when AES-GCM reuses an IV, then build safe encrypt/decrypt helpers with random 96-bit IVs and AAD.

Unlock all 6 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Application & Web Security plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.