Ashari Abidin's Developer Docs

Public Key Infrastructure (PKI)

Public Key Infrastructure (PKI)

Detailed Infrastructure Explanation β€” Trust, Encryption & Digital Identity

PKI is the backbone of modern cybersecurity: authentication, encryption, non-repudiation, and integrity across digital ecosystems.

● 1. Definition of PKI

Public Key Infrastructure (PKI) is a comprehensive security framework used to:

  • Manage digital identities
  • Secure communications
  • Perform encryption & ensure data integrity
  • Authenticate systems and users
  • Support digital signatures & non-repudiation

PKI operates using public keys, private keys, digital certificates, and Certificate Authorities (CA). Primary objectives: establish trust between systems, prevent impersonation attacks, protect data in transit, and enable non-repudiation.

● 2. Basic Cryptography Concepts in PKI

πŸ” Asymmetric Encryption

Each entity owns a public key (shared) and a private key (secret).

encryption flow Sender encrypts with recipient’s public key β†’ only recipient's private key decrypts.

Sender β†’ [Recipient Public Key] β†’ Encrypted Data β†’ Recipient (Private Key) β†’ Decrypted

✍️ Digital Signatures

Sender signs data using private key β†’ receiver verifies signature with sender’s public key.

Benefits: data integrity, sender authenticity, non-repudiation.

Document β†’ Hash β†’ Sign (Private Key) β†’ Signature β†’ Verify (Public Key) βœ…

● 3. Core Components of PKI

A. Certificate Authority (CA)

Trust anchor responsible for issuing digital certificates, validating identities, and signing certificates.

  • Root CA: highest trust, self-signed, kept offline. If compromised β†’ entire trust collapses.
  • Intermediate CA: reduces Root CA exposure, delegates issuance.
πŸ”’ Root CA β†’ πŸ“œ Intermediate CA β†’ 🌐 Server Certificate

B. Registration Authority (RA)

RA validates identities (domain ownership, company verification, email control) before certificates are issued. Acts as identity verification layer for the CA.

C. Digital Certificate (X.509)

Electronic identity document: contains Subject Name, Public Key, Issuer, Expiration, Serial Number, Key Usage.

CN=api.company.com O=Company Indonesia Issuer=Intermediate CA (example)

Proves identity, carries public key, establishes trust relationships.

πŸ“’ Public Key

Shared openly, used for encryption & signature verification. Must be associated with a trusted identity via a certificate.

-----BEGIN PUBLIC KEY----- MIIBIjANBgkqh... -----END PUBLIC KEY-----

πŸ—οΈ Private Key (Critical Asset)

Highly confidential β€” decrypts data & generates signatures. Stored in HSMs / vaults. Compromise = identity impersonation.

F. Certificate Revocation

Reasons: key compromise, breach, employee resignation. Methods:

  • CRL (Certificate Revocation List) – published list, can become large, not real-time.
  • OCSP (Online Certificate Status Protocol) – real-time status checking: β€œIs this certificate still valid?” β€” faster & modern.

● 4. Certificate Lifecycle

1. Key Generation
Generate keypair (OpenSSL/HSM).
2. CSR Creation
openssl req -new -key server.key -out server.csr
3. Validation (CA/RA)
Domain/organization verification.
4. Certificate Issuance
CA signs: Certificate = Public Key + Identity + CA Signature.
5. Deployment
Web servers, load balancers, K8s ingresses.
6. Renewal
90d β€” 2y, prevents outages.
7. Revocation
Immediate if compromise.

● 5. Trust Chain

Browsers validate certificate chain from server cert β†’ Intermediate CA β†’ Root CA (trusted store).

πŸ” Server Certificate βž” πŸ›οΈ Intermediate CA βž” 🏰 Root CA (Trusted)

If chain invalid β†’ security warnings. Trust chain ensures hierarchical trust.

● 6. PKI in Modern Infrastructure

🌐 HTTPS / TLS
Encryption + website authentication. TLS handshake uses server certificates.
🀝 Mutual TLS (mTLS)
Client & server authenticate each other. Used in banking, microservices, Zero Trust.
πŸ”’ VPN Infrastructure
OpenVPN, IPSec β€” device/user authentication via certificates.
☸️ Kubernetes
API server auth, node auth, etcd encryption, ingress TLS.
πŸ”‘ SSH Infrastructure
Public key auth β†’ more secure than passwords, automation ready.
πŸ“§ Email Security (S/MIME)
Email encryption & signing.
πŸ“¦ Code Signing
Sign software packages, ensure integrity (Windows, Android, Apple).

● 7. Hardware Security Module (HSM)

HSM is specialized hardware for secure private key storage and cryptographic operations. Keys never leave the device. Used by banks, governments, enterprise PKI.

Examples: AWS CloudHSM, Thales, YubiHSM.

● 8. Enterprise PKI Best Practices

πŸ” Security
Keep Root CA offline, use HSMs, RSA 2048+ / ECC, SHA-256+.
βš™οΈ Operational
Certificate inventory, monitor expirations, automate renewals, backup keys.
πŸ“‹ Governance
Issuance SOPs, strict access controls, audit logs, dual authorization.
πŸ›οΈ Architecture
Separate Root CA, Intermediate CA, Issuing CA.

● 9. PKI Risks

  • Private Key Compromise β†’ identity impersonation, MiTM.
  • Expired Certificates β†’ website downtime, API failures.
  • Weak Algorithms (SHA-1, RSA 1024) β†’ deprecated & insecure.
  • Rogue or Compromised CA β†’ fake certificates, global trust damage.

● 10. PKI and Zero Trust

β€œNever trust, always verify.” PKI delivers identity verification, device & service authentication, mTLS enforcement. Essential for service mesh (Istio), SASE, cloud-native platforms.

● 11. Common PKI Technologies & Tools

Open Source
OpenSSL, EasyRSA, CFSSL, Vault (HashiCorp), Step-CA.
Enterprise Platforms
Microsoft AD CS, AWS Certificate Manager, DigiCert, Entrust, Keyfactor.

● 12. Example Enterprise PKI Architecture

Offline Root CA β†’ Intermediate CA β†’ Issuing CA Cluster
β”‚ β”‚ β”‚
β–Ό β–Ό β–Ό
[Secure Vault] [Web TLS Certs] [VPN/User certs]
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Load Balancer / Firewall

● 13. Real-World Use Cases

🏦 Banking
Mutual TLS APIs, HSM-protected signing, secure transaction signing.
πŸ›οΈ Government
Electronic signatures, digital identity, e-KYC systems.
βš•οΈ Healthcare
Secure medical records, device authentication.
πŸš€ SaaS Startups
HTTPS infrastructure, K8s Ingress TLS, mTLS service mesh.

● 14. Conclusion: PKI as Critical Foundation

PKI is fundamental to modern cybersecurity. It enables trusted identity, strong encryption, authentication, digital signatures, and secure infrastructure communication. Without PKI, HTTPS wouldn't be trusted, mTLS would not function, digital signatures would fail, and Zero Trust architectures would collapse.

PKI is not just about certificates β€” it’s an entire ecosystem involving governance, cryptography, key management, operational security, and trust architecture.

βœ”οΈ Encryption | βœ”οΈ Authentication | βœ”οΈ Non-Repudiation | βœ”οΈ Data Integrity

πŸ“Œ Quick Recap β€” PKI Core Flow

πŸ“„ Plaintext πŸ” Encrypt (Public Key) πŸ“¦ Ciphertext πŸ”“ Decrypt (Private Key) πŸ“„ Plaintext
✍️ Sign (Private Key) βœ”οΈ πŸ“‘ Signature πŸ”Ž Verify (Public Key) βœ… Authentic
Back