System Design Academy

Saving…

Lesson 6 of 10 in Module 10 of 54 lessons complete

HTTPS & TLS

Module 1, lesson 6Concept10 min

Definition

HTTPS

In plain English
HTTPS is HTTP sent through an encrypted, verified connection.
Think of it like
It is like a sealed, tamper-evident envelope instead of a postcard.

TLS

In plain English
TLS is the protocol that sets up the encryption and proves the server is who it claims to be.
Think of it like
It is like showing a passport at the door and then speaking in a private code.

Why it exists

On café Wi-Fi, someone between you and the server could read or change unprotected HTTP messages. Your login and refill requests need protection.

  • Keep messages private: outsiders cannot read their contents.
  • Detect changes: reject messages altered on the way.
  • Check identity: verify that you reached the expected server.

How it works

Encryption

In plain English
Encryption scrambles data so only someone with the right key can read it.
Think of it like
It is like writing in a code only you and your friend know.

Public-key cryptography

In plain English
Public-key cryptography uses a matched pair of keys: a public key anyone may have and a private key only its owner keeps.
Think of it like
It is like a wax seal: anyone can recognise the stamp, but only the owner holds the ring that makes it.

Certificate

In plain English
A certificate is a signed document proving that a public key belongs to a specific domain name.
Think of it like
It is like a passport issued by an authority you trust.

Certificate Authority

In plain English
A certificate authority is an organisation trusted to sign certificates after checking the claimed identity.
Think of it like
It is like the passport office.
  1. Client hello

    The browser lists supported security methods and sends information for creating a shared secret.

  2. Server hello and authentication

    The server sends its certificates and information for the shared secret. Its digital signature proves it holds the private key.

  3. Check identity

    The browser checks the certificates, domain name, expiry dates and signature.

  4. Derive keys

    Both sides use the shared secret to create matching encryption keys. They check that setup messages were not changed.

  5. Exchange HTTP

    Both sides use their shared keys to protect HTTP messages and detect changes.

Browser and server exchange setup messages, key information and a certificate. The browser checks the server's proof before sending an encrypted GET and receiving encrypted 200.

A simplified TLS 1.3 exchange authenticates the server before protected HTTP flows.

Browser and server exchange setup messages, key information and a certificate. The browser checks the server's proof before sending an encrypted GET and receiving encrypted 200.

Examples

Protect a refill dosage

Your refill request travels from an app to a pharmacy.

A prescription says 10 mg. Changing it to 100 mg risks harming a patient. TLS rejects messages changed during delivery.

Integrity protects the message in transit; application checks remain necessary.
Text
App: refill 10 mg
Network attacker: changes protected bytes
Pharmacy: verification fails; reject message

The insight

Stopping message changes matters as much as keeping messages private.

Trade-offs

Pros

  • Keep content private in transit.
  • Detect tampering.
  • Check the other side's identity.

Cons

  • Setting up a new connection takes time.
  • Certificate expiry can cause outages.
  • Encryption uses processor time.

Use when

  • Use on public internet connections.
  • Protect sensitive internal traffic too.

Avoid when

  • Never send sensitive information without protection.
  • Very limited devices need security designed for their hardware.

Quick check

What stops a fake Wi-Fi hotspot impersonating your bank over HTTPS?
Why does TLS switch to a shared symmetric key after the handshake?

Takeaways

  • HTTPS is HTTP protected by TLS.
  • A certificate and proof of its private key verify the server's identity.
  • Public-key maths sets up the connection; faster shared keys protect the messages.

Try the quick check above whenever you feel ready.

Previous: HTTP