What encryption hides, and what it doesn't
Encryption makes the contents of a message unreadable to everyone on the path; the addresses, sizes and timing that carry the message stay in the open, and that is where most of this site's stories happen.
Every message you send online passes through machines you do not control: the café’s Wi-Fi router, your internet provider, a dozen networks in between. Encryption is what stops those machines from reading it. It is very good at that job, and it does nothing else. This page builds up the few ideas you need for the rest of the site: one shared key, agreeing on that key in public, proving who is on the other end, and then the three ways those pieces get stacked (HTTPS, VPNs and Tor). The last section is about what none of them hide.
The page on packets explains what a packet and an IP address are. Here the packet is taken as given: a small envelope with a “from” and a “to” written on the outside. One example runs through every figure on this page: a person whose home connection has the address 198.51.100.23 logs in as anon_4471 on the website forum.example, whose server is at 203.0.113.10.
One key that locks and unlocks
The oldest form of encryption uses a single secret key. The person’s browser runs its message and the key through a cipher and gets ciphertext, a string that looks random. The server at forum.example runs the ciphertext and the same key back through the cipher and gets the message. Anyone in between who lacks the key sees only the random-looking string.
This is called symmetric encryption, because both ends hold the same key. The cipher used almost everywhere today is AES, standardised by the US National Institute of Standards and Technology in 2001. It works on 128-bit blocks with keys of 128, 192 or 256 bits.1 Nobody knows a practical way to recover an AES key from ciphertext, so the security rests entirely on keeping the key secret.
That leaves an obvious problem. The browser and the server have never met, so how do they both get K? Sending it over the same network would hand it to everyone on the path.
Agreeing on a key in public
In 1976 Whitfield Diffie and Martin Hellman published a way for two parties to agree on a shared secret while every message between them is overheard.2 The usual way to picture it is with paint.
The browser and the server agree in public on a common colour. Each then picks a secret colour and mixes it with the common one, and they swap the mixtures in public. Finally each adds its own secret colour to the mixture it received. Both end up with the same colour: common plus the browser’s secret plus the server’s secret. An eavesdropper has the common colour and both mixtures, but to get the final colour they would have to separate a mixture back into its parts, and paint does not un-mix.
The analogy has limits worth stating. In the real exchange nothing is “added” twice: each side applies its own secret to the value it received, and the result is the same because the order of applying the two secrets does not matter. And the difficulty is not physical. It is a specific mathematical problem (the discrete logarithm) that is easy for small numbers, as the figure shows, and believed to be impractical only at the sizes real systems use. Finally, the exchange tells the browser that it shares a key with someone, not with whom; the next section deals with that.
The real version replaces paint with arithmetic that is easy in one direction and hard to reverse. Step through it with small numbers:
Each applies their own secret to the other's value, and both arrive at 2. The eavesdropper holds 23, 5, 8 and 19 but would have to recover a or b from them. With numbers this small that is trivial; at the sizes real systems use, no practical method is known.
Computing 5⁶ mod 23 is quick. Going back from 8 to the 6 means searching, and at real sizes nobody knows how to do that search in practice. TLS 1.3, the protocol behind HTTPS, runs exactly this kind of exchange at the start of every connection, often over the elliptic curve X25519 rather than plain numbers, and then uses the agreed secret as the key for a symmetric cipher.3 The expensive public-key step happens once; AES or a similar cipher does the bulk work.
The same idea gives public-key encryption. Picture a padlock that the owner hands out open, by the thousand: anyone can snap one shut on a box, and only the owner has the key that opens it. The open padlock is the public key and the owner’s key is the private key. What the picture leaves out is the important part: a padlock does not tell you who handed it to you. If someone on the path swaps in their own padlock, you lock your box for them. That is the subject of the next section.
Proving who is on the other end
Key agreement alone has a gap. If someone sits on the path and runs one exchange with the browser and another with the server, both think they have a private channel, and the intermediary reads everything. The browser needs to know that the party it agreed a key with is really forum.example.
Digital signatures close the gap. A signature is made with a private key and checked with the matching public key; it shows that the holder of the private key produced this exact data and that nobody changed it since.4 A certificate is a signed statement that binds a name, such as forum.example, to a public key. It is signed by a certificate authority, whose own certificate is signed by a root authority whose public key ships with your browser or operating system.5
In TLS 1.3 the server sends its certificate chain and then a signature over the handshake so far, made with its private key. The browser checks the chain, checks that the name matches the site it asked for, and checks the signature.3 An intermediary cannot produce that signature without the private key.
Certificates also tend to become public records. Certificate Transparency defines append-only public logs of issued certificates that anyone can audit and search.10 That is a defender’s tool, and the infrastructure chapter shows how investigators use it.
What HTTPS hides on the wire
HTTPS is ordinary web traffic carried inside TLS. It is worth being exact about which parts of a request it covers, because people tend to assume it covers everything. The TLS 1.3 specification puts it plainly: “TLS does not hide the length of the data it transmits”.3
TLS encrypts the path, headers and body. The addresses, the DNS lookup and the server name in the first handshake message stay readable, and so do the size and timing of every packet.
Toggle the figure and three things stand out.
- The addresses never change. The IP header is outside TLS, because routers need it to deliver the packet. The ISP always sees the person’s address and the server’s address.
- The site name usually leaks twice. First in the DNS lookup that turns forum.example into an address, and then in the server name indication (SNI) that the browser sends in its very first TLS message so the server knows which certificate to present. DNS over HTTPS puts the lookup inside an encrypted connection to the resolver, which still sees it.6 The Encrypted Client Hello extension, published as RFC 9849 in March 2026, encrypts the real name; observers see only the public name of the front-end server, which can stand in front of many sites.7
- Size and timing stay visible in every mode. TLS lets endpoints pad records to blur lengths, but the protocol leaves that optional.3
What HTTPS does hide, it hides well: the path after the domain, the headers including login cookies, and the page itself.
A packet inside a packet
A VPN uses encapsulation. The person’s device takes the packet it would have sent, encrypts the whole thing, including the original “to” address, and puts it inside a new packet addressed to the VPN server. WireGuard, a widely used VPN protocol, describes itself as encrypting packets and carrying them inside UDP to the peer’s endpoint.8 The VPN server removes the outer packet, decrypts the inner one, and sends it on from its own address.
With a VPN the ISP still sees the person's address, but every packet is addressed to the VPN server. The real destination is inside the encrypted inner packet.
The figure makes the trade visible. The VPN hides the person’s destinations from the ISP and their address from the website, and in exchange one company sees the person’s address next to every destination. The network chapter shows what happened when such companies were asked for their records.
Three keys for three relays
Tor removes the single party who holds both ends by using three relays: a guard, a middle and an exit. The client needs a separate key with each one, and it gets them with the same key agreement as above, run three times. In the words of the Tor design paper, the client “constructs circuits incrementally, negotiating a symmetric key with each OR on the circuit, one hop at a time” (OR is onion router, the paper’s word for a relay).9 It runs the first handshake with the guard, then sends the second through the guard to the middle, then the third through both to the exit. The current specification uses Diffie–Hellman handshakes over Curve25519 for this.10
The client then wraps every cell three times, with the exit’s key innermost. Each relay can remove exactly one layer, which tells it only where to forward the cell. The guard learns the person’s address but not the destination; the exit learns the destination but not the person’s address.11 The network chapter has an interactive figure that peels a cell relay by relay.
Put the three setups side by side and the pattern is easy to read. Each row below is one observer, each column one field of the same request, and the only thing that changes between the panels is what each observer can no longer read.
What no encryption hides
All of the above protects contents and, with Tor, the link between the two ends. None of it hides that packets exist, how big they are, or when they move. These are the metadata, and the network has to see them to deliver anything.
That is the basis of traffic correlation. An observer who watches traffic going into Tor and coming out of it can match the two by shape, without decrypting anything. The RAPTOR study showed that a single network operator is often positioned to see both sides because internet routing is asymmetric, and it matched flows on the live Tor network with 95% accuracy.19 Even one side can be enough to guess which site is loading: a classifier trained on packet sizes and directions reached 98.3% accuracy in a closed-world lab test.24
So when the chapters ahead ask what an observer can see, the answer is rarely “nothing”. Encryption decides whether the observer reads the letter. It does not decide whether they can see the envelope, or who posts envelopes at the same moment. Continue with the network chapter.
Sources
- NISTFIPS 197: Advanced Encryption Standard (AES)
- IEEENew Directions in Cryptography (W. Diffie and M. E. Hellman, IEEE Transactions on Information Theory)
- IETFRFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3
- NISTFIPS 186-5: Digital Signature Standard (DSS)
- IETFRFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile
- IETFRFC 8484: DNS Queries over HTTPS (DoH)
- IETFRFC 9849: TLS Encrypted Client Hello
- NDSS SymposiumWireGuard: Next Generation Kernel Network Tunnel (J. A. Donenfeld)
- USENIX Security SymposiumTor: The Second-Generation Onion Router (R. Dingledine, N. Mathewson, P. Syverson)
- Tor Project (specifications)Tor Protocol Specification: Create and created cells