Professor Franklin
Accessibility settings

Preferences are saved in this browser when storage is available.

Getting Started

Chapter 7 · Reading 5 of 6

Designing key custody with HSM, TPM and KMS

Security+ SY0-801 · Objectives 1.3, 3.3

A backup operator can copy an encrypted archive. A reporting application can ask a service to unwrap its data key. A custodian can change who may make that request. Which of these people could expose a record? The answer depends on how their permissions combine.

Place the key where the trust decision happens

A hardware security module (HSM) is a tamper-resistant device that protects keys and performs controlled cryptographic operations inside a defined hardware boundary. A certificate authority may require two custodians to authorize sensitive administrative operations while permitting a tightly scoped service to request signatures. An HSM reduces opportunities to extract private key material. A compromised application with unrestricted signing access can still request harmful signatures. Review who may invoke each operation.

A PCI Express card with a blue heat sink and the nCipher name printed on it.
Figure 1. An nCipher nShield F3 hardware security module. The PCIe card keeps keys inside its tamper-resistant boundary and performs signing for the host.Photo: Alexander Klink, Wikimedia Commons, CC BY 3.0. Resized from the original.

A Trusted Platform Module (TPM) is a chip attached to a particular platform. It can protect device-bound keys and seal access to expected platform measurements. A disk protected with a TPM may require a recovery credential after a legitimate firmware update changes measurements. Plan recovery before replacing the system board. Attestation can give a verifier signed evidence of measured state, but the verifier still needs a trustworthy baseline and a policy decision.

Figure 2. HSM, TPM and KMS compared
HSM
Tamper-resistant device that keeps keys inside a hardware boundary.
Example: the CA’s signing key, with two custodians for admin tasks.
TPM
Chip bound to one platform. Seals keys to expected boot measurements.
Example: a laptop’s disk encryption key.
KMS
Service interface for creating, granting, rotating, auditing and retiring keys. May use HSMs underneath.
Example: the reporting application’s data keys.

Separate custody from service management

A key management service (KMS) provides an interface for creation, access policy, rotation, audit and retirement. Its implementation may use HSMs. In envelope encryption a data encryption key (DEK) encrypts an object. A key encryption key (KEK) wraps that data key. Store the wrapped data key and key identifier with the ciphertext. Restrict unwrapping and monitor the identity, purpose and volume of calls. A copied encrypted archive and an overprivileged service identity together can defeat an otherwise sound design.

Figure 3. Envelope encryptionTo read the archive, an identity needs both the stored object and permission to unwrap the data key.
Key management service
  • Key encryption key (KEK). Never leaves the service
  • Unwrap requests logged: identity, purpose, volume

Only an authorized identity can ask the KMS to unwrap the data key.

Storage: stored together
  • Ciphertext, encrypted with the data key (DEK)
  • Wrapped DEK
  • Key identifier and version

The backup operator can copy everything in storage and still read nothing. A service identity with unwrap rights and a copy of the archive can read everything.

A secure enclave is a protected area of a processor that isolates sensitive code and keys from the rest of the system, as on many phones. Key escrow stores a copy of a key with a trusted party so data can be recovered if the original is lost. Escrow aids recovery but creates another place the key can be stolen. During key rotation, distinguish new writes from existing ciphertext. New writes can use the replacement key immediately while old records still depend on the previous version. Rewrapping data keys may avoid bulk decryption of archives. Before disabling a key, restore a sample from each backup generation and verify recovery authorization. Premature deletion can make data permanently inaccessible. Retaining a key indefinitely can undermine a disposal commitment.

NIST key management guidance

Rehearse a key loss before it happens

Choose an older synthetic archive and identify its key version. Have the designated recovery role restore it while the normal reporting role is disabled. Document which service, identity and approval the operation required. A successful restore proves that the recovery path works for that generation. A failed restore can reveal a retired key, missing grant or dependency on the very service you are recovering.

Review the audit record from both sides. The storage system can confirm an object read, while the key service can confirm an unwrap. Each observation becomes more useful when you know what the other system saw. In some business processes the next improvement is to avoid circulating the original sensitive value at all. The final reading in this chapter, Tokenization, masking and steganography, explores that option.

Envelope decryption path

Inspect the three records, then use the evidence to answer the question.

1. Object store

Archive contains ciphertext and a wrapped data key.

2. Key service

Key service grants the reporting role permission to unwrap.

3. Audit log

Retired reporting role still appears in grant K17.

Apply the reading

Why can rotation break a restore from an older backup?

Compare your reasoning

Older ciphertext may still depend on a previous key version. Test recovery before disabling or destroying it.