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
| Key | Used for | Held by |
|---|---|---|
| Subject’s public key | verifying data from the subject | inside the cert (published) |
| CA’s private key | signing the certificate | the CA (secret) |
| CA’s public key | verifying the cert’s signature | in 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:
| Context | Leaf cert represents | Verifier |
|---|---|---|
| HTTPS | a web server / domain | browser |
| Mutual TLS (mTLS) | a client device/service | the server |
| Code signing | a software vendor | OS / device |
| Email (S/MIME) | an individual | email client |
| VPN / WiFi (EAP-TLS) | a user / device | the server |
| Secure boot / firmware | a firmware image | device bootloader |
| Enterprise / internal PKI | internal services | company-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”:
| Component | Role |
|---|---|
| CAs | Trusted issuers that sign certificates |
| RAs | Verify identity before issuing |
| Certificates (X.509) | Signed identity bindings |
| CRL / OCSP | Revocation of compromised/expired certs |
| Trust stores | Root CAs your OS/browser already trusts |
| Key lifecycle | generation, 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.
| Format | Extension | Contents |
|---|---|---|
| PEM (text) | .pem, .crt, .cer, .key, .pub | any cert/key, human-readable -----BEGIN ...----- |
| DER (binary) | .der, some .crt | raw encoded bytes |
| PKCS#12 | .p12, .pfx | private key + cert chain, password-protected |
| JKS | .jks | Java keystore (keys + certs) |
| PKCS#7 | .p7b, .p7c | certs 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:
| Concern | How handled |
|---|---|
| Public key trust | certificate + CA signature (proves identity) |
| Private key secrecy | password-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.