# TLS Certificates: What the Padlock Does and Doesn't Prove

You see the padlock in the address bar. The site must be safe, right?

Not exactly. The padlock tells you something real, but it is much smaller than most people assume.

---

## Two Pieces: The Protocol and the Certificate

Transport Layer Security (TLS) is the protocol that protects the connection between your browser and a server. It is the "S" in HTTPS (HTTP Secure). You met it briefly in [What Actually Happens When You Type a URL Into Your Browser?](ADD-HASHNODE-URL) as one step on the way to a web page.

A **certificate** is the document the server presents to prove it is allowed to use a particular name, such as `example.com`.

TLS 1.3 is the current version of the protocol. It is specified in RFC (Request for Comments) 9846, published in July 2026, which obsoletes RFC 8446. Older articles still point to RFC 8446, so it helps to know why.

---

## What TLS Gives You

Used correctly, TLS provides three things for the connection:

- **Confidentiality.** Others on the network path cannot read the traffic.
- **Integrity.** Changes to the traffic in transit can be detected.
- **Server authentication.** The browser gets evidence that it is talking to the server for the name it asked for.

Notice what is missing from that list: any statement about the website's content, owner, or intentions.

---

## What Is Inside a Certificate

A certificate follows the X.509 format, profiled for the internet in RFC 5280. In plain terms, it carries:

- A public key
- The names it covers
- The dates it is valid
- The issuer, which is the certificate authority (CA) that signed it
- The CA's digital signature

You will build one yourself in the exercise below.

---

## How a Browser Decides to Trust a Certificate

When you visit a site over HTTPS, the browser works through a short checklist:

1. The server presents its certificate, along with any intermediate certificates.
2. The browser checks that the certificate covers the name you asked for.
3. The browser checks that today's date falls inside the validity period.
4. The browser follows the chain of signatures up to a root CA that your operating system or browser already trusts.

That chain looks like this:

```text
Root CA (in your trust store)
  signs  ->  Intermediate CA
               signs  ->  The site's certificate
```

The key idea is that trust comes from the trust store, not from the server. Your device decides which CAs to believe before you ever visit the site.

---

## What a CA Actually Checks

For most public certificates, the CA validates that the requester controls the domain name. The CA/Browser Forum Baseline Requirements say the CA must validate each domain name listed in the certificate before issuing it.

This is called domain validation. It proves control of a name.

It does not review whether the people behind the name are honest, safe, or who they claim to be.

| What the padlock suggests | What it actually tells you |
| --- | --- |
| The site is safe | Nothing about the site's content or safety |
| The company is legitimate | That someone controlled the domain name when the certificate was issued |
| Your data is protected | That the connection to the server is protected in transit |
| This is the right server | That the certificate matched the name you asked for and chains to a trusted CA |

A site built to deceive people can still obtain a valid certificate for its own domain name. The certificate covers the name, not the intent.

This is why [HTTP Security Headers: The Tiny Lines Doing a Lot of Work](ADD-HASHNODE-URL) and the rest of web security still matter on HTTPS sites. The padlock is one control, not the whole story.

---

## Certificates Expire, and That Is Changing

Every certificate has a validity period. When it ends, browsers warn visitors or refuse the connection.

The CA/Browser Forum, the group of CAs and browser makers that sets rules for public certificates, approved a schedule in 2025 that shortens the maximum lifetime from 398 days to 47 days. The reductions happen in steps between March 2026 and March 2029.

Shorter lifetimes limit how long an old or compromised certificate stays valid. They also push organizations toward automated renewal.

For defenders, an expired certificate is usually an operations failure rather than an attack. It still causes outages.

That makes it an ownership problem. Someone has to know the certificate exists, who renews it, and when. See [You Can't Defend What You Don't Know You Have](ADD-HASHNODE-URL) and [Temporary Access Has a Way of Becoming Permanent](ADD-HASHNODE-URL).

A forgotten certificate is a small version of [Security Debt Compounds Too](ADD-HASHNODE-URL).

---

## Common Misconceptions

### "The padlock means the site is trustworthy."

It means the connection is protected and the name matched. It says nothing about whether you should trust the site.

### "A certificate is what encrypts the traffic."

The TLS protocol does the encrypting. The certificate supports authentication and the key exchange that sets it up.

### "A self-signed certificate means no encryption."

A self-signed certificate can still support an encrypted connection. The problem is that nobody your browser trusts vouched for it.

### "An expired certificate means someone is attacking me."

Usually it means someone forgot to renew. The browser warns because it can no longer confirm the certificate is valid.

### "I can just click through the warning."

Sometimes the cause is harmless, like an expired lab certificate. But a warning is the browser telling you it cannot verify who you are talking to, so treat it as information, not an obstacle.

---

## Practical Exercise: Make and Inspect a Certificate

This exercise runs only on your own machine or lab VM. The test server binds to `127.0.0.1`, so it is reachable only from that machine. You will not scan or connect to anything else.

**Step 1: Look at a real certificate in your browser**

Open any HTTPS site you use. Click the padlock or site information icon and find the certificate details. Wording varies by browser.

Write down the issuer, the names it covers, and the valid-from and valid-to dates.

**Step 2: Create a lab certificate**

```bash
mkdir ~/tls-lab && cd ~/tls-lab
openssl req -x509 -newkey rsa:2048 -nodes -keyout lab.key -out lab.crt \
  -days 30 -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost"
```

This creates a private key (`lab.key`) and a certificate (`lab.crt`) that expires in 30 days.

**Step 3: Read it**

```bash
openssl x509 -in lab.crt -noout -subject -issuer -dates -ext subjectAltName
```

You should see output like this:

```text
subject=CN = localhost
issuer=CN = localhost
notBefore=...
notAfter=...
X509v3 Subject Alternative Name:
    DNS:localhost
```

The subject and issuer are the same. That is what "self-signed" means: the certificate vouches for itself.

**Step 4: Start a local TLS test server in one terminal**

```bash
openssl s_server -accept 127.0.0.1:8443 -cert lab.crt -key lab.key -www
```

**Step 5: In a second terminal, connect three ways**

```bash
curl -sS https://localhost:8443/ -o /dev/null
curl -sS --cacert lab.crt https://localhost:8443/ -o /dev/null -w "HTTP %{http_code}, verify result: %{ssl_verify_result}\n"
curl -sSk https://localhost:8443/ -o /dev/null -w "HTTP %{http_code}, verify result: %{ssl_verify_result}\n"
```

Expected results:

```text
curl: (60) SSL certificate problem: self-signed certificate
HTTP 200, verify result: 0
HTTP 200, verify result: 18
```

Here is what happened:

- The first command failed because nothing curl trusts vouched for the certificate.
- The second succeeded because you told curl to trust `lab.crt` explicitly. A verify result of 0 means verification passed.
- The third connected because `-k` told curl to skip the check. The result of 18 is OpenSSL's code for a self-signed certificate. The problem was still there, and curl was told to ignore it.

Be careful with `-k` outside a lab. It disables the very check that makes TLS authenticate anything.

**Cleanup**

Stop the server with Ctrl+C, then remove the files:

```bash
rm lab.key lab.crt
```

**Questions to answer**

1. In step 5, who vouched for the certificate in the successful connection?
2. What would you need to change so a browser would trust this certificate without a warning?
3. If this were a real site, who should own renewal?

---

## Key Takeaway

A TLS certificate ties a name to a key, and a trusted CA vouches for that tie. The padlock means the connection is protected and the name matched.

It does not mean the site is safe, honest, or well built.

---

## Verified References

- IETF RFC 9846, The Transport Layer Security (TLS) Protocol Version 1.3 (July 2026; obsoletes RFC 8446). <https://datatracker.ietf.org/doc/rfc9846/>
- IETF RFC 8446, The Transport Layer Security (TLS) Protocol Version 1.3 (obsoleted by RFC 9846). <https://datatracker.ietf.org/doc/rfc8446>
- IETF RFC 5280, Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile. <https://www.rfc-editor.org/info/rfc5280>
- CA/Browser Forum, Baseline Requirements for the Issuance and Management of Publicly-Trusted TLS Server Certificates (domain validation, Section 3.2.2.4). <https://cabforum.org/working-groups/server/baseline-requirements/about/>
- CA/Browser Forum, Ballot SC-081v3: Introduce Schedule of Reducing Validity and Data Reuse Periods. <https://cabforum.org/2025/04/11/ballot-sc081v3-introduce-schedule-of-reducing-validity-and-data-reuse-periods/>
- curl documentation, SSL certificate problems. <https://curl.se/docs/sslcerts.html>
