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

  1. ClientHello: supported options, plus an ephemeral key share
  2. ServerHello: the chosen cipher suite and its key share
  3. Certificate and CertificateVerify: the chain, and a signature over the handshake
  4. 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 X25519MLKEM768 protects 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

LevelWhere it comes from
Root CAPre-installed in the trust store, kept offline
Intermediate CASent by the server with its own certificate
LeafYour 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 doesThe catch
SNINames the site on a shared IPPlaintext; ECH is far from universal
mTLSThe client also shows a certificateRotation at scale, on a private CA
HSTSTells the browser: HTTPS onlyFirst 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