HTTPS & TLS
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.
- Client hello
The browser lists supported security methods and sends information for creating a shared secret.
- Server hello and authentication
The server sends its certificates and information for the shared secret. Its digital signature proves it holds the private key.
- Check identity
The browser checks the certificates, domain name, expiry dates and signature.
- Derive keys
Both sides use the shared secret to create matching encryption keys. They check that setup messages were not changed.
- 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.
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.
App: refill 10 mg
Network attacker: changes protected bytes
Pharmacy: verification fails; reject messageThe insight
Stopping message changes matters as much as keeping messages private.
Reject an impersonating hotspot
A fake Hotel_Guest_Free hotspot tries to impersonate the hotel booking site.
Man-in-the-middle
- In plain English
- A man-in-the-middle attack occurs when someone secretly sits between two parties and relays or alters their messages.
- Think of it like
- It is like a postman who opens, reads and reseals your letters.
The fake hotspot lacks the real site's trusted certificate and private key. Your browser rejects it. Respect that warning, and check the address: a lookalike site can have its own valid certificate.
The guest laptop's certificate check fails against a fake hotspot. The hotspot attempts to relay traffic to the real booking server.
The insight
Certificates are what make impersonation fail.
Authenticate a wearable device
Your fitness wearable connects to its cloud service using mutual TLS.
Mutual TLS
- In plain English
- Mutual TLS is TLS where the client also shows a certificate, so both sides prove who they are.
- Think of it like
- It is like two spies each showing a badge before talking.
The wearable checks the service's certificate; the service checks the device's. Protect device keys and replace or cancel them when needed. Stolen keys let attackers impersonate devices.
The insight
TLS also checks client identity when both sides use certificates.
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
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.