How Digital Certificates and Certificate Authorities Work
See what is inside a web certificate, how the chain of trust reaches a root your device knows, and what happens at issue, renewal and revocation.
Key takeaways
- A certificate contains a public key, the names it covers, validity dates, the issuer and the issuer's digital signature.
- The matching private key stays on the server and is never part of the certificate.
- Trust flows down a chain from a root certificate, through one or more intermediates, to the site's certificate.
- Browser and operating system makers decide which roots are trusted and can remove authorities that break the rules.
- Certificates expire, can be revoked, and are best renewed automatically.
A digital certificate is a signed statement that binds a public key to a name, such as a website's domain. A certificate authority (CA) is the organization that checks the applicant's claim and signs that statement. Your browser accepts it because the signature leads back to a root authority your device already trusts.
That arrangement lets you connect securely to a site you've never visited, without exchanging any secret with it beforehand. The rest of this guide explains each part and where things can go wrong.
The problem certificates solve
Public key cryptography lets anyone encrypt to, or verify signatures from, the holder of a private key. The weak point is knowing whose public key you have. If someone in the middle of your connection substitutes their own key, you would encrypt happily to the wrong party.
A certificate answers that by having a third party you already trust vouch for the pairing of key and name. The whole system, with its authorities, rules and software, is often called public key infrastructure (PKI). The signing itself uses digital signatures.
What's inside a certificate
Web certificates follow the X.509 format, profiled for the internet in RFC 5280.
The Subject Alternative Name (SAN) list is what modern browsers check against the address you typed. The older "Common Name" field is no longer relied upon for this. A wildcard entry such as *.example.com covers one level of subdomain, so it matches shop.example.com but neither example.com itself nor a.b.example.com.
Other fields include a serial number, a flag saying whether this certificate may sign other certificates, and addresses where revocation information can be fetched.
The chain of trust
Your device holds a root store, a collection of self-signed root certificates from authorities that its maker has accepted. Apple, Microsoft, Mozilla and Google each run root programs with their own rules.
Roots are precious, so their private keys are kept offline under tight controls. Day-to-day signing is done by intermediate certificates that a root has signed. The site's own certificate, called the leaf or end-entity certificate, is signed by an intermediate.
During the TLS handshake, the server sends the leaf and intermediates. The browser verifies each signature using the key in the certificate above, until it arrives at a root it holds. It also checks dates, names, usage limits and revocation status along the way.
If a server forgets to send an intermediate, some browsers can fill the gap from their cache or fetch it, while other clients simply fail. That is why a site can work on your laptop and break in a script.
How a certificate is issued
The process looks like this:
- You generate a key pair on your server or let your host do it.
- You create a certificate signing request (CSR), which contains the public key and requested names, signed with your private key.
- You send the request to a CA.
- The CA verifies that you control each domain, and for some certificate types checks your organization.
- The CA checks DNS for rules about which authorities may issue for the domain.
- The CA signs and returns the certificate, and records it in public logs.
To make a key and request with OpenSSL (version 1.1.1 or later):
openssl req -new -newkey rsa:2048 -nodes \
-keyout example.com.key -out example.com.csr \
-subj "/CN=example.com" \
-addext "subjectAltName=DNS:example.com,DNS:www.example.com" The -nodes option leaves the key file unencrypted, which is typical for servers that must start unattended, so restrict its file permissions. The CA never needs your private key. Be wary of any process that asks you to send it.
Domain control is usually proven by placing a token on the website or in DNS. Automated protocols handle this for you, as described in ACME and automated issuance. The level of identity checking varies; see DV, OV and EV.
CAA records in DNS let you name which authorities are permitted, and publicly trusted CAs must honor them at issuance.
Rules that keep authorities honest
A CA that signs a certificate for the wrong party can endanger anyone who trusts it, and any trusted CA can technically sign for any domain. Several safeguards address that:
- Baseline Requirements from the CA/Browser Forum set minimum standards for validation and operations.
- Audits are required to enter and remain in root programs.
- Certificate Transparency makes issued certificates publicly visible, so domain owners can spot ones they didn't ask for.
- Distrust is the ultimate sanction. Root program operators have removed or restricted authorities after serious failures, and certificates from them stop working.
Expiry and revocation
Every certificate has an end date. The maximum permitted lifetime for public web certificates has been shortened more than once, and further reductions have been scheduled by the industry. Check current limits with your CA. Short lifetimes limit how long a stolen key or outdated claim stays usable, and they make automation close to essential.
Revocation cancels a certificate early, for instance when a private key leaks or the domain changes hands. There are two classic mechanisms:
- CRL (certificate revocation list): the CA publishes a signed list of revoked serial numbers.
- OCSP (Online Certificate Status Protocol, RFC 6960): a client asks about one certificate. A server can fetch the answer and attach it to the handshake, called stapling.
In practice, revocation checking is imperfect. Querying a CA directly leaks browsing information and can be slow, and many clients proceed if no answer arrives. Browsers increasingly distribute compiled revocation data of their own, and some authorities have moved away from OCSP in favor of lists. If your key is compromised, revoke the certificate, generate a new key and replace it everywhere.
Public, private and self-signed
Installing a root certificate on your device is a serious act: whoever holds that root's key can then impersonate any site to you. Only add roots from an organization you have a reason to trust, such as your employer on a work device, and never because a pop-up or caller told you to.
Looking at a certificate yourself
In most browsers, clicking the icon beside the address leads to connection details and a certificate viewer; menu names vary by version. From a terminal:
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName To read a certificate file:
openssl x509 -in certificate.pem -noout -text Check four things when something looks off: the names, the dates, the issuer and whether the full chain is present.
File formats you may run into
PEM files are text, framed by lines such as -----BEGIN CERTIFICATE-----, and can hold several certificates in sequence. DER is the binary form of the same data. PKCS #12 files, usually ending .pfx or .p12, can bundle certificates and a private key behind a password. Extensions like .crt and .cer don't reliably indicate which encoding is inside, so look at the contents.
When a key is exposed
The certificate itself is public, so anyone can copy it without harm. The private key is the part that matters. If it ends up in a code repository, an email attachment, a shared drive or a compromised server, assume someone else can impersonate your site until the certificate expires or revocation takes effect.
Respond in this order:
- Close the route that exposed the key, such as a compromised account or an open file share.
- Generate a brand-new key pair. Never reissue a certificate around a leaked key.
- Obtain and install a replacement certificate on every system that held the old one.
- Revoke the old certificate and state key compromise as the reason where your CA lets you.
- Review issuance records for certificates you don't recognize.
Reduce the odds beforehand. Give the key file the tightest permissions your server allows, keep it out of backups that many people can read, and never share one key between unrelated services. Larger organizations sometimes keep keys in a hardware security module, a device that performs signatures without ever releasing the key, and many cloud platforms offer a managed version.
Keeping track of what you own
Expiry outages often happen to certificates nobody remembered. Keep a simple inventory listing each certificate's names, issuer, expiry date, server locations and renewal method. Include the less visible ones, such as certificates on mail servers, VPN gateways, internal dashboards and service-to-service connections.
Then check from the outside. A monitoring job that connects to each endpoint and reads the live end date catches the cases an inventory misses, like a renewed file that a running service never loaded. Set the warning early enough that someone can act during a normal working week.
Common questions
Does a certificate mean a site is legitimate?
It means the connection reaches whoever controls that domain, with encryption. It doesn't judge their intentions. HTTPS and TLS explained covers the limits.
What happens if a CA goes away?
Certificates keep working only while the chain remains trusted. If an authority is distrusted or shuts down, you obtain a replacement from another one. With automation, switching is usually a configuration change.
Can I reuse one certificate on several servers?
Technically yes, by copying the certificate and key. Each copy widens the exposure if one machine is compromised. Issuing separate certificates per server is cleaner when your tooling allows it.