The padlock is three promises, not one. Here is how certificates, a quick handshake and fast encryption keep you safe on public Wi-Fi.
You open your bank's site on public Wi-Fi and see a small padlock. What does the padlock actually promise? Many people think it only means "scrambled". That is just one third of the story.
Here is the key idea: encryption without proof of who you are talking to is useless. HTTPS makes three promises at once: nobody can read your data, nobody can secretly change it, and you are really talking to who you think you are.
Under the hood, HTTPS is normal web traffic wrapped in TLS (Transport Layer Security). MDN describes TLS as a way for a client to talk to a server safely across an untrusted network. Let's open it up.
Say you scramble your messages with a secret code but never check who is on the other end. Someone on the Wi-Fi pretends to be the bank. You scramble everything for them.
This attack is called a manipulator-in-the-middle (MITM). MDN states HTTPS defends against exactly this, where an attacker can read and change the traffic. So TLS needs three things:
The third one is the hard one. How can a server prove anything?
It uses a certificate, which works like an ID card for a website. It holds the site's public key (a lock anyone can have, while only the server owns the matching key) and the domain name, all digitally signed.
The signature comes from a Certificate Authority (CA), an organization your device already trusts. It is like a passport office: anyone can print a card, but only the office can issue a real one. (Let's Encrypt, for example, is a nonprofit CA that gives out free certificates.)
But who vouches for the CA?
Usually the CA that signed the site's certificate was itself signed by a bigger CA, and so on up to a root. Your device or browser already trusts the roots it ships with.
Your browser walks the chain upward. If it reaches a root it trusts and every signature checks out, the site passes. If not, you see a red warning page.
That settles identity. Now, how do the two sides start talking?
Before any real data moves, the browser and server do a quick handshake. According to MDN, they agree on a TLS version and on a set of algorithms (a "cipher suite"). The server proves itself, and both agree on a secret key.
Click Next and follow the handshake.
Browser sends a hello and its public piece for the key
Look at the third step. The server signs the whole handshake, which ties its identity to the keys. That is what stops the attacker on the Wi-Fi.
But the secret key was never sent. How can both sides have it?
An attacker can watch every message and still not get the key.
TLS 1.3 uses Diffie-Hellman key exchange (the RFC states "over finite fields or elliptic curves"). Each side sends a public piece, then mixes it with its own private piece. Both end up with the same secret. The attacker sees the public pieces but cannot build the secret. The maths is skipped here, because the idea matters more.
Once both sides share a key, they switch to symmetric encryption, where the same key locks and unlocks. It is much cheaper than the key-pair style (asymmetric) used in the handshake.
MDN notes that after the handshake, all messages are encrypted, including HTTP headers and bodies. The RFC adds a catch: the length of the data is not hidden.
| Phase | Style | Job |
|---|---|---|
| Handshake | Asymmetric / key exchange | Prove identity, agree on a secret |
| Everything after | Symmetric | Fast encryption of real data |
Run this in a terminal. It shows the handshake live:
curl -v https://example.com -o /dev/null
Look for lines like "Client hello", "Server hello", "Finished", and the TLS version in use. Now look at the chain:
openssl s_client -connect example.com:443 -servername example.com
You will see a numbered list of certificates. In each pair, s: is who the certificate belongs to and i: is who signed it. Follow the i: of one into the s: of the next. That is the chain of trust in plain text.
http:// image on an HTTPS page gets blocked or upgraded.