After this lesson you can say precisely what the padlock promises, walk through the TLS handshake in plain words, and look at a real certificate chain from the command line.
The problem HTTPS solves
Plain HTTP, which you met in HTTP basics, sends text. Between your laptop and a server, your request travels through a home router, an internet provider and many other networks. Anyone operating one of those hops could read the text, or quietly change it before passing it on. On a cafe Wi-Fi network this is not hypothetical.
HTTPS fixes this by running HTTP inside TLS (Transport Layer Security). The word "inside" matters: the methods, status codes, headers and cookies you have learned are unchanged. TLS is a protective layer under them. The current version, TLS 1.3, is specified in RFC 8446 from the IETF. Older names such as SSL are obsolete, although people still say "SSL certificate" out of habit.
TLS provides three separate things:
- Privacy. Data is encrypted, so an observer sees scrambled bytes.
- Integrity. Each piece of data carries a check, so changes made in transit are detected and the connection fails.
- Authentication. The server proves it is allowed to speak for the name you typed. Without this, you could have a perfectly private conversation with an attacker.
The handshake in plain words
Before any HTTP is sent, the browser and server run a short negotiation. Simplified, it goes like this:
- The client says hello. It lists the TLS versions and cipher suites it supports and sends the host name it wants (this field is called SNI, server name indication). It also sends the first half of a key agreement.
- The server answers with its chosen settings, its half of the key agreement, and its certificate.
- Both sides now compute the same secret keys without ever sending those keys across the network. This uses key-agreement mathematics, which is the clever part, and you do not need to know the details to use it.
- The server proves it owns the certificate by signing part of the exchange with the private key that matches it.
- Both sides confirm the handshake was not tampered with, and the encrypted conversation begins. HTTP requests now travel inside it.
In TLS 1.3 this takes one round trip between client and server before application data flows, which is one reason the protocol is considered efficient. Later visits can sometimes resume faster. Those details are in the RFC if you want them.
Certificates and the chain of trust
A certificate is a small signed document. It contains a public key, the names it is valid for (the Subject Alternative Name list), a validity period, and the signature of the organisation that issued it, a certificate authority (CA).
How does your browser trust a CA it has never dealt with? Operating systems and browsers ship with a built-in list of root certificates that they trust. A site's certificate is usually signed by an intermediate certificate, which is signed by a root. The browser follows the chain from the site's certificate up to a root it already holds, checking each signature. It also checks that:
- the certificate has not expired and has started being valid,
- one of its names matches the host in your URL exactly (a wildcard such as
*.example.commatches one label, soshop.example.combut notexample.comitself unless that name is also listed), - it has not been revoked, using mechanisms the browser manages.
If any check fails you see a full-page warning. Clicking through it removes the authentication guarantee, so on an unknown site you should not.
See a real chain with openssl
You can ask a server for its certificate chain yourself. Only connect to sites you are allowed to test; example.com is reserved for documentation, so it is fine.
openssl s_client -connect example.com:443 -servername example.comHere is a trimmed result.
Example output captured on 2026-11; yours will differ (certificate authorities, dates and algorithms change, and the server may be reached through a different CDN edge):
Certificate chain
0 s:CN=example.com
i:C=US, O=SSL Corporation, CN=Cloudflare TLS Issuing ECC CA 3
v:NotBefore: Sep 26 22:49:11 2026 GMT; NotAfter: Dec 25 22:56:35 2026 GMT
1 s:C=US, O=SSL Corporation, CN=Cloudflare TLS Issuing ECC CA 3
i:C=US, O=SSL Corporation, CN=SSL.com TLS Transit ECC CA R2
2 s:C=US, O=SSL Corporation, CN=SSL.com TLS Transit ECC CA R2
i:C=US, O=SSL Corporation, CN=SSL.com TLS ECC Root CA 2022
3 s:C=US, O=SSL Corporation, CN=SSL.com TLS ECC Root CA 2022
i:C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services
Verification: OK
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Verify return code: 0 (ok)Read it from top to bottom. Line s: is the subject (who the certificate is for) and i: is the issuer (who signed it). Entry 0 is the site's own certificate, issued by the CA in entry 1, which was issued by the one in entry 2, and so on. Each issuer matches the next entry's subject: that is the chain. The v: line gives the validity window. Verify return code: 0 (ok) means the chain was accepted against the trust store on the machine that ran the command. You can also print the names on the first certificate with openssl x509 -noout -ext subjectAltName. In the capture above it listed example.com and *.example.com.
Notice that the intermediate certificates live for years while the site's own certificate lasts a few months. Short lifetimes limit the damage of a stolen key, and they work smoothly only when renewal is automated, which many hosts do for you.
What HTTPS does not protect
This is where beginners get misled, so be exact:
- It does not vouch for the owner. Anyone can get a valid certificate for a domain they control, including a fraudulent one. A padlock on
shop-login.examplesays the connection is private, not that the shop is real. - It does not hide who you talk to. The IP address is needed to route packets, and the host name is commonly visible during the handshake. Your DNS lookup, as seen in DNS, may also be visible unless you use encrypted DNS. Observers can also estimate sizes and timing of transfers.
- It does not protect the endpoints. If the server is hacked or your device has malware, encryption in between does not help.
- It does not make the page's code safe. A scam page can use HTTPS perfectly.
- It does not fix mixed content. If an HTTPS page loads a script or image over
http://, that part is exposed and browsers block or flag it.
Redirects and HSTS
Visitors often type a bare name or follow an old link, so the first request may be plain http://. Sites handle this with a redirect (301 or 308) to the https:// address, as in methods and status codes. There is a gap: that first plain request can in theory be interfered with. The HSTS header (Strict-Transport-Security, RFC 6797) tells the browser to use HTTPS for that site automatically for a stated time. Treat it with care: if you enable it and later let your certificate lapse, browsers will refuse to let visitors click through.
The same capture showed that http://example.com answered 200 with no redirect at the time, a good reminder that you should test, not assume. This very site's public_html/.htaccess handles the related www case: it sends www. addresses to the bare domain over https in one permanent redirect.
Common mistakes
- Believing "padlock means safe website".
- Calling certificate checking optional and using
curl -kor a browser "proceed anyway" button as a habit. - Letting a certificate expire because renewal was manual and nobody was reminded.
- Buying a certificate for
example.comand forgetting thatwww.example.comalso needs to be covered. - Loading scripts or images over
http://on an HTTPS page. - Assuming HTTPS hides which sites you visit from your network.
Exercise
- Run
openssl s_client -connect example.org:443 -servername example.organd write down the subject and issuer of each certificate in the chain. Which one is the root? - Find the
NotAfterdate of the first certificate. How many days from today? - Visit a site you own in a browser, open the padlock details, and find which names the certificate lists.
- Explain in two sentences why a scam site can show a padlock.
Show one possible answer
- The last entry has a subject that is also named as a root in your trust store, or its issuer is a different root that signed it for compatibility. Your output will differ from the lesson's, because it depends on the provider.
- Subtract today's date from
NotAfter; the result is usually only weeks or months, not years. - The details panel shows a "subject alternative name" list; the host in your address bar must appear in it.
- The padlock proves a private connection to whoever controls that domain name. Any criminal who controls a domain can obtain a certificate for it, so the padlock cannot tell you whether the owner is honest.
Next, the machines at the other end of the connection: web servers and hosting.
Key points
- HTTPS is ordinary HTTP carried inside a TLS connection, so the same requests and responses are protected on the way.
- TLS gives three things: privacy (encryption), integrity (tampering is detected) and authentication (the server proves it holds a certificate for the name you asked for).
- A certificate is checked by following a chain of signatures to a root that your browser or operating system already trusts.
- The padlock does not mean a site is honest or safe. It only says the connection is private and the name matches.
- Observers can still see which server you connect to and roughly how much data moves, even though the content is hidden.