What the padlock proves

HTTPS wraps the plain text of part 4, so nobody on the path can read it or change it unnoticed. The padlock proves that the name you typed matches a certificate signed by someone your machine trusts. It does not prove that the site is honest.

Part 5 of 9 · Networking4 min read
example.comvalid 90 daysan ID cardname, signer, dateroot you trustissuerexample.comsignature chainends at a root you trustprivate + unchangednobody can read or edit it?openssl s_clientit shows the cardthree checks: name, dates, chainthe padlock is not a promisea valid card, not an honest site

In part 4 the request travelled as plain text, and anyone on the path could read it. HTTPS fixes that by adding TLS between TCP and HTTP. The browser then shows a padlock. We look at what the padlock says.

At the post office, the clerk at the front desk shows an ID card before Bub hands over a letter. Bub does not know the clerk, but the card carries the stamp of an inspector, and Bub keeps a short list of inspectors to trust. If the stamp is on that list, Bub accepts the name on the card. The card is the certificate, and an inspector is a certificate authority.

The server shows an ID card

The server’s ID card is a certificate. We can ask a server for its certificate and read the main fields:

Shell
docker run --rm alpine sh -c 'apk add -q openssl &&
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null |  
openssl x509 -noout -subject -issuer -dates -ext subjectAltName' 
subject=CN=example.com
issuer=C=US, O=SSL Corporation, CN=Cloudflare TLS Issuing ECC CA 3
notBefore=Sep 26 22:49:11 2026 GMT
notAfter=Dec 25 22:56:35 2026 GMT
X509v3 Subject Alternative Name: 
  DNS:example.com, DNS:*.example.com

Here is what each marked part does:

  1. 1openssl s_client -connect example.com:443 opens a TLS connection and prints what the server shows. The option -servername names the site.
  2. 2</dev/null closes the input, so that the command ends.
  3. 3openssl x509 -noout -subject -issuer -dates -ext subjectAltName reads the certificate and prints only these fields.

The certificate names the site it is for, example.com, and every name it covers, including *.example.com. It names who signed it, the issuer, and it has a start and an end date. This one is valid for 90 days. After the end date the certificate must be renewed, and a client rejects an expired one.

A chain of signatures

Your machine may not know the issuer in that output. It follows the signatures upwards until it reaches a root it has on its list. Ask for the whole chain:

Shell
docker run --rm alpine sh -c 'apk add -q openssl &&
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null 2>/dev/null | 
grep -E "^ [0-9] s:|^   i:"' 
 0 s:CN=example.com
 i:C=US, O=SSL Corporation, CN=Cloudflare TLS Issuing ECC CA 3
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

Here is what each marked part does:

  1. 1-showcerts prints every certificate in the chain.
  2. 2grep -E "^ [0-9] s:|^ i:" keeps the lines for the owner (s:) and the signer (i:) of each certificate.

Each s: is the owner of a certificate, and each i: is who signed it. The signer of one entry is the owner of the next. The site’s certificate is signed by an issuing authority. That authority is signed by another, and so on up to a root that the machine already trusts. Each signer is a certificate authority. The machine’s own list decides where the chain ends, so your output can end one step earlier or later.

rootSSL.com Root CAintermediateSSL.com Transit CAissuerCloudflare Issuing CAsiteexample.comeach one signs the nexton your machine's listwhat the server shows
The server's certificate is signed by one authority, which is signed by another, up to a root that your machine already trusts.

What happens in the handshake

After TCP opens, the two sides run the TLS handshake. curl -v prints each message of it:

Shell
docker run --rm alpine sh -c 'apk add -q curl &&
curl -sv https://example.com -o /dev/null 2>&1 | grep -E "handshake, (Client|Server|Cert|CERT|Finished)"' 
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS handshake, Finished (20):

Here is what each marked part does:

  1. 1curl -sv prints the details of the connection, and grep -E "handshake, (Client|Server|Cert|CERT|Finished)" keeps the lines of the handshake messages.

The client says hello, names the site it wants and sends material for a key. The server answers with its own material, and both sides compute the same key. The messages after the hellos are encrypted, including the certificate. The server proves that it holds the secret key that belongs to the certificate (CERT verify). The Finished messages confirm that nobody changed the messages before them.

Client helloI want example.comCertificatehere is my cardEncryptedthe checks pass

Client hello: the client names the site it wants to reach.

Three checks, three ways to fail

The client makes at least three checks on the certificate: the name matches, the dates are valid, and the chain ends at a trusted root. Each failed check gives a different error. Three test sites, each made to fail in one way, show them:

Which check does each site fail?

Shell
docker run --rm alpine sh -c 'apk add -q curl &&
for h in expired wrong.host self-signed; do 
  curl -sS -o /dev/null https://$h.badssl.com 2>&1 | head -1 
done'
curl: (60) SSL certificate OpenSSL verify result: certificate has expired (10)
curl: (60) SSL: no alternative certificate subject name matches target hostname 'wrong.host.badssl.com'
curl: (60) SSL certificate OpenSSL verify result: self-signed certificate (18)

Here is what each marked part does:

  1. 1The for loop repeats the command for three test sites, made to fail in one way each.
  2. 2curl -sS hides the progress meter but still shows errors. head -1 keeps the first line.

The first certificate is past its end date. The second is valid but names another site, so the name check fails. The third is signed by its own owner, so the chain does not reach a trusted root. curl stops each time, and a browser shows a warning. Turning the checks off (curl -k) removes the error and also the protection.

What the padlock does not say

A passed check means three things. Nobody on the path can read the text. Nobody changed it without being detected. An authority that your machine trusts signed the certificate for this name. An authority usually checks only that the requester controls the name. A site with a name like your bank’s can have a valid certificate. The padlock says nothing about who runs a site or whether it is honest.

the padlock provesit does not provenobody can read itnobody changed itthe name matches a trusted signaturewho runs the sitethat the site is honest
The padlock proves privacy, no changes, and a name that matches a trusted signature. It does not prove that the site is honest.

Key points

  • TLS sits between TCP and HTTP. It encrypts the data and checks who is on the other end.
  • The server shows a certificate: the names it covers, who signed it and for how long.
  • The client follows the signatures up to a root on its own list. The name, the dates and the chain must all pass.
  • The padlock proves privacy and a name that matches a trusted signature. It does not prove that the site is honest.

Next, in part 6: why the address your machine uses is borrowed, and what changes it on the way out.

New posts by email

One email when a post ships, about twice a month. Nothing else, and one click to leave.

Latest: Finding where a request breaks · RSS