
Table of Contents
By Khimananda Oli | Last reviewed: August 2026
Public Key Infrastructure (PKI) explained correctly is the difference between a secure production environment and a compliance failure waiting to happen. Most teams treat certificates as an afterthought until a renewal breaks their API or an auditor flags expired intermediates. Understanding PKI as a system of trust, not just file generation, is essential for any engineer managing SSL certificates on Ubuntu servers or designing cloud-native authentication.
What are the core components of Public Key Infrastructure (PKI) explained?
PKI is not a single tool but a collection of interdependent components that establish cryptographic trust. In practice, you interact with five distinct elements daily. Missing any one creates either a security gap or an operational outage.
- Certificate Authority (CA): The trusted entity that issues and signs digital certificates. Production PKI always separates the offline Root CA from online Intermediate CAs to limit blast radius if the issuer is compromised.
- Registration Authority (RA): Validates identity requests before the CA issues certificates. In automated environments like Kubernetes, this role is often filled by cert-manager or SPIRE acting as policy enforcers.
- Certificate Database: Stores issued certificate metadata, serial numbers, and revocation status. For audit-ready infrastructure, this database must be immutable and backed up separately from the CA signing keys.
- Revocation Mechanism: Either Certificate Revocation Lists (CRL) or Online Certificate Status Protocol (OCSP) responders. Modern deployments increasingly use OCSP stapling to avoid client-side latency during TLS handshakes.
- Key Management System: Hardware Security Modules (HSM) or cloud KMS for protecting CA private keys. Never store CA private keys on general-purpose servers; this is the most common PKI failure I see in audits.
These components form the trust anchor for everything from browser padlocks to Kubernetes secrets management. When designing PKI, start with the threat model: who needs to trust whom, and what happens when that trust breaks?
How does the certificate lifecycle work in production PKI?
The certificate lifecycle is where most PKI implementations fail. Teams generate certificates correctly but neglect rotation, monitoring, and revocation. A complete lifecycle has six mandatory phases, each requiring automation.
- Request Generation: Create a Certificate Signing Request (CSR) with correct Subject Alternative Names (SANs). Wildcard certificates should be avoided in favor of specific SANs for better security boundaries.
- Identity Validation: The RA verifies domain ownership (DCV), organization details, or workload identity. For internal services, validate against service mesh SPIFFE IDs rather than DNS names.
- Certificate Issuance: The Intermediate CA signs the CSR. Set validity periods based on risk: 90 days for public-facing TLS, 1 year for internal mTLS, never more than 13 months per CA/Browser Forum baseline requirements.
- Distribution & Installation: Deploy certificates atomically with zero-downtime reloads. Use configuration management or GitOps to prevent drift between intended and actual certificate state.
- Monitoring & Renewal: Alert at 30, 14, and 7 days before expiry. Automate renewal triggers at 30% of certificate lifetime remaining. Integrate with Prometheus metrics monitoring to track certificate expiry as a first-class SLI.
- Revocation & Retirement: Revoke certificates immediately upon key compromise or decommissioning. Publish updated CRLs within 4 hours and ensure OCSP responders have less than 5-minute staleness.
# Generate ECDSA P-256 CSR with explicit SANs (no wildcard)
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:P-256 \
-nodes -keyout api.example.com.key \
-out api.example.com.csr \
-subj "/CN=api.example.com" \
-addext "subjectAltName=DNS:api.example.com,DNS:api-v2.example.com"
# Verify CSR contents before submission
openssl req -in api.example.com.csr -noout -text -verify In my experience helping Nepali fintech companies achieve SOC 2 compliance, automated lifecycle management was the single biggest factor in passing audits. Manual certificate handling inevitably leads to expired intermediates breaking payment gateways during peak transaction hours.
Private CA vs Public CA: which should you choose for internal services?
This decision determines your operational overhead, security posture, and compliance trajectory. There is no universal best choice; the right answer depends entirely on your trust boundary and client ecosystem.
| Criteria | Public CA (Let's Encrypt, DigiCert) | Private CA (Vault, Smallstep, AWS PCA) |
|---|---|---|
| Trust Scope | Global browsers and OS trust stores | Internal systems only; requires custom trust distribution |
| Validation | DNS/HTTP DCV; OV/EV requires legal verification | Custom policies: SPIFFE ID, IAM role, LDAP group |
| Certificate Lifetime | Max 90 days (Let's Encrypt) to 13 months (commercial) | Flexible: hours for ephemeral workloads, years for legacy |
| Revocation Speed | CRL/OCSP propagation delays (hours to days) | Near-instant via short-lived certs or internal OCSP |
| Operational Cost | Free (ACME) to $$/cert/year (commercial) | HSM + HA infrastructure + engineering time |
| Compliance Fit | PCI-DSS external facing; limited for SOC 2 internal controls | SOC 2, ISO 27001, HIPAA internal mTLS and workload identity |
| Best For | Public websites, SaaS APIs, B2C applications | Microservices mTLS, VPN, IoT, internal dashboards, CI artifacts |
For Nepal-based companies serving local customers while integrating global payment processors, I typically recommend a hybrid approach: public CA for customer-facing endpoints and private CA for backend service-to-service communication. This satisfies both PCI-DSS external requirements and internal zero-trust architecture without over-engineering either layer.
How do you implement PKI automation with cert-manager and Vault?
Manual PKI operations don't scale and introduce human error. Modern implementations treat certificates as derived state, not static assets. Here's a production-grade pattern using cert-manager with HashiCorp Vault as the CA backend.
# Install cert-manager with Vault issuer support
helm install cert-manager jetstack/cert-manager \
--namespace cert-manager --create-namespace \
--set installCRDs=true \
--version v1.16.3
# Configure Vault PKI secrets engine (run once)
vault secrets enable -path=pki pki
vault secrets tune -max-lease-ttl=87600h pki
vault write pki/root/generate/internal \
common_name="internal.example.com" ttl=87600h
vault write pki/config/urls \
issuing_certificates="https://vault.internal:8200/v1/pki/ca" \
crl_distribution_points="https://vault.internal:8200/v1/pki/crl"
# Create intermediate CA signed by root
vault secrets enable -path=pki_int pki
vault secrets tune -max-lease-ttl=43800h pki_int
vault write pki_int/intermediate/generate/internal \
common_name="internal.example.com Intermediate" | vault write pki/root/sign-intermediate -
# Kubernetes Certificate resource (GitOps-managed)
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: api-server-cert
spec:
secretName: api-server-tls
duration: 2160h # 90 days
renewBefore: 720h # renew at 30 days remaining
privateKey:
algorithm: ECDSA
size: 256
dnsNames:
- api.internal.example.com
issuerRef:
name: vault-internal-issuer
kind: ClusterIssuer This pattern ensures certificates are version-controlled, automatically rotated, and observable. Pair it with Prometheus Alertmanager rules that fire when certificate expiry drops below your renewal threshold or when ACME/Vault API errors exceed baseline rates.
What PKI mistakes cause security failures and audit findings?
After reviewing dozens of PKI implementations across AWS, Azure, and on-premises environments, these five mistakes appear consistently. Each represents a gap between theoretical PKI knowledge and production reality.
- Storing CA private keys on disk: Even encrypted PEM files on general-purpose servers violate SOC 2 CC6.1 and ISO 27001 A.10.1. Use HSMs or cloud KMS exclusively. If you can
catyour CA key, you've already failed. - Ignoring intermediate certificate chains: Servers configured with only the leaf certificate cause intermittent TLS failures on Android and older Java clients. Always bundle the full chain including intermediates.
- Over-relying on wildcard certificates: A single compromised wildcard key exposes every subdomain. Use specific SANs and automate issuance; the marginal convenience isn't worth the blast radius.
- No revocation testing: Teams configure CRL/OCSP but never test failover. Simulate responder outages quarterly; many clients silently ignore revocation checks when endpoints timeout, creating false security.
- Treating PKI as set-and-forget: Cryptographic algorithms deprecate. SHA-1 was acceptable in 2016; today it triggers browser warnings. Audit cipher suites and key lengths annually against NIST SP 800-52 Rev 2 guidelines.
For teams pursuing compliance, document your PKI architecture decisions in the same repository as your infrastructure code. Auditors want to see evidence of intentional design, not just working configuration. This aligns with practices covered in automating SOC 2 compliance evidence.
Implementing Production-Grade PKI
Public Key Infrastructure (PKI) explained properly gives you the mental model to build systems that survive both traffic spikes and compliance reviews. Start by mapping your trust boundaries, choose public or private CA accordingly, and automate every lifecycle stage before connecting production workloads. Monitor certificate health with the same rigor as application latency. If your PKI requires manual intervention more than once per quarter, it's not production-ready. Need help designing or auditing your PKI for SOC 2, ISO 27001, or zero-trust migration? Get in touch to discuss your specific architecture.