Digital certificates and certificate authorities
How a browser knows a public key really belongs to example.com: a signed certificate, a chain of signatures up to a root it already trusts, and two ways a certificate dies.
In 30 seconds
A certificate is a small public file that says “this public key belongs to this name”, signed by a certificate authority (CA) that checked the claim.
Your browser verifies that signature with the CA’s own certificate, which is signed by a CA above it, up to a root that came pre-installed with your browser or operating system.
A site’s certificate expires after a few months, and a CA can revoke one early if its key leaks. A certificate that fails any check produces a browser warning.
Digital certificates and certificate authorities, step by step
The names, key bytes and serial here are invented. In practice revocation checking is patchy, which is one reason certificate lifetimes keep getting shorter.
- Step 1: Whose key is this?. To talk privately with example.com, a browser needs the site’s public key. But a public key is only a number. If an impostor in the middle hands over their own key instead, the browser cannot tell the difference, and would encrypt everything for the impostor.
- Step 2: What a certificate contains. A certificate is a small signed file that ties a name to a public key. It states who it is for, the key, who issued it, the dates it is valid between and a serial number. A signature from the issuer covers all of those fields at once.
- Step 3: A certificate authority signs. A certificate authority (CA) first checks that whoever asks really controls example.com. Then it hashes the certificate’s fields and signs that hash with its private key. Only the CA can produce this signature; everyone can check it with the CA’s public key.
- Step 4: The browser checks it. The browser repeats the hash itself, then checks the signature against that hash using the CA’s public key. If it passes, the fields are exactly what the CA signed. Change a single byte, the name or the key, and the check fails.
- Step 5: A chain up to a root. But whose key checks the CA? Its own certificate, signed by a CA above it. A site’s certificate (the leaf) is signed by an intermediate CA, whose certificate is signed by a root CA. The root signs itself. The browser checks each signature in turn, climbing the chain.
- Step 6: The root store. Nothing vouches for the root. Instead, each browser or operating system ships with a root store: a list of a hundred or more root certificates its maker has vetted. A chain is trusted only if it ends at one of them. Otherwise the browser shows a warning.
- Step 7: Expiry and revocation. Two more checks. A certificate works only between its two dates, now a matter of months, so stale keys age out. And if a private key leaks early, the CA revokes the certificate by publishing its serial number in a signed list (CRL) or answering live queries (OCSP).
Try it yourself
Learn this first
Spotted a mistake on this page?