HTTPS, TLS and End-to-End Encryption
Follow a TLS 1.3 handshake step by step, learn what the padlock does and doesn't promise, and compare transport, end-to-end and at-rest encryption.
Welcome back!
Step 1 of 12Learn
Everything at once in 50 milliseconds
Type a web address starting with https:// and press Enter. Before the first byte of the page arrives, your browser and the server run a protocol called TLS (Transport Layer Security), the S in HTTPS. In about one network round trip, TLS uses nearly every idea in this course:
- Diffie-Hellman key exchange, usually elliptic curve X25519, to agree on a shared secret with a stranger over a public network.
- Certificates and digital signatures to prove the server is really the site in the address bar.
- Hash-based key derivation to turn the shared secret into several symmetric keys.
- Authenticated encryption, AES-GCM or ChaCha20-Poly1305, to protect every byte that follows with confidentiality and integrity.
TLS evolved from SSL, created by Netscape in the mid-1990s. Every early version had serious flaws and is now disabled, as is TLS 1.0 and 1.1. TLS 1.2 (2008) is still widely supported, and TLS 1.3 (2018) is the modern standard. TLS 1.3 was a deliberate cleanup: it removed old ciphers, insecure modes, static RSA key exchange and many options that had caused attacks, and it cut the handshake from two round trips to one.
TLS doesn't only protect web pages. Email between servers, app APIs, many VPNs and countless internal services rely on it too.
Step 2 of 12Learn
Inside the TLS 1.3 handshake
A simplified TLS 1.3 handshake:
- ClientHello: the browser sends the cipher suites it supports, a random value, and its ephemeral Diffie-Hellman public key, guessing which key exchange the server will pick.
- ServerHello: the server picks a cipher suite and replies with its own random value and its ephemeral Diffie-Hellman public key. Both sides can now compute the shared secret and derive handshake keys; everything after this point is encrypted.
- Certificate: the server sends its certificate chain.
- CertificateVerify: the server signs a hash of the entire handshake so far with its certificate's private key. This proves it holds the key, and it ties the Diffie-Hellman values to the certificate, defeating a man in the middle.
- Finished: both sides send a MAC over the whole handshake, confirming they saw the same messages and nothing was tampered with.
- Application data flows, encrypted with session keys derived from the shared secret.
Because the Diffie-Hellman keys are ephemeral, created fresh for each connection and then discarded, TLS 1.3 always provides forward secrecy. An attacker who records your traffic today and steals the server's private key next year still can't decrypt it.
Resumed connections can even send data in the very first message (called 0-RTT), at the cost of some protection against replayed requests, so it is used only for safe requests.
Step 3 of 12Practice · Diagram
TLS 1.3 handshake in one round trip
At which step does the server prove it is really the site named in the certificate?
Tap the shape that answers the question, then press Check.
- ClientHello + DH share
Supported ciphers, a random value and an ephemeral key share.
- ServerHello + DH share
Both sides can now compute the shared secret; everything after is encrypted.
- Certificate + signature
The server proves it owns the certificate's private key by signing the handshake.
- Finished messages
MACs over the whole handshake, so tampering is detected.
- Encrypted app data
HTTP requests flow under AES-GCM or ChaCha20-Poly1305.
Step 4 of 12Practice · Put in order
Put these TLS 1.3 handshake messages in order.
Drag the items, or use the arrow buttons, to put them in order.
- Encrypted application data
- CertificateVerify signature over the handshake
- ServerHello with the server's key share
- Server's certificate chain
- ClientHello with a Diffie-Hellman key share
- Finished messages
Step 5 of 12Learn
What the padlock means, and doesn't
The padlock or tune icon in the address bar promises three things about your connection:
- Confidentiality: people on the network path, your café's Wi-Fi, your internet provider, can't read the content of pages, form data or cookies.
- Integrity: they can't alter pages in transit, for example to inject ads or malware.
- Authenticity of the domain: you're connected to a server that holds a valid certificate for exactly the domain shown.
It does not promise:
- That the site is honest or safe. Phishing sites get valid certificates for their look-alike domains.
- That the site protects your data well after it arrives. TLS protects data in transit, not on the company's servers.
- That nobody knows which site you visited. Observers can usually see the domain name, through DNS lookups and a TLS field called SNI, plus how much data was exchanged and when. Encrypted DNS and a newer extension called Encrypted Client Hello reduce this leakage, but they aren't universal.
Companies sometimes install their own root certificate on employee devices so a security appliance can decrypt and inspect traffic. Antivirus products have done similar things. That's a legitimate MITM, made possible because a new root was added to the device's trust store, and it shows how central the root store is to the whole system.
Step 6 of 12Practice · Select all that apply
You visit an HTTPS shopping site on public Wi-Fi. Which of these can the Wi-Fi operator typically still see? Select all that apply.
Select all that apply.
Step 7 of 12Learn
End-to-end encryption
With TLS alone, your message to a friend is encrypted from your phone to the messaging company's server, decrypted there, then re-encrypted for the trip to your friend. The company, and anyone who hacks or legally compels it, can read every message. That's transport encryption.
End-to-end encryption (E2EE) means only the communicating devices hold the decryption keys. The server relays ciphertext it can't read. Signal, WhatsApp and iMessage use E2EE by default for messages; several other apps offer it as an option.
The widely used Signal Protocol shows how far modern designs go:
- Each device has long-term identity keys and publishes batches of one-time Diffie-Hellman keys to the server, so a conversation can start even when the recipient is offline.
- A double ratchet derives a new key for every message, mixing in fresh Diffie-Hellman exchanges as the conversation goes on. Stealing one key exposes very little: not past messages (forward secrecy), and, once the ratchet turns, not future ones either (often called post-compromise security).
- Users can compare safety numbers, fingerprints of each other's identity keys, in person or over another channel, to rule out a man in the middle run by the server itself.
E2EE protects message content. The service may still know metadata: who talks to whom, when, and how often. And if a device itself is compromised, or messages are backed up unencrypted to the cloud, E2EE can't help.
Step 8 of 12Diagram
Where the message is readable
With end-to-end encryption the server only relays ciphertext it cannot open.
Tap a shape with to see more.
- Sender (readable)
Encrypts with keys only the two phones hold.
- TLS to server
An extra outer layer on the network.
- Server (ciphertext only)
Stores and forwards, but cannot decrypt the content. It may still see metadata.
- TLS to recipient
- Recipient (readable)
Step 9 of 12Compare
Three places encryption protects data
| Aspect | In transit (TLS) | End-to-end | At rest |
|---|---|---|---|
| Protects against | Network eavesdroppers and tampering | Network eavesdroppers and the service provider | Someone who steals the disk or device |
| Who holds the keys | Your device and the server | Only the communicating devices | The device, protected by your passcode |
| Service can read content? | Yes | No | Depends on who holds the keys |
| Examples | HTTPS, secure email transport | Signal, WhatsApp messages | BitLocker, FileVault, phone storage encryption |
Step 10 of 12Note
Step 11 of 12Practice · What would you do?
What would you do?
A journalist wants to protect sources. A messaging app advertises that all messages are encrypted with TLS between the app and its servers. Is that enough to keep messages away from the company or anyone who compels it to hand over data?
Step 12 of 12Practice · Choose one
Why does TLS 1.3 use ephemeral Diffie-Hellman for every connection instead of encrypting the session key with the server's long-term RSA key?
Lesson complete!