PKI & Certificates

How the web knows who you're talking to — X.509 certificates, certificate authorities and chains of trust, root stores, domain validation and ACME/Let's Encrypt, the TLS handshake's use of certificates, revocation (CRL, OCSP, short-lived certs), Certificate Transparency, mTLS and private PKI.

Intermediate 5 min readLesson 10 of 12

Public-key cryptography lets you encrypt to a public key or verify a signature — but how does your browser know that a public key really belongs to bank.com and not to an attacker in the middle? The Public Key Infrastructure (PKI) answers with certificates signed by trusted certificate authorities (CAs).

X.509 certificates

A certificate is a signed document binding a public key to an identity:

FieldExample
SubjectCN=www.example.com
Subject Alternative Names (SANs)www.example.com, example.com, *.api.example.com — what browsers actually check
Subject public keyEC P-256 public key
IssuerCN=R11, O=Let's Encrypt
ValidityNot before / not after (now typically ≤ 90 days for public TLS, trending shorter)
Serial numberUnique per issuer
ExtensionsKey usage, extended key usage (server auth), CA flag, OCSP/CRL URLs, SCTs
SignatureThe issuer's signature over all of the above
Shell
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -issuer -dates -ext subjectAltName

Chains of trust

signssignsRoot CAself-signed; in your OS/browser trust storeIntermediate CAsigned by the rootLeaf: www.example.comsigned by the intermediate
  • Root CAs are self-signed certificates pre-installed in trust stores maintained by operating systems and browsers (Microsoft, Apple, Mozilla, Google), which audit CAs and can remove them.
  • Root private keys are kept offline in HSMs; day-to-day issuance uses intermediate CAs, which can be revoked without replacing the root.
  • The server sends its leaf + intermediates; the client builds a path to a trusted root and checks every signature, validity period, name constraints and key usage.

Misconfiguration classic: a server that omits the intermediate certificate works in some browsers (which cached or fetched it) and fails in others and in API clients.

Validation levels

TypeCA verifiesToday
DV — domain validatedControl of the domainThe vast majority of certificates; free and automated
OV — organisation validatedThe organisation's legal identityShown only in certificate details
EV — extended validationExtensive identity checksBrowsers removed the special green UI; little practical benefit

The padlock means "your connection is encrypted to the holder of this domain" — not "this site is trustworthy". Phishing sites have valid DV certificates too.

ACME and Let's Encrypt

Let's Encrypt (2015) offers free, automated DV certificates via the ACME protocol, which is why HTTPS went from a minority of page loads to nearly all of them.

  1. Your ACME client (certbot, Caddy, cert-manager in Kubernetes) creates an account key and requests a certificate for example.com.
  2. The CA issues a challenge: serve a token at http://example.com/.well-known/acme-challenge/… (HTTP-01), or publish a DNS TXT record (DNS-01, required for wildcards).
  3. The CA checks from several network vantage points that the challenge is satisfied, proving control.
  4. The client submits a CSR (certificate signing request) with the public key; the CA signs and returns the certificate.
  5. The client renews automatically well before expiry.

Automation matters because lifetimes keep shrinking (the CA/Browser Forum has approved a phased reduction to 47 days by 2029). Expired certificates remain a leading cause of outages — monitor expiry.

Certificates in the TLS handshake

In TLS 1.3 (HTTPS and TLS), the server sends its certificate chain, then a CertificateVerify message: a signature over the handshake transcript made with the certificate's private key. The client:

  1. Validates the chain to a trusted root.
  2. Checks the hostname matches a SAN.
  3. Checks validity dates and revocation status where applicable.
  4. Verifies the CertificateVerify signature — proving the server holds the private key, not just a copy of the public certificate.

This authenticates the ephemeral key exchange and defeats man-in-the-middle attacks.

Revocation

If a private key leaks, its certificate must stop being trusted before it expires.

MechanismHowProblems
CRLCA publishes a list of revoked serial numbersLists grow large; clients download infrequently
OCSPClient asks the CA "is serial X revoked?"Latency, privacy leak (CA sees your browsing), browsers "soft-fail" if unreachable
OCSP staplingServer attaches a fresh signed OCSP response to the handshakeSolves privacy/latency, but uptake was patchy; Let's Encrypt ended OCSP in 2025
Browser-pushed lists (CRLite, CRLSets)Browsers download compressed revocation setsThe current practical approach
Short-lived certificatesCertificates expire within days, limiting exposureThe direction the industry is moving

Certificate Transparency

CAs have been compromised or careless: DigiNotar (2011) issued fraudulent *.google.com certificates used to spy on Iranian users and was removed from all trust stores; Symantec was distrusted in 2018 after repeated mis-issuance.

Certificate Transparency (CT) requires every publicly trusted certificate to be recorded in public, append-only Merkle-tree logs (Hash functions). Browsers reject certificates without signed proofs of logging (SCTs). Domain owners can monitor logs (crt.sh, CT monitors) and spot certificates issued for their domains that they didn't request.

CAA DNS records let domain owners specify which CAs may issue for them.

Mutual TLS and private PKI

  • mTLS: the client also presents a certificate — strong machine identity for service-to-service traffic. Service meshes (Istio, Linkerd) issue short-lived certificates to every workload automatically; SPIFFE/SPIRE standardise workload identity. Also used for IoT devices and B2B APIs.
  • Private/internal CAs: organisations run their own PKI for internal services, VPNs, Wi-Fi (EAP-TLS) and devices — e.g. HashiCorp Vault PKI, AWS Private CA, step-ca. Clients must explicitly trust the internal root.
  • Certificate pinning (hard-coding expected keys in an app) prevents rogue-CA attacks but risks bricking apps when keys rotate; use cautiously, pin to backups, or rely on CT instead.

Operational checklist

  • Automate issuance and renewal (ACME); alert on expiry well in advance.
  • Serve the full chain (leaf + intermediates, not the root).
  • Prefer ECDSA P-256 keys (smaller, faster handshakes), with RSA fallback only if needed for old clients.
  • Protect private keys (file permissions, KMS/HSM, no keys in images or repos); rotate on compromise.
  • Use CAA records and CT monitoring for your domains.
  • For internal services, use mTLS with short-lived certificates rather than long-lived shared secrets.
Key takeaways
  • Certificates bind public keys to identities (SANs) and are signed by certificate authorities.
  • Trust flows from root CAs in OS/browser stores through intermediates to the leaf; servers must send the full chain.
  • DV certificates prove domain control only; the padlock doesn't mean a site is honest.
  • ACME/Let's Encrypt automates free issuance and renewal; lifetimes are getting shorter.
  • In TLS, the server proves key possession by signing the handshake; clients validate chain, hostname and dates.
  • Revocation is weak in practice; short-lived certificates and Certificate Transparency logs provide accountability.
  • mTLS and private CAs give strong service and device identity.