Crypto in the wild
This is where the earlier chapters come together. Each protocol here combines key exchange, authentication, symmetric encryption and integrity checks. The history of Wi-Fi and TLS shows clearly what goes wrong when one piece is weak.
Your connection right now
This site runs on Cloudflare, so the page can ask Cloudflare's edge what it negotiated with your browser:
If you see X25519MLKEM768, your browser just did a hybrid post-quantum key exchange (Chapter 05).
Wi-Fi security: WEP → WPA → WPA2 → WPA3
| WEP | WPA | WPA2 | WPA3 | |
|---|---|---|---|---|
| Introduced | 1997/1999 | 2003 (stop-gap) | 2004 (802.11i) | 2018 |
| Cipher | RC4 | RC4 with TKIP | AES-CCMP | AES-CCMP / GCMP-256 |
| Key / IV | 40 or 104-bit key + 24-bit IV | 128-bit per-packet keys, 48-bit IV | 128-bit | 128-bit (192-bit Enterprise) |
| Integrity | CRC-32 (not cryptographic) | Michael MIC | CBC-MAC (in CCMP) | CCMP/GCMP + mandatory PMF |
| Personal auth | Shared key | PSK + 4-way handshake | PSK + 4-way handshake | SAE (Dragonfly) + 4-way handshake |
| Status | broken in minutes | deprecated | OK with a strong passphrase | current |
WEP: a case study in getting it wrong
WEP ("Wired Equivalent Privacy") combined a reasonable cipher with poor design decisions:
- Each packet's RC4 key was just
IV ‖ shared key. The 24-bit IV was sent in the clear, and there are only 16.7 million possible values, so IVs repeat. That's the two-time pad from Chapter 02. - RC4 leaks key bytes when keys are related like this, which is the basis of the FMS (2001) and PTW (2007) attacks. PTW recovers a 104-bit key from about 40,000 packets, typically in under a minute.
- CRC-32 is linear. An attacker can flip ciphertext bits and fix up the checksum without knowing the key.
- Everyone on the network shared the same key, and there was no key management.
This is the birthday paradox: with 2²⁴ IVs you expect a repeat after only about √(2²⁴) ≈ 4,000–5,000 packets. A busy network sends that many in a few seconds.
WPA and WPA2
WPA was a firmware-upgradable patch for WEP hardware. TKIP mixed a fresh key for every packet and added the Michael integrity check, but it still relied on RC4 and is now deprecated. WPA2 replaced it with AES in CCMP mode and introduced the 4-way handshake, which is still used today.
WPA2 comes in two flavours:
- Personal (PSK): everyone uses one passphrase. It's turned into the 256-bit PMK (Pairwise Master Key) with
PBKDF2-HMAC-SHA1(passphrase, SSID, 4096 iterations). - Enterprise (802.1X): each user authenticates to a RADIUS server through EAP (for example PEAP or EAP-TLS with certificates). Each session gets its own PMK.
- Offline dictionary attacks: capture one handshake (or just the PMKID from the AP) and you can test passphrase guesses offline as fast as your GPUs allow. A weak passphrase falls in minutes, so long random passphrases matter.
- No forward secrecy: anyone who later learns the passphrase can decrypt captured traffic.
- KRACK (2017): replaying message 3 made clients reinstall a key and reset its nonce. That caused nonce reuse, the same problem as WEP and the two-time pad. Patched in clients.
WPA3
WPA3-Personal replaces the PSK with SAE (Simultaneous Authentication of Equals, also called Dragonfly), a password-authenticated key exchange built on elliptic-curve Diffie-Hellman. The password is used to choose a curve point rather than being sent or derived directly, so:
- A captured handshake is no use for offline guessing. Each guess needs a live exchange with the AP, which can rate-limit it.
- It has forward secrecy: each session gets a fresh PMK, so knowing the password later doesn't decrypt old traffic.
- Protected Management Frames (PMF, 802.11w) are mandatory, which stops deauthentication spoofing.
Also part of the family: WPA3-Enterprise 192-bit mode (CNSA-grade suites) and Wi-Fi Enhanced Open (OWE), which encrypts open café hotspots using unauthenticated Diffie-Hellman. WPA3 is required for Wi-Fi 6E and Wi-Fi 7 certification.
TLS: the padlock in your browser
Transport Layer Security (successor to Netscape's SSL) protects HTTPS, secure email, VPNs, APIs and much more. Every TLS handshake has to do four things:
- Agree on algorithms (the cipher suite).
- Agree on a shared secret (key exchange, usually ECDHE).
- Prove the server's identity (the certificate and a signature, from Chapter 06).
- Derive symmetric keys and confirm nobody tampered with the handshake (Finished messages).
- 1995–1996
SSL 2.0 and 3.0 (Netscape). Both are now broken (POODLE, DROWN). - 1999 / 2006
TLS 1.0 and 1.1. Formally deprecated by RFC 8996 in 2021 (BEAST, weak hashes). - 2008
TLS 1.2 (RFC 5246). Flexible and still widely supported, but easy to misconfigure. - 2018
TLS 1.3 (RFC 8446). Faster and simpler, with legacy options removed.
TLS 1.2 handshake (ECDHE-RSA)
TLS 1.3 handshake
| TLS 1.2 | TLS 1.3 | |
|---|---|---|
| Round trips to secure data | 2 | 1 (0 with resumption) |
| Key exchange | RSA key transport, DH, ECDHE | (EC)DHE only, plus hybrid PQ such as X25519MLKEM768 |
| Forward secrecy | Optional | Always |
| Bulk ciphers | CBC, RC4, 3DES, GCM… | AEAD only: AES-GCM, ChaCha20-Poly1305, AES-CCM |
| Certificate visible on the wire | Yes (plaintext) | No (encrypted) |
| Removed features | Renegotiation, compression, static RSA/DH, MD5/SHA-1, custom DH groups |
QUIC and HTTP/3
TLS normally runs on top of TCP, and TCP needs its own handshake first. QUIC (RFC 9000, 2021) is a new transport that runs over UDP and builds TLS 1.3 directly into the transport (RFC 9001). HTTP/3 (RFC 9114) runs on QUIC, and Cloudflare, Google and most large sites support it.
- Connection and crypto setup together: one round trip for a new connection, zero for a resumed one.
- Almost everything is encrypted, including most transport headers such as packet numbers. Middleboxes can't tamper with or ossify the protocol.
- No head-of-line blocking: a lost packet only stalls its own stream, not every request.
- Connection migration: connection IDs let your session survive switching from Wi-Fi to 4G/5G.
Time until the first byte of the response arrives on a new connection, ignoring server processing. On a 300 ms satellite or mobile link, QUIC saves the better part of a second.
Other places you'll meet cryptography
SSH
ECDHE key exchange, host keys checked by trust on first use, Ed25519 user keys. Post-quantum hybrid key exchange is the default in recent OpenSSH.
IPsec / IKEv2
Site-to-site and remote-access VPNs. ESP gives encryption and integrity. AH gives integrity only.
WireGuard
A small, modern VPN: Curve25519, ChaCha20-Poly1305 and BLAKE2s, with no cipher negotiation. Cloudflare WARP is built on it.
Signal protocol
End-to-end messaging with the Double Ratchet: a new key for every message gives forward secrecy and post-compromise security. Used by Signal and WhatsApp.
DNSSEC, DoT and DoH
DNSSEC signs DNS records for integrity. DNS-over-TLS and DNS-over-HTTPS encrypt queries for privacy. They solve different problems.
Disk encryption
BitLocker, FileVault and LUKS use AES-XTS for data at rest, with keys protected by the TPM or Secure Enclave.
Passkeys / FIDO2
Public-key login. Your device signs a server challenge, so there's no shared secret to phish or leak.
Payment cards (EMV)
The chip signs each transaction with keys that can't be extracted, which makes cloned magnetic-stripe data far less useful.