Cyber Trainer Crypto Primer
Crypto Primer · Chapter 07

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

What protected this page?

This site runs on Cloudflare, so the page can ask Cloudflare's edge what it negotiated with your browser:

Checking…

If you see X25519MLKEM768, your browser just did a hybrid post-quantum key exchange (Chapter 05).

Wi-Fi security: WEP → WPA → WPA2 → WPA3

WEPWPAWPA2WPA3
Introduced1997/19992003 (stop-gap)2004 (802.11i)2018
CipherRC4RC4 with TKIPAES-CCMPAES-CCMP / GCMP-256
Key / IV40 or 104-bit key + 24-bit IV128-bit per-packet keys, 48-bit IV128-bit128-bit (192-bit Enterprise)
IntegrityCRC-32 (not cryptographic)Michael MICCBC-MAC (in CCMP)CCMP/GCMP + mandatory PMF
Personal authShared keyPSK + 4-way handshakePSK + 4-way handshakeSAE (Dragonfly) + 4-way handshake
Statusbroken in minutesdeprecatedOK with a strong passphrasecurrent

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.
How quickly do 24-bit IVs repeat?

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.
The WPA2 4-way handshake
WPA2's weak spots
  • 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.

WPA3 SAE (Dragonfly) exchange
Watch out for transition modeNetworks that run "WPA2/WPA3 mixed" for older devices can be downgraded to WPA2 by a rogue AP. Early implementations also had the Dragonblood (2019) side-channel flaws, which have since been fixed. Keep firmware up to date.

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:

  1. Agree on algorithms (the cipher suite).
  2. Agree on a shared secret (key exchange, usually ECDHE).
  3. Prove the server's identity (the certificate and a signature, from Chapter 06).
  4. Derive symmetric keys and confirm nobody tampered with the handshake (Finished messages).

TLS 1.2 handshake (ECDHE-RSA)

TLS 1.2: two round trips before any data

TLS 1.3 handshake

TLS 1.3: one round trip, with most of the handshake encrypted
TLS 1.2TLS 1.3
Round trips to secure data21 (0 with resumption)
Key exchangeRSA key transport, DH, ECDHE(EC)DHE only, plus hybrid PQ such as X25519MLKEM768
Forward secrecyOptionalAlways
Bulk ciphersCBC, RC4, 3DES, GCM…AEAD only: AES-GCM, ChaCha20-Poly1305, AES-CCM
Certificate visible on the wireYes (plaintext)No (encrypted)
Removed featuresRenegotiation, compression, static RSA/DH, MD5/SHA-1, custom DH groups
Decode a cipher suite

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.
QUIC handshake (1-RTT)
Why round trips matter

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.

0-RTT is fast but replayableEarly data sent with a resumption ticket isn't protected against replay. An attacker could resend a captured "transfer £100" request. Servers should accept 0-RTT only for safe, idempotent requests such as GET.

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.

Knowledge check