Key inventories KMS and HSM
Know what each key protects
A key inventory records identifier, algorithm and purpose, owner, usage permissions, state, creation and rotation dates, protected objects, and recovery obligations. Do not store raw key material in the inventory. Separate signing, encryption and verification roles. An inactive encryption key may still be required for older ciphertext; a revoked signing key has a different verification and incident-response lifecycle.
KMS versus HSM
A key management service (KMS) provides managed operations and policy enforcement across a key lifecycle. A hardware security module (HSM) provides a protected cryptographic boundary for key generation, storage and operations. A KMS may use HSMs internally; the names are not interchangeable. An authorized application can still misuse permitted operations, so limit key actions by workload and purpose, audit use, and separate administration from use.
Envelope encryption
Use an established envelope-encryption library or service. A data encryption key (DEK) protects the object with authenticated encryption; a key encryption key (KEK) protects the DEK. Store ciphertext, wrapped DEK, algorithm version and key identifier, plus required non-secret nonce and metadata. The unwrap operation needs authorization; the plaintext DEK has a short lifetime in the workload. Rewrapping a DEK changes its wrapping protection but does not replace the DEK or undo past exposure.
Rotate and recover deliberately
Suppose K1 protected 300 retained objects and K2 is approved for new writes. Direct new writes to K2 while retaining authorized old reads through K1 until migration or retention obligations are satisfied. Measure remaining dependencies and rehearse recovery with test data before disabling K1. A compromised key requires incident-specific containment and replacement rather than ordinary scheduled rotation. Recovery requirements differ for encryption and signing keys; avoid unnecessary copies.
Practice: retirement evidence
Use the toy retirement cases to distinguish rotate, disable and destroy. Require an owner, zero remaining dependencies, resolved retention obligations and a successful recovery drill before the toy model approves destruction. Record the decision, independent approver and evidence without key bytes. Consult NIST SP 800-57 Part 1 Rev. 5 (2020) as a selected edition and service-specific KMS guidance; validate current requirements before production use.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Key inventories KMS and HSM — knowledge check
Apply password, certificate and key lifecycle principles to fictional scenarios.
What does the DEK protect in envelope encryption?
What belongs in a key inventory?
How do KMS and HSM differ?
What does rewrapping a DEK not accomplish?
When should the classroom model approve key destruction?