System Atlas
the atlas

How HTTPS works

The TLS handshake that turns a plain TCP connection into a private, verified channel.

the gist

HTTPS wraps HTTP in TLS. The client and server perform a handshake: the client proposes cipher suites, the server presents a certificate the client verifies against a trusted CA chain, and both sides use asymmetric cryptography to agree on a shared symmetric session key. From then on, all traffic is encrypted symmetrically — which is fast.

ANALOGY // Meeting a courier: first you check their badge is signed by a company you trust (certificate + CA), then you use a slow but secure method to whisper a shared password (asymmetric key exchange), and afterwards you speak quickly in that shared password (symmetric encryption).
living diagram01 / 06
ClientServerClientHello (cipher suites)ServerHello + CertificateVerify cert against CA chainKey exchange (asymmetric)Session key establishedEncrypted data (symmetric)
01

ClientHello

The client opens the handshake by listing the cipher suites and TLS versions it supports, along with a fresh random value used later to derive keys. In modern TLS 1.3 it also optimistically includes its key-share for the likely key-exchange group. This first message is what lets the two sides negotiate the strongest algorithms they both understand rather than hard-coding one.

02

ServerHello + Certificate

The server picks one cipher suite from the client's list, returns its own random value, and sends its certificate — a document binding its public key to its domain name, signed by a certificate authority. It also sends its own key-share for the exchange. The certificate is the server proving who it is, not yet any encryption of data.

03

Verify the certificate

The client validates the certificate before trusting anything: it checks the CA's signature, follows the chain up to a root it already trusts in its trust store, and confirms the hostname, validity dates, and revocation status. If any check fails the browser shows the familiar red warning and refuses to continue. This step is what stops an attacker from simply presenting their own certificate for google.com.

04

Key exchange

Using asymmetric cryptography — typically Diffie-Hellman over elliptic curves — both sides combine their key-shares to compute the same shared secret without ever transmitting it. An eavesdropper who saw every byte still cannot reconstruct it, and because ephemeral keys are used each session, recording today's traffic won't decrypt it even if the server's key later leaks (forward secrecy).

05

Session key established

From that shared secret both ends independently derive the same symmetric session keys. The expensive public-key phase is now over; it existed only to bootstrap this fast shared key. Everything from here uses symmetric encryption, which is orders of magnitude cheaper per byte.

06

Encrypted data

Every subsequent HTTP request and response is encrypted and authenticated with the symmetric session key using an AEAD cipher. That gives confidentiality, integrity, and tamper-evidence at once — an attacker can neither read nor silently alter the traffic. The plaintext HTTP the application wrote travels invisibly inside this protected channel.

the full picture
01

The problem HTTPS solves

Plain HTTP sends everything as readable text across a network you don't control — your traffic passes through your router, your ISP, backbone providers, and whatever coffee-shop Wi-Fi you're on. Anyone positioned along that path can read your requests, and worse, can modify them: injecting ads, stealing passwords and session cookies, or serving a fake login page. HTTP has no defense against any of this.

HTTPS is just HTTP running inside a protected tunnel provided by TLS (Transport Layer Security, the successor to SSL). TLS gives three guarantees simultaneously. Confidentiality: only the two endpoints can read the traffic. Integrity: any tampering is detected and rejected. Authentication: you can be sure the server on the other end is really the domain it claims to be, not an impostor. The elegant part is how it delivers all three cheaply, and that hinges on combining two different kinds of cryptography.

02

Asymmetric vs symmetric, and why both

There are two families of encryption at play. Symmetric encryption uses one shared key to both encrypt and decrypt; it is extremely fast and is what you want for protecting the actual page data. Its flaw: both parties need the same secret key, and you can't just send that key across an open network where an eavesdropper would grab it.

Asymmetric encryption uses a mathematically linked key pair — a public key anyone can hold and a private key the owner keeps secret. Something scrambled with one can only be undone with the other. This solves the key-distribution problem but is far too slow to encrypt an entire session's traffic. TLS therefore uses each for what it's good at: asymmetric cryptography during the handshake purely to let both sides agree on a shared secret over the open network, and fast symmetric encryption for every byte of data afterward. Slow-but-safe math bootstraps a fast-but-shared key — that is the whole trick.

03

Certificates and the chain of trust

Agreeing on a secret key privately is useless if you're secretly agreeing it with an attacker. So TLS also has to prove *identity*, and that is the job of the certificate. A certificate is a signed document stating "this public key belongs to google.com," and it is signed by a Certificate Authority (CA) — an organization whose own keys are pre-installed and trusted by your operating system and browser.

Trust is delegated in a chain. Your browser ships with a set of trusted root CA certificates. A root signs intermediate CAs, and intermediates sign the certificates issued to individual websites. When the server presents its certificate, the client walks this chain upward, verifying each signature until it reaches a root it already trusts. It also checks the certificate's hostname matches the site, that it hasn't expired, and that it hasn't been revoked. Only if the whole chain validates does the handshake proceed. This is why an attacker can't impersonate a site: they can copy the public certificate, but they don't have the matching private key, and no trusted CA will sign a certificate for a domain they don't control.

04

The handshake, step by step

The handshake stitches these ideas into a short exchange. The client sends a ClientHello advertising the TLS versions and cipher suites it supports plus a random value. The server replies with a ServerHello choosing one cipher suite, its own random value, and its certificate. Both sides contribute a key-share, and using an (elliptic-curve) Diffie-Hellman exchange they each independently compute the *same* shared secret — without that secret ever crossing the wire.

From that shared secret both derive identical symmetric session keys, and the handshake finishes with each side sending a verification message proving it computed the keys correctly. Every message afterward is symmetrically encrypted. A key property of modern TLS is forward secrecy: because the Diffie-Hellman keys are ephemeral and thrown away after the session, an attacker who records the encrypted traffic today and steals the server's long-term private key years later still cannot decrypt what was captured.

05

Performance, TLS 1.3, and practical notes

Historically the handshake cost two network round trips before any data flowed, which is real latency on top of TCP's own setup. TLS 1.3 streamlined this dramatically — it removed obsolete, insecure options, cut the handshake to a single round trip, and added a 0-RTT mode where a returning client can send its first request immediately, though 0-RTT weakens replay protection and shouldn't be used for state-changing requests.

In the real world you rarely implement any of this by hand. You obtain a certificate — often free and auto-renewing via Let's Encrypt and the ACME protocol — and terminate TLS at a load balancer, reverse proxy, or CDN, which handles the handshake and forwards plain HTTP to your app servers on the trusted internal network. The practical guidance is boring but important: keep certificates from expiring (the single most common outage cause), serve the full certificate chain including intermediates, prefer TLS 1.3, and let a managed platform handle the cryptographic details rather than rolling your own.

what to remember
01

The handshake starts with ClientHello offering supported cipher suites and TLS versions.

02

The server replies with ServerHello and its certificate, which binds its public key to its identity.

03

The client verifies the certificate against the CA chain — trust is delegated from a root authority.

04

Asymmetric cryptography is used only to securely agree on a shared symmetric session key.

05

Bulk traffic is then encrypted with the fast symmetric key; asymmetric sets up, symmetric carries.

check yourself

Quick quiz

Q1

What is asymmetric cryptography used for in the TLS handshake?

Q2

How does the client know it's really talking to the intended server?

follow the thread