Public Key Infrastructure and Key Management
Asymmetric cryptography needs a way to know whose public key is whose, and every key needs protection throughout its life. This lesson explains public key infrastructure, certificates and revocation, and the key management lifecycle from generation to destruction.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the components of a PKI.
- Explain certificate validation and revocation.
- Describe the key management lifecycle.
- Explain the role of HSMs and key management services.
Public key infrastructure
Public key infrastructure (PKI) is the set of roles, policies, systems and procedures used to create, manage, distribute, use, store and revoke digital certificates. Its purpose is to bind public keys to identities reliably, so that a browser can trust that a key belongs to a bank's website or a VPN gateway can trust a device. The following list describes its components.
- Certificate authority CA
- Issues and signs certificates after identity verification. A hierarchy has an offline root CA that signs intermediate (issuing) CAs, which sign end-entity certificates.
- Registration authority RA
- Verifies the identity of certificate applicants on behalf of the CA, but does not sign certificates.
- Certificate
- An X.509 document containing the subject's identity, public key, issuer, serial number, validity period, permitted uses and the CA's signature.
- Certificate policy and practice statement CP and CPS
- Documents stating how the CA operates and the assurance its certificates provide.
- Repository
- Where certificates and revocation information are published.
Relying parties validate a certificate by checking its chain of trust up to a root CA they trust (browsers and operating systems ship with trusted root stores), the validity period, that the name matches, the permitted key usage and the revocation status. The root CA is kept offline and heavily protected, because its compromise would undermine every certificate beneath it.
PKI components
Revocation
A certificate is revoked before its expiry when its private key is compromised or suspected to be, the subject's details change, it was issued in error, or the subject no longer needs it. Revocation information is published in two ways. A certificate revocation list (CRL) is a signed list of revoked serial numbers that relying parties download periodically. The Online Certificate Status Protocol (OCSP) lets a relying party query the status of a single certificate in real time; OCSP stapling lets the server attach a recent signed OCSP response to its handshake. Short-lived certificates, valid for days or weeks and renewed automatically, reduce reliance on revocation.
The key management lifecycle
Keys must be protected from creation to destruction. The SSCP outline names eight concepts, set out in the following steps.
-
Generation and composition
Generate keys with a CSPRNG or HSM, using an approved algorithm and length (composition), on the system that will use them where possible so private keys never travel.
-
Exchange and distribution
Share symmetric keys securely, for example with Diffie-Hellman or by encrypting them with the recipient's public key; distribute public keys through certificates.
-
Storage
Store private and secret keys in hardware security modules, TPMs, smart cards or managed key services, protected by access controls; never in source code, scripts or plaintext files.
-
Rotation
Replace keys periodically according to policy (the cryptoperiod) and immediately after suspected compromise, re-encrypting data or re-issuing certificates as needed.
-
Revocation
Withdraw trust in compromised or retired keys and their certificates through CRLs or OCSP.
-
Escrow and recovery
Keep copies of keys with a trusted party or key recovery agent, under dual control, so that encrypted data can be recovered if a user leaves or a key is lost.
-
Destruction
Securely delete keys at the end of their life, including copies and backups; destroying a key makes data encrypted with it unrecoverable (crypto-shredding).
Two further principles protect the most critical keys: split knowledge, in which no single person knows the whole key, and dual control, in which two or more people must act together to use or recover it, as in a root CA key ceremony.
The following diagram compares encrypting project archives with a personal key and with an organisation-managed key.

The key lifecycle
Hardware security modules and key management services
A hardware security module (HSM) is a tamper-resistant device that generates and stores keys and performs cryptographic operations internally, so that private keys never leave it in plaintext. HSMs protect CA keys, payment keys, database encryption keys and token-signing keys, and are validated against FIPS 140-3. Cloud providers offer key management services and cloud HSMs; with customer-managed keys, the customer controls key policy and rotation, and with bring-your-own-key or hold-your-own-key models, even more control remains with the customer.
HSMs and key services
A compromised private key
A web server's TLS private key is found in a public code repository. What should be done?
Treat the key as compromised. Generate a new key pair (preferably in a protected key store), obtain and install a new certificate, revoke the old certificate so that relying parties reject it, remove the key from the repository and its history, investigate how it was exposed and whether it was used, and add secret scanning to the development pipeline. Simply deleting the file is not enough.
The departed engineer
An engineer who encrypted project archives with a personal key has left the company, and the archives cannot be opened. What key management control would have prevented this?
Key escrow or key recovery: keys used for organisational data should be issued and managed by the organisation, with recovery copies held under dual control, so that data can be decrypted when an employee leaves. Policy should forbid encrypting company data with unmanaged personal keys.
What is the difference between a CRL and OCSP?
Show answer
A CRL is a signed list of revoked certificates that relying parties download periodically; OCSP lets them query the status of one certificate in real time.
Exam Tips
Remember for the exam
- The CA signs certificates; the RA verifies identities; keep the root CA offline.
- Revoke compromised certificates at once; CRLs are lists, OCSP is a real-time query.
- Store keys in HSMs or key services; use split knowledge and dual control for critical keys.