PKI and Certificates

Understand certificate authorities, chains of trust, X.509 fields, revocation and how certificates are issued and managed.

Intermediate · about 4 hours · difficulty 3/5

Learn first: Symmetric and Asymmetric Encryption, TLS and Encryption in Transit

Public-key crypto has one big question: how do you know a public key really belongs to the site or person you think? Public Key Infrastructure (PKI) answers it with certificates signed by trusted authorities.

Certificates

An X.509 certificate binds a public key to an identity. Key fields: subject, Subject Alternative Names (the hostnames it is valid for), issuer, validity dates, key usage and the issuer's signature.

Chain of trust

Browsers and operating systems ship with a set of trusted root CAs. Roots sign intermediate CAs, which sign leaf certificates for sites. Your client walks from the leaf to a trusted root and checks every signature. Missing intermediates are a common misconfiguration.

Issuance and lifecycle

  • Let's Encrypt and the ACME protocol made free, automated certificates normal. Short lifetimes are pushing everyone toward automation.
  • Revocation via CRLs and OCSP handles compromised keys, though browsers handle it imperfectly.
  • Certificate Transparency logs publicly record issued certificates, helping detect mis-issuance (and helping recon, since subdomains appear there).

Internal PKI

Companies run private CAs (for example Active Directory Certificate Services) for internal services, VPNs, Wi-Fi and device identity. Misconfigured certificate templates in AD CS are a well-known escalation path, so they get audited.

Pitfalls

  • Letting certificates expire; outages from expired certs are extremely common.
  • Protecting the private key poorly. Whoever has the key can impersonate the service.

Move on when you can read a certificate with openssl x509 -text, explain each field, and set up automatic renewal for a test domain.

Key concepts

  • X.509 fields and SANs
  • Root, intermediate and leaf CAs
  • Let's Encrypt and ACME
  • Revocation: CRL and OCSP
  • Certificate Transparency
  • Internal PKI and AD CS

Mini project

Create a private root CA with openssl, issue a certificate for a local test site, trust the root on your machine and confirm the browser accepts it.

Check yourself

What happens during validation if a server sends its leaf certificate but not the intermediate?

Free resources