How TLS and HTTPS work
Encrypted is not enough: you need the right server
What the handshake does, how certificates prove identity, and which settings quietly undo the protection.
Kevin Keller · kevinkeller.org
Why it matters
TLS protects almost every connection you make
Browsers, API clients and database drivers all rely on it. HTTPS is simply HTTP carried inside a TLS connection. Yet most people never ask what the padlock actually guarantees.
What TLS gives you
Three guarantees, and the third is the one people forget
- Confidentiality: nobody in between can read the traffic
- Integrity: nobody can change it without being detected
- Authentication: the client knows it reached the intended server
Encryption with an unknown party is not much use. An interceptor would happily encrypt everything for you.
The TLS 1.3 handshake
One round trip before any data flows
- ClientHello: supported options, plus an ephemeral key share
- ServerHello: the chosen cipher suite and its key share
- Certificate and CertificateVerify: the chain, and a signature over the handshake
- Finished: a MAC over the transcript; tampering drops the connection
Source: RFC 8446
Forward secrecy
Stealing the key next year does not decrypt today's traffic
- Ephemeral key pairs are discarded after the handshake
- TLS 1.3 removed static RSA and static Diffie-Hellman key exchange
- Hybrid
X25519MLKEM768protects recorded traffic against future quantum computers - 0-RTT resumption saves a round trip, but early data can be replayed
The chain of trust
A certificate binds a public key to a name
| Level | Where it comes from |
|---|---|
| Root CA | Pre-installed in the trust store, kept offline |
| Intermediate CA | Sent by the server with its own certificate |
| Leaf | Your server, SAN such as shop.example.com |
The client checks each signature, each expiry date, and the hostname against the SAN.
Certificate lifetimes
Renewal must be automated
47 days
The maximum validity of a public TLS certificate dropped to 200 days in March 2026. It falls to 100 days in 2027 and 47 days in 2029.
Source: CA/Browser Forum decision, 2025
SNI, mTLS and HSTS
Each one closes a different gap
| What it does | The catch | |
|---|---|---|
| SNI | Names the site on a shared IP | Plaintext; ECH is far from universal |
| mTLS | The client also shows a certificate | Rotation at scale, on a private CA |
| HSTS | Tells the browser: HTTPS only | First visit exposed unless preloaded |
Common mistakes
The settings that quietly undo TLS
- Incomplete chain: browsers cope, API clients fail
- Manual renewal: expiry still causes outages
- Terminate and forget: re-encrypt to the backend
- TLS 1.0 and 1.1: deprecated, use 1.2 and 1.3
- Shared wildcard key: one breach exposes every server
- Mixed content: one HTTP script exposes the page
The mistake that matters most
Disabling verification turns TLS into encryption with whoever answers.
verify=False, curl -k and InsecureSkipVerify make the error go away. Fix the trust store instead, for example by adding your internal CA.
The takeaway
Encryption is half of it: certificates prove who is on the other end.
Read the full article · Try the Crypto playground
Kevin Keller · kevinkeller.org