esc
Type to search across all notes

Certificates & PKI

1. What a Certificate Is

A certificate is not a crypto primitive — it’s a standardized way to package a public key with identity + a CA signature:

{ subject, public_key, issuer (CA), validity, CA_signature }

A signed identity card for a public key: “this public key belongs to X, certified by CA.”

  • The certificate contains the public key — never the private key.
  • The private key stays separately, protected by password + custody.

2. The Two Key Pairs

KeyUsed forHeld by
Subject’s public keyverifying data from the subjectinside the cert (published)
CA’s private keysigning the certificatethe CA (secret)
CA’s public keyverifying the cert’s signaturein the CA’s own cert / trust store

A certificate contains a signature made with the CA’s private key — not the subject’s. The subject’s private key is never in the certificate.

3. Certificate Chains

A chain is the signed path from a trusted root down to a leaf certificate:

ROOT CA (self-signed, in your trust store)
   └─ signs → INTERMEDIATE CA
                 └─ signs → SERVER / LEAF cert (e.g. example.com)

Verification walks upward: each cert’s signature is verified with the parent cert’s public key, until reaching a root CA already trusted by the OS/browser.

  • Why chains exist: trust a few root CAs, let them sign intermediates who sign leaf certs — scales to billions of identities.
  • Root CA = self-signed, pre-installed, trusted by default.
  • Intermediate CAs = signed by a root; roots stay offline for security.
  • Missing / expired / revoked link → browser warning.

3.1 Chains Beyond TLS

Chains are a general PKI concept, not browser/server-only:

ContextLeaf cert representsVerifier
HTTPSa web server / domainbrowser
Mutual TLS (mTLS)a client device/servicethe server
Code signinga software vendorOS / device
Email (S/MIME)an individualemail client
VPN / WiFi (EAP-TLS)a user / devicethe server
Secure boot / firmwarea firmware imagedevice bootloader
Enterprise / internal PKIinternal servicescompany-issued trust

Same pattern everywhere: trust anchor → intermediate(s) → leaf, the only difference is what the leaf represents and who verifies it.

4. PKI (Public Key Infrastructure)

PKI is the operational system that makes key trust work at scale — “crypto + policy + processes”:

ComponentRole
CAsTrusted issuers that sign certificates
RAsVerify identity before issuing
Certificates (X.509)Signed identity bindings
CRL / OCSPRevocation of compromised/expired certs
Trust storesRoot CAs your OS/browser already trusts
Key lifecyclegeneration, distribution, renewal, expiry

Primitives = the math; certificate = the format; PKI = the governance — who issues, how trust is established, how keys are revoked.

5. File Formats

Content is either PEM (base64 text) or DER (binary); containers bundle keys + certs.

FormatExtensionContents
PEM (text).pem, .crt, .cer, .key, .pubany cert/key, human-readable -----BEGIN ...-----
DER (binary).der, some .crtraw encoded bytes
PKCS#12.p12, .pfxprivate key + cert chain, password-protected
JKS.jksJava keystore (keys + certs)
PKCS#7.p7b, .p7ccerts only, no private key

Extension ≠ format — a .crt may be PEM or DER; you inspect the content to tell.

6. Password vs Certificate

Two independent protections for two different keys:

ConcernHow handled
Public key trustcertificate + CA signature (proves identity)
Private key secrecypassword-encrypt the key file + physical custody

Certificate vouches for the public key’s identity; a password protects the private key’s file.

7. Key Facts

  • Certificate = public key + identity + CA signature; it never contains the private key.
  • The signature inside a cert is made with the CA’s private key.
  • Certificate chain = signed path from a trusted root to the leaf cert.
  • Chains are used in HTTPS, mTLS, code signing, email, firmware — not TLS only.
  • PKI = CAs, revocation, trust stores, key lifecycle — the governance around certs.
  • Formats: PEM (text) / DER (binary); containers .p12/.pfx, .jks, .p7b.
  • Extension ≠ format — inspect the content.