TwiceToldby Develoker
ConceptsSystem designLabsCheat sheetsAbout

Develoker makes free tools for learning to build software. TwiceTold explains each idea twice, as an everyday analogy and the real thing; CloudArch lets you design cloud systems and put load on them.

About ยท Labs ยท Cheat sheets ยท Learning paths

โ† Back to TLS & HTTPS

๐Ÿ”’ TLS & HTTPS: cheat sheet

๐ŸŽจ The analogySwapping postcards for locked boxes, with a notary's stamp proving the shop is really the shop.
๐ŸŽ“ The regular explanationHow the web keeps traffic private and genuine. TLS encrypts and authenticates every byte after a short handshake, and certificates signed by trusted authorities prove you're talking to the real site.
Postcards and locked boxesStep 4 of 4
TLS๐Ÿง’You๐Ÿ•ต๏ธNosy sorting officesees noise๐ŸชThe shop
  1. Plain HTTP is like a postcard. Every sorting office it passes through can read it.
  2. Worse, a sorting office could quietly change the postcard. The shop's reply arrives with an advert stuck on it.
  3. With HTTPS, you and the shop agree on a lock first. Then every letter travels in a locked box only you two can open.
  4. The sorting office still carries the box, but sees only scribbles. If it tampers with the box, you can tell and throw it away.
The TLS 1.3 handshakeStep 4 of 4
encrypted๐Ÿง’Yousame secret๐ŸชThe shopsame secret
  1. You send a hello with the locks you know how to use, and half of a secret recipe.
  2. The shop picks a lock, sends its own half of the recipe, and shows its ID card stamped by a notary.
  3. You check the ID card. Then both of you mix the two halves and end up with the same secret, though it was never posted.
  4. You send your own "all set" note, already locked, and from now on every letter goes in a locked box.
Who signed this ID card?Step 4 of 4
๐Ÿง’Youโš ๏ธ not trusted๐Ÿง‘โ€โš–๏ธNotary๐ŸชThe real shopverified โœ“โœ• โœ•๐Ÿ’ซPretend shop
  1. Before opening, the shop proves to a notary that it really runs shop.com. The notary stamps its ID card.
  2. Your browser came with a list of notaries it trusts. It checks the stamp on the card against that list.
  3. A pretend shop sets up on the corner, saying it's shop.com, with a card it stamped itself.
  4. The stamp isn't from any notary on your list, so your browser refuses and shows a big warning.

๐Ÿงฉ Key questions

Why is plain HTTP like a postcard?
Every sorting office on the way can read it, and could even change it. HTTPS puts every letter in a locked box, and you can tell if anyone forces it.
How do two strangers agree on a secret when everything they post can be read?
Each mixes a secret ingredient with a shared one, swaps mixtures, and adds their own again. Nobody watching can make the final mix from what was posted.
Why does the shop show an ID card stamped by a notary?
So you know you agreed the lock with the real shop, not a pretend one. A pretend shop can't get a real notary's stamp for a name that isn't theirs.