What it means
Encryption moves the problem of protecting data to the problem of protecting keys. Key management is everything that happens to a key over its life. It is generated from good randomness and stored where few can reach it. It is given only to the systems that need it and replaced on a schedule. It is destroyed when nothing depends on it. Many systems use two layers. A data encryption key protects the data, and a key encryption key wraps the data key. Losing a key loses the data it protects. Leaking a key exposes that data. Both failures are management failures, not failures of the cipher.
See the idea / Data
Destroy a key only after nothing still needs it.
Follow one key rotation. New data uses the new version at once. Old data depends on the old version until its data key is re-wrapped.
Meridian’s telemetry archive uses envelope encryption. Each archive has its own data encryption key, or DEK. A key encryption key, or KEK, wraps each DEK. Wrapping means encrypting a key. Kael rotates the KEK from version 1 to version 2. Archive A-2025 was written under version 1. Compare re-wrapping its DEK before version 1 is destroyed with destroying version 1 first.
01 / 04
Rotate
Kael rotates the KEK. New data now uses version 2. Archive A-2025 has not changed, so it still needs version 1 to open.
More about this step
Until now one KEK version wraps the data key of A-2025. The DEK is stored next to the archive in wrapped form, and the key service unwraps it with version 1 to read the archive. Rotation adds version 2 and makes it current. It does not touch earlier data. Version 1 stays enabled so that old wrapped keys can still be unwrapped. This is the state many systems stay in for years.
Step through at your own pace.
Keep in mindOne KEK, two versions and one archive. Real key services differ in how they rotate, disable and destroy keys, and many add a waiting period before destruction. Key generation, access rules, distribution, protected copies of keys and the response to a stolen key are also part of key management and are not shown.
Read the visual, step by step
Re-wrap first
- Rotate. Kael rotates the KEK. New data now uses version 2. Archive A-2025 has not changed, so it still needs version 1 to open. Until now one KEK version wraps the data key of A-2025. The DEK is stored next to the archive in wrapped form, and the key service unwraps it with version 1 to read the archive. Rotation adds version 2 and makes it current. It does not touch earlier data. Version 1 stays enabled so that old wrapped keys can still be unwrapped. This is the state many systems stay in for years.
- Re-wrap. The key service unwraps the A-2025 data key with version 1 and wraps it again with version 2. The archive itself is not re-encrypted. Only the small DEK is processed, so re-wrapping is quick even for a large archive. Version 1 is still enabled, so a read test run now would pass whether or not the re-wrap worked.
- Disable and test. Kael disables version 1 and runs his read test. A-2025 still opens, so only the re-wrapped data key made that possible. Disabling is reversible, so it comes before destruction. With version 1 disabled, the key service can use only version 2. If something still depended on version 1, the test would fail and Kael could re-enable it. He also checks the key service’s usage records, because one file is a small sample.
- Destroy. Kael destroys version 1. A-2025 still opens, because its data key is wrapped by version 2. Destroying a key is permanent. It is safe here because the read test, with version 1 disabled, showed that nothing still needs it. The record of the destruction is kept.
Destroy first
- Rotate. Kael rotates the KEK. New data now uses version 2. Archive A-2025 has not changed, so it still needs version 1 to open. Until now one KEK version wraps the data key of A-2025. The DEK is stored next to the archive in wrapped form, and the key service unwraps it with version 1 to read the archive. Rotation adds version 2 and makes it current. It does not touch earlier data. Version 1 stays enabled so that old wrapped keys can still be unwrapped. This is the state many systems stay in for years.
- Skip re-wrap. Nobody re-wraps the A-2025 data key. It stays wrapped by version 1, and nothing in the key service shows the dependency. The dependency shows only in the key service’s usage records, if someone looks. Nothing else looks different from the step before.
- Read test. Kael runs his read test. Version 1 is still enabled, so A-2025 opens and the test proves nothing about the dependency. Reads succeed because version 1 is still enabled, and nobody has disabled it to find out. Disabling it first, as in the other run, would have made the test fail while the key could still be turned back on.
- Destroy. Kael destroys version 1. No key can unwrap the A-2025 data key now, so the archive cannot be read. The archive’s bytes are intact, and a backup of the encrypted archive would be just as unreadable. Only a protected copy of version 1 could help, and none exists here. The lesson’s point is the same: key management must last as long as the data’s retention schedule.
One KEK, two versions and one archive. Real key services differ in how they rotate, disable and destroy keys, and many add a waiting period before destruction. Key generation, access rules, distribution, protected copies of keys and the response to a stolen key are also part of key management and are not shown.
Flow references: NIST SP 800-57 Part 1 Rev. 5: Recommendation for Key Management
AN ILLUSTRATIVE SCENARIO
A rotation that keeps old archives readable
Kael rotates the key that wraps the data keys for Meridian's telemetry archive. Version 2 becomes current. Archive A-2025 was written under version 1 and still needs it. Kael has the key service re-wrap that archive's data key with version 2. He disables version 1, runs a read test, and only then destroys version 1. Had he destroyed it first, A-2025 would be unreadable for good.
Put it to work
- Make an inventory of your keys. Record what each one protects, where it is stored, who or what may use it, and when it was last rotated.
- Keep keys apart from the data they protect, and keep any key needed for recovery somewhere that survives the loss of the system being recovered.
- Before disabling or destroying a key, check its usage records and run a read test on the oldest data it could still protect.
How to check your work
In a test environment, rotate a key, disable the old version, and try to read data written before the rotation. Then restore a backup onto a clean system using only keys held outside it. Both must succeed.
Connect the ideas
- Encryption
Transforming data so only holders of the appropriate key can read it, protecting confidentiality in transit or at rest.
- Secrets management
Storing, rotating, and auditing passwords, keys, and tokens so they are not copied into chat or source.
- HSM
A dedicated hardware module that generates and stores cryptographic keys and performs operations with them inside itself. Applications send it data to sign or decrypt and do not receive the key.
- Backup
A copy of data kept so integrity and availability can be restored after loss, preferably beyond the production identity’s reach.