Chapter VII
Protocols in the wild
How the primitives combine in the systems you use every day: the padlock, your password, your phone, your messages and the blockchain.
- VII.1TLS 1.3
- VII.2Storing passwords
- VII.3One-time codes (TOTP)
- VII.4Passkeys
- VII.5End-to-end messaging
- VII.6Signed tokens (JWT)
- VII.7Blockchains
TLS 1.3
One round trip: an ephemeral key exchange for secrecy, a signed certificate for identity, HKDF for keys, AEAD for data.
Browsers now add an ML-KEM share (chapter IX) to X25519’s, against a future quantum computer: 1,216 bytes instead of 32.
Storing passwords
Store a slow, salted, memory-hard hash such as Argon2id. Never the password, never a fast hash.
A breached server loses its password table. A salt makes equal passwords look different; a slow hash makes each guess expensive.
Prefer Argon2id (at least 19 MiB, 2 passes), which also fills memory GPUs lack; PBKDF2 where FIPS applies.
One-time codes (TOTP)
Phone and server share a secret, compute an HMAC of the current 30-second window, and keep six digits.
A QR code gives your phone the secret K that the server keeps. Both then compute the code from K and the clock.
Passkeys
You log in by signing a fresh challenge bound to the site’s real domain: a phishing site gets nothing usable, and a breach leaks only public keys.
The private key stays on your device; the site keeps the public key and, at each sign-in, sends a fresh challenge to sign.
End-to-end messaging
A new key for every message, old ones deleted, fresh Diffie-Hellman secrets mixed in: a stolen key opens no past message, and soon no future one.
Signal and WhatsApp start from Diffie-Hellman exchanges with keys the recipient published in advance (chapter V). Message keys then come off a one-way HMAC chain.
Signed tokens (JWT)
header.payload.signature in Base64url: anyone can read it, nobody should trust it before checking the signature.
Many APIs hand out a signed token instead of keeping a session. Base64url is no encryption: only the signature makes the claims trustworthy.
Blockchains
Signatures authorize payments, hash links freeze history, Merkle trees summarize blocks, proof of work makes rewriting costly.
ECDSA or Schnorr signatures on the curve secp256k1 authorize spending. Each header commits to its transactions through a Merkle root, and to the previous block through its hash.
In one breath
- TLS 1.3. One round trip: an ephemeral key exchange for secrecy, a signed certificate for identity, HKDF for keys, AEAD for data.
- Storing passwords. Store a slow, salted, memory-hard hash such as Argon2id. Never the password, never a fast hash.
- One-time codes (TOTP). Phone and server share a secret, compute an HMAC of the current 30-second window, and keep six digits.
- Passkeys. You log in by signing a fresh challenge bound to the site’s real domain: a phishing site gets nothing usable, and a breach leaks only public keys.
- End-to-end messaging. A new key for every message, old ones deleted, fresh Diffie-Hellman secrets mixed in: a stolen key opens no past message, and soon no future one.
- Signed tokens (JWT). header.payload.signature in Base64url: anyone can read it, nobody should trust it before checking the signature.
- Blockchains. Signatures authorize payments, hash links freeze history, Merkle trees summarize blocks, proof of work makes rewriting costly.