HTTPS and TLS: encryption and trust

Why:You’ll see what the padlock in the address bar means, and why browsers frighten visitors without it. Afterwards you can explain the TLS handshake, the role of a certificate and of a certificate authority.

20 minutes

Read by speech synthesis (Qwen3-TTS); the voice is not a person’s.

HTTPS is HTTP inside a TLS channel, which encrypts the data, protects it from tampering and checks the server against a certificate authority’s certificate.

A postcard and a sealed letter

Plain HTTP is like a postcard: everyone who touches it on the way can read it. That includes the owner of the café’s Wi-Fi, the provider, any station in between. While a site is being read for the news, that is tolerable. But as soon as there’s a form asking for a phone number or a password, the postcard becomes dangerous. What’s more, whoever sits on the path can do more than read: they can change things, inserting ads into someone else’s page or slipping a virus into a downloaded file.

HTTPS is the same HTTP, but inside a protected channel built by the TLS protocol (Transport Layer Security; its former name, SSL, is still heard in conversation). It gives three things:

  1. Encryption: an eavesdropper sees noise.
  2. Integrity: if someone changes the data on the way, it will be detected.
  3. Checking the server: you’re talking to the owner of the domain, not a fake.

That’s why browsers mark HTTP sites as “Not secure”, and a number of features (location, the camera, offline mode) are allowed only on HTTPS. Search engines also count HTTPS as a plus.

Check yourself: what does HTTPS give you besides encryption?

Integrity (a change to the data on the way won’t go unnoticed) and a check of the server (you’re talking to the owner of the domain).

How to agree on a secret in front of everyone

Here is a paradox. To encrypt a conversation, both sides need a shared secret key. But how do you agree on one if someone is listening in? The answer was devised by mathematicians in the 1970s, and it’s easy to explain with paints.

Suppose we have a tub of yellow paint that everyone knows about. You secretly choose your own paint and mix it with the yellow, and the server does the same with its own. You exchange the resulting mixtures openly. Now each of you adds your own secret paint to the other’s mixture, and you both end up with the same color. An eavesdropper sees the yellow tub and two mixtures. They can’t subtract a paint from a mixture.

In the real protocol numbers stand in for paints, but the principle is the same. From the shared secret both sides derive keys, and then encrypt data with a fast cipher.

The TLS handshake

The whole exchange fits into a few messages. Press “Next step” and watch what the eavesdropper sees. Turn on “A certificate for another name” and see what happens at the check.

What an eavesdropper sees
  1. 1. Browser → server

    ClientHello: “I want to talk to www.example.com. I know these ciphers. Here is my half of the shared secret.”

    Eavesdropper: visible: that the browser went to www.example.com, and the list of ciphers. No page content has been sent yet.

What is on the wire for an eavesdropper
Nothing yet: no data has been sent.

The main thing you’ll see on the diagram: after the second step everything is encrypted, so the certificate and the data itself are no longer visible to an eavesdropper. The whole handshake takes one round trip (older versions of TLS needed two), and the HTTP request itself rides on top of it.

Check yourself: what does an eavesdropper see when data is already traveling over HTTPS?

Noise: a set of bytes from which nothing can be read without the key. All that is visible is which server the connection goes to.

The certificate

Encryption doesn’t answer the question “am I talking to the right one?”. For that there’s a certificate: an electronic document, like a site’s ID card. It records:

  • the name (or names) it was issued for;
  • the site’s public key (every site has a pair of keys, public and secret);
  • the validity period;
  • the signature of whoever issued it.

Certificates are issued by a certificate authority (CA). Every browser and system has a list of authorities it trusts. A certificate counts as genuine if it’s signed by such an authority, directly or through a chain (“the root authority signed an intermediate one, and that signed the site’s certificate”). The browser checks four things: the signature, the name, the date, and that the certificate hasn’t been revoked. Every certificate issued is also recorded in open logs, where anyone can see who got a certificate for which name.

What a certificate confirms: that you are talking to whoever controls the domain. What it doesn’t confirm: that the owner of the domain is honest. A certificate for a fraudulent site’s domain is as easy to get as one for yours: the authority checks only control of the domain. So the padlock in the address bar means “the channel is protected”, not “the site is safe”. It’s useful to know this difference, and we’ll come back to it in the parts on security and the law.

Check yourself: what does a certificate confirm, and what doesn’t it?

It confirms that you’re talking to the owner of the domain. It doesn’t confirm that the owner is honest or that the site is safe.

How to get a certificate

Certificates used to cost money and be ordered by hand. Today there’s a free way. The authority Let’s Encrypt issues certificates automatically: a special program on the server proves to the authority that it controls the domain (it puts a particular file on the site, or a particular TXT record in DNS, which you know from the DNS lesson), gets the certificate and renews it.

There are three ways:

  • Your host does it all. In most hosts’ control panels a certificate is turned on with one button. For a beginner this is the best way.
  • Automatically on your own server, with a program such as Certbot.
  • A paid certificate from an authority: needed in special cases, more often by corporations.

A certificate’s validity is limited, and it’s being shortened step by step so that a stolen certificate is dangerous only briefly. Today at Let’s Encrypt it’s 90 days. The authority has announced that from 10 February 2027 the default will be 64 days, and from 16 February 2028 it will be 45 days. The shorter the term, the more important it’s that renewal is automatic: nobody can keep up with that rhythm by hand.

Two more things worth knowing. The page and everything in it (pictures, scripts) must be served over HTTPS: one picture over HTTP leaves the protection incomplete, and the browser complains about “mixed content”. And old http:// addresses should be redirected to https:// with a 301, as in the HTTP lesson.

Practice

You’re in the era of 2010, and the site begins to accept data. Under the heading is an inquiry form. It has two mistakes: it sends data over http, and the fields have no captions, so a screen reader won’t tell a person what to type in each field. Fix both. Then complete the note about the certificate: how you’ll get it and for how many days.

The form’s button is labeled with your main action from the brief: it is for that that a visitor leaves their details.

What was wrong with 2010

HTTPS was then used by banks and shops, and everyone else thought it unnecessary and costly. In 2013 mass surveillance of traffic came to light, and in 2015 and 2016 Let’s Encrypt made certificates free and automatic. Today a site without HTTPS is considered faulty, and browsers warn about it themselves.

Practice

Preparing your page…

Test

Question 1 of 6

Put the steps of the TLS handshake in order

Put them in order with the “up” and “down” buttons.

Cards

These cards go into your review once you finish the lesson.

  • What does HTTPS give you?

    Answer

    HTTP inside TLS: encryption (it can’t be overheard), integrity (it can’t be changed unnoticed) and a check of the server (it is the domain’s owner).

  • How does the TLS handshake work?

    Answer

    The browser and the server exchange “halves” of a secret and work out a shared key, the server sends a certificate, and the browser checks it. After that the data is encrypted with the shared key.

  • What is in a site’s certificate?

    Answer

    The site’s name, its public key, the expiry date and the signature of a certificate authority.

  • Whose certificates does a browser trust?

    Answer

    Those of the certificate authorities on its own list (or the system’s list). A certificate must be signed by an authority on the list, directly or through a chain.

  • What does the padlock really mean?

    Answer

    The channel is protected, and you are talking to the owner of the domain. The padlock doesn’t guarantee that the owner is honest.

Sources

Videos

The Internet: Encryption & Public Keys (Code.org, “How the internet works”, 5 of 5)

The video loads from youtube-nocookie.com only when you press play.

Open on the site

Next

You now know: HTTPS and TLS, certificates and trust.