Time: 50 minutes | Level: Architect | Docker: docker run -it --rm ubuntu:22.04 bash
Design a 3-tier PKI hierarchy (Root → Intermediate → Issuing CA)
Build and verify a real certificate chain with OpenSSL
Understand CRL vs OCSP and OCSP stapling
Apply SPIFFE/SPIRE for workload identity
Step 1: 3-Tier PKI Hierarchy
Copy ┌────────────────────────────────────────────┐
│ ROOT CA (Offline) │
│ - Self-signed, 20-year validity │
│ - Stored in HSM, air-gapped │
│ - Only signs Intermediate CA certs │
│ - Key ceremony required to use │
└──────────────────┬─────────────────────────┘
│
┌──────────────────▼─────────────────────────┐
│ INTERMEDIATE CA (Online/Offline) │
│ - Signed by Root CA, 10-year validity │
│ - Can be taken offline for security │
│ - Only signs Issuing CA certs │
└──────────────────┬─────────────────────────┘
│
┌──────────────────▼─────────────────────────┐
│ ISSUING CA (Online, 24/7) │
│ - Signed by Intermediate CA │
│ - 5-year validity │
│ - Issues end-entity certificates │
│ - Runs CRL/OCSP responder │
└──────────────────┬─────────────────────────┘
│
End-Entity Certificates
(TLS, Code Signing, Client Auth, Email) Why 3 tiers?
Root CA offline = impossible to compromise without physical access
Intermediate CA revocation doesn't invalidate all end-entity certs
Issuing CA can be region/purpose-specific without changing root trust
Step 2: Build 3-Tier PKI with OpenSSL
📸 Verified Output:
Step 3: Certificate Types
Step 4: CRL vs OCSP vs OCSP Stapling
CRL (Certificate Revocation List):
Periodic publication of revoked certificate serial numbers
Client downloads CRL file (can be large, MB-sized)
Latency: up to CRL validity period (24-72 hours)
Suitable for: infrequent revocation, offline environments
OCSP (Online Certificate Status Protocol):
Real-time query: "Is cert #1234567 still valid?"
Response: good / revoked / unknown
Latency: network round-trip to OCSP responder
Privacy concern: OCSP responder knows which sites you visit
OCSP Stapling:
Server pre-fetches OCSP response and includes in TLS handshake
Client doesn't need separate OCSP request
Signed by CA — client can verify offline
Best practice for all modern TLS deployments
Step 5: HSM (Hardware Security Module)
HSM roles in PKI:
Stores private keys in tamper-resistant hardware
Key material never leaves HSM in plaintext
Performs cryptographic operations (sign/verify) inside HSM
FIPS 140-2 Level 3 required for Root/Intermediate CA keys
HSM options:
💡 Root CA key ceremony : Formal, witnessed procedure to generate Root CA keys. Involves: multiple key custodians (M-of-N access), auditor, video recording, Faraday cage, offline air-gapped workstation. Documented with chain-of-custody forms.
Step 6: Certificate Lifecycle Automation
Manual certificate management problems:
Expired certificates → service outages
Lost private keys → re-issuance delays
Untracked certificates → shadow IT
Certificate automation options:
ACME protocol : Let's Encrypt, ZeroSSL — automated renewal
cert-manager (Kubernetes): automatic cert provisioning/renewal
Venafi / CertCentral : enterprise certificate lifecycle management
AWS ACM : managed TLS certs for AWS services
cert-manager workflow:
Step 7: SPIFFE / SPIRE (Workload Identity)
Problem : How do microservices prove their identity to each other without managing certificates manually?
SPIFFE (Secure Production Identity Framework for Everyone):
Standard for workload identity: spiffe://trust-domain/path/service-name
SVID (SPIFFE Verifiable Identity Document): X.509 cert or JWT
Workload API: local socket, no secrets stored in environment vars
SPIRE (SPIFFE Runtime Environment):
Step 8: Capstone — Enterprise PKI Design
Scenario: Design PKI for 10,000-employee enterprise with cloud + on-prem