Public Key Infrastructure

Secure digital communication through cryptographic keys and digital certificates

🎯 Theory & Fundamentals

Public Key Infrastructure (PKI) is a framework that manages digital keys and certificates to enable secure communication, authentication, and data integrity in digital environments.

🔑 Key Concepts

  • Public Key Cryptography: Asymmetric encryption using key pairs
  • Digital Certificates: Bind public keys to identities
  • Certificate Authority (CA): Trusted third party that issues certificates
  • Trust Chain: Hierarchical trust model

🏗️ PKI Components

  • Root CA: Ultimate trust anchor
  • Intermediate CA: Delegated certificate issuer
  • Registration Authority (RA): Validates certificate requests
  • Certificate Repository: Stores issued certificates

🔄 Certificate Lifecycle

  • Generation: Create key pair and certificate request
  • Issuance: CA signs and issues certificate
  • Distribution: Certificate made available
  • Revocation: Certificate invalidated if compromised

🏗️ Certificate Chain of Trust

👑
Root CA
Self-signed
→
🏢
Intermediate CA
Signed by Root
→
📄
End Entity
Signed by Intermediate

⚙️ Implementation

🛠️ Key Generation

# Generate RSA private key
openssl genrsa -out private.key 2048

# Extract public key
openssl rsa -in private.key -pubout -out public.key

# Generate EC private key
openssl ecparam -genkey -name prime256v1 -out ec_private.key

📋 Certificate Request

# Create certificate signing request
openssl req -new -key private.key -out certificate.csr \-subj
"/C=US/ST=CA/L=SF/O=MyOrg/CN=
example.com"

# View CSR details
openssl req -text -noout -in certificate.csr

🏭 Certificate Issuance

# Self-signed certificate
openssl x509 -req -in certificate.csr -signkey private.key \ -out certificate.crt -days 365

# CA-signed certificate
openssl x509 -req -in certificate.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out certificate.crt -days 365

🛡️ Security Aspects

Security Strength Assessment

Analyzing security parameters...

🔐 Key Security

  • Key Length: RSA 2048+ bits, EC 256+ bits
  • Key Storage: Hardware Security Modules (HSM)
  • Key Rotation: Regular key replacement
  • Key Escrow: Secure key backup and recovery

📜 Certificate Security

  • Validity Period: Limited certificate lifetime
  • Revocation: CRL and OCSP mechanisms
  • Extensions: Key usage and constraints
  • Transparency: Certificate transparency logs

⚠️ Common Vulnerabilities

  • Weak Keys: Insufficient key length or entropy
  • CA Compromise: Root or intermediate CA breach
  • Certificate Pinning: Bypass attacks
  • Side-channel: Timing and power analysis

🌍 Real-World Applications

🌐 HTTPS/TLS

Secure web communication using SSL/TLS certificates to encrypt data between browsers and servers. Every https:// website uses PKI.

📧 Email Security

S/MIME certificates for email encryption and digital signatures. Ensures email authenticity and confidentiality.

📱 Code Signing

Digital signatures for software authenticity. App stores use code signing certificates to verify developer identity.

🏛️ Document Signing

Digital signatures for legal documents, contracts, and official communications. Provides non-repudiation.

🔐 VPN Authentication

Certificate-based authentication for VPN connections. More secure than password-based authentication.

💳 Smart Cards

PKI certificates stored on smart cards for physical access control and secure authentication.

🚀 Interactive PKI Demo

Experience PKI concepts with hands-on demonstrations

🔑 Key Generation Demo

Generated keys will appear here...

📜 Certificate Demo

Generated certificate will appear here...

🔐 Encryption Demo

Encrypted/decrypted message will appear here...

✍️ Digital Signature Demo

Signature verification results will appear here...