Data encryption transforms readable information into ciphertext using cryptographic algorithms and keys so that possession of the stored bytes alone is not enough to recover the protected content. Key management is the discipline that makes this protection operationally trustworthy: keys must be generated, stored, authorised, distributed, used, rotated, backed up where appropriate, recovered, revoked, archived or destroyed under controls that preserve both confidentiality and availability.
Strong encryption with weak key management is strong mathematics wrapped around a weak operating system.
Encryption is often described as one control: “the data is encrypted”. In practice it is a chain of decisions. Which data is encrypted? At which layer? With which algorithm and mode? Which key protects it? Where does that key live? Which identities can cause the key to be used? Can the key leave its protected boundary? How are old ciphertexts decrypted after rotation? What happens when a key is lost, compromised, disabled or destroyed? Which backups still depend on it?
This article follows that chain. It distinguishes encryption at rest from encryption in transit, data-encryption keys from key-encryption keys, key management services from hardware security modules, rotation from re-encryption, and cryptographic erasure from ordinary deletion. It also explains why encryption does not answer the privacy question of whether data should have been collected or used in the first place.
ARTICLE ID: DATA.MANAGEMENT.063
Canonical function: cryptographic protection architecture and the operational lifecycle of encryption keys
Owner boundary: Data Security and Privacy remains the umbrella owner for protection, purpose and exposure; Data Access Governance and Entitlements owns who may access data; Data Backup, Recovery and Resilience owns recovery capability; Data Masking, Tokenisation and De-Identification owns exposure transformation. This article owns how cryptographic keys and encryption layers are designed, operated and recovered.
Start here: read Threat Before Algorithm for the governing principle, Envelope Encryption for the core key hierarchy, Rotation for lifecycle control, or the Key Laboratory for a worked hypothetical system.
Specific cloud examples below are bounded to current official documentation. NIST SP 800-57 Part 1 Rev. 5 provides general key-management guidance. FIPS 140-3 defines security requirements for cryptographic modules used in relevant US federal contexts. AWS KMS, Google Cloud KMS, Azure Key Vault and AWS CloudHSM are used as concrete implementation examples, not as endorsements or claims that one architecture is universally superior.
1. Begin with the threat, not the algorithm name
Before selecting an encryption layer, state what loss you are trying to prevent. Encryption is useful against some threats and irrelevant to others.
- Stolen storage media.
- Unauthorised access to object-store or database files.
- Network interception.
- Cloud or infrastructure operators outside an application’s trust boundary.
- Excessively privileged database administrators.
- Compromised application accounts.
- Accidental backups copied into lower-trust environments.
- Physical theft of devices.
- Unauthorised export of keys.
These threats are not equivalent. Disk encryption can protect a lost laptop while doing little against malware running under the logged-in user. Database transparent encryption can protect storage files while doing little against a compromised application account that is authorised to issue normal queries. TLS can protect a network connection while both endpoints still see plaintext.
The encryption design should therefore state which boundary is being strengthened. “Encrypted” without a threat model can be true and still operationally unhelpful.
2. Plaintext, ciphertext and key are three different things
Plaintext is the original readable data. Ciphertext is the encrypted representation. A cryptographic key is secret or controlled material used by an algorithm to perform encryption, decryption or related operations.
The key is not an ordinary password for the file. Modern encryption algorithms are designed so that knowing the algorithm does not reveal the plaintext without the key. Security should not depend on keeping the algorithm secret.
This produces the central operational problem: if the key is stored beside the ciphertext with identical access, an attacker who obtains both may recover the plaintext. Key management exists to prevent the encryption key from becoming merely another unprotected field.
3. Symmetric and asymmetric keys solve different jobs
Symmetric encryption uses the same secret key for encryption and decryption. It is typically efficient for bulk data encryption.
Asymmetric cryptography uses a key pair: a public key and a private key. Depending on the algorithm and purpose, the public key may be used for encryption or verification while the private key is used for decryption or signing.
Bulk storage encryption commonly relies on symmetric data keys because they are efficient. Asymmetric methods can support key exchange, signatures, identity separation and other roles. Envelope-encryption designs can combine the strengths of layers rather than forcing one algorithm to do every job.
Do not infer from this summary that any arbitrary algorithm or key length is acceptable. Approved algorithms, modes and key sizes evolve. High-consequence systems should follow current standards, platform guidance and organisational cryptographic policy.
4. Confidentiality is not enough: protect integrity too
Encryption answers whether unauthorised readers can recover plaintext. Many systems also need to know whether ciphertext was modified.
Authenticated-encryption modes combine confidentiality with integrity/authenticity protection for the encrypted message. AES-GCM is a common example in modern systems. The exact construction matters because misuse of nonces, keys or modes can destroy security even when the algorithm name appears strong.
This article does not provide a recipe for implementing cryptographic primitives directly. Application teams should prefer mature, reviewed libraries and managed services rather than inventing new encryption formats.
5. Nonces and IVs are part of the cryptographic contract
Many encryption modes require a nonce or initialisation vector. Its required properties depend on the mode: uniqueness, randomness or unpredictability may matter differently.
A repeated or incorrectly generated nonce can undermine security in some authenticated-encryption constructions even when the key remains secret.
Treat nonce generation and storage as part of the envelope format, not as a decorative parameter. The decryptor must know how to recover or reconstruct the exact values needed to authenticate and decrypt the message.
6. Associated data lets integrity cover context that should remain visible
Authenticated encryption can often bind additional authenticated data to the ciphertext. This data is not encrypted by that operation but is included in integrity verification.
For example, an encrypted record might bind:
- tenant identifier;
- record type;
- schema version;
- key version reference;
- object identifier.
If an attacker moves ciphertext from tenant A into tenant B while the tenant identifier is authenticated, decryption can fail rather than silently reinterpret the same ciphertext in a new context.
Associated data should contain only information safe to remain visible in its storage context. Authentication does not make metadata confidential.
7. Encryption at rest protects stored representations
Encryption at rest refers to cryptographic protection of stored data. It can occur at several layers:
- full-disk or volume encryption;
- filesystem encryption;
- database transparent encryption;
- tablespace or column encryption;
- object-store server-side encryption;
- application-layer field or object encryption;
- backup encryption.
Each layer protects a different boundary. Full-disk encryption is valuable when physical media is lost or raw blocks are copied. It does not normally prevent a running database process with legitimate disk access from reading plaintext after the volume is unlocked.
Application-layer encryption can keep selected fields encrypted even from some infrastructure layers, but it transfers more responsibility to application design, key access, search/indexing and recovery.
8. Transparent encryption protects storage without changing normal application queries
Transparent data encryption or analogous storage-layer encryption is designed so authorised database operations continue to see plaintext while data files are encrypted below that layer.
This makes deployment operationally convenient. Applications may not need to change every query or schema.
The limitation follows directly from the convenience: a compromised application account or database user who can issue ordinary authorised queries can often receive decrypted results. Transparent storage encryption should therefore be combined with access governance, monitoring and application security.
9. Field-level encryption narrows the plaintext boundary
Field-level or application-layer encryption can encrypt particular sensitive values before they reach lower storage layers.
Examples include:
- identity numbers;
- payment tokens;
- private notes;
- medical or safeguarding fields;
- high-value secrets.
This can reduce exposure to database administrators or backups that never receive the decrypt key. But it makes filtering, indexing, uniqueness checks and analytics more difficult because the database may see only ciphertext.
Deterministic encryption can preserve equality comparison under certain designs but leaks equality patterns and requires careful cryptographic review. Do not create deterministic schemes casually for convenience.
10. Encryption in transit protects a connection, not both endpoints
Encryption in transit protects data while moving between systems. TLS is the dominant mechanism for network transport security in modern web and service architectures.
A secure TLS connection can provide confidentiality and integrity against network observers between the endpoints, subject to correct certificate and protocol validation. It does not make the data encrypted from the application at either endpoint.
If the client is compromised, plaintext can be stolen before encryption. If the server is compromised, plaintext can be stolen after decryption. Transport encryption secures the path between endpoints, not the endpoints themselves.
11. Know where TLS terminates
In layered infrastructure, TLS may terminate at:
- the application server;
- a load balancer;
- an API gateway;
- a reverse proxy;
- a service mesh sidecar;
- a content-delivery edge.
After termination, traffic may be re-encrypted to the next hop or continue in plaintext inside another trust boundary. “HTTPS enabled” does not describe the full route.
Map the connection hops and identify where plaintext exists. Sensitive internal service traffic may warrant encryption even inside a private network, especially where network boundaries are not treated as sufficient trust.
12. Mutual TLS adds endpoint authentication to both directions
Ordinary HTTPS commonly authenticates the server to the client through certificates. Mutual TLS can additionally require the client to present a certificate accepted by the server.
This can strengthen service-to-service authentication, but certificate lifecycle becomes part of the security system: issuance, private-key protection, rotation, expiry and revocation all matter.
mTLS is therefore another key-management problem. A perfectly configured handshake today can fail tomorrow when certificates expire or private keys are copied carelessly.
13. “End-to-end encryption” requires a precise definition of the ends
The phrase end-to-end encryption is sometimes used loosely. A meaningful claim must identify which endpoints hold the keys and which intermediaries cannot decrypt.
If a cloud service decrypts data to process it, the cloud service is inside the encryption boundary even when network transport and disks are encrypted. If only the user’s device and intended recipient hold decryption keys, the boundary is different.
Do not use “end-to-end” as a synonym for “TLS plus disk encryption”. Name the cryptographic endpoints.
14. Keys are data with a more dangerous failure mode
Encryption keys themselves require classification, access control, audit, backup/recovery decisions and deletion.
A lost ordinary record may affect one object. A lost root or key-encryption key can make millions of ciphertexts permanently inaccessible. A leaked high-level key can expose an equally large population.
Key-management design therefore considers both confidentiality and availability. Protecting a key so strongly that no legitimate recovery is possible can be as damaging as storing it too openly.
15. Key hierarchies reduce the number of high-value keys
A key hierarchy protects many lower-level keys under a smaller number of higher-level keys.
A common conceptual structure is:
Root / master protection → Key-Encryption Key (KEK) → Data-Encryption Key (DEK) → Ciphertext
The exact terminology differs by platform. The architectural benefit is that bulk data does not need to be encrypted directly with one long-lived master key.
Instead, short- or medium-lived data keys encrypt data efficiently, while a smaller number of protected key-encryption keys wrap those data keys.
16. Data-encryption keys do the bulk encryption work
A data-encryption key is a key used to encrypt the actual data payload.
A DEK can be scoped to:
- one object;
- one file;
- one message;
- one tenant;
- one database;
- one time period;
- one storage partition.
Finer-grained DEKs reduce the amount of data exposed if one DEK is compromised, but increase the number of keys and metadata records the system must manage.
Google Cloud’s envelope-encryption documentation recommends generating DEKs locally, storing them only in encrypted form when persisted, and using separate DEKs at a granularity appropriate to the use case. Google Cloud KMS — Envelope encryption.
17. Key-encryption keys protect other keys
A key-encryption key protects DEKs or other key material. This is often called wrapping a key.
The KEK can live in a central key management service or HSM-backed service, while the encrypted DEK travels with the ciphertext. The application needs permission to ask the key service to unwrap the DEK before it can decrypt the payload.
This creates a useful separation. Stolen storage may contain ciphertext and wrapped DEKs but not the high-level plaintext KEK. The central service can enforce access policy, record use and rotate key versions.
18. Envelope encryption separates bulk data from high-level key protection
Envelope encryption uses one key to encrypt the data and another key to encrypt the data key.
The conceptual write path is:
- Generate a DEK.
- Encrypt plaintext with the DEK.
- Encrypt or wrap the DEK with a KEK.
- Store ciphertext plus the wrapped DEK and required cryptographic metadata.
- Discard plaintext DEK from ordinary application memory as soon as practical.
The read path reverses the process:
- Load ciphertext and wrapped DEK.
- Ask the authorised key service to unwrap the DEK.
- Use the plaintext DEK briefly to decrypt the data.
- Clear or release plaintext key material according to the runtime’s capabilities.
AWS KMS documentation describes this same general construction: data is encrypted under a per-message or data key, and that key is encrypted under a longer-term protected key. AWS KMS — Cryptography essentials.
19. Envelope encryption makes rotation and scale more manageable
Suppose a 10-terabyte archive is directly encrypted with one KEK. Rotating that key may require decrypting and re-encrypting all 10 terabytes.
With envelope encryption, the data can remain encrypted under DEKs while the system rewraps those comparatively tiny DEKs under a new KEK version, where the architecture supports that migration.
Microsoft’s Azure Key Vault documentation explicitly notes that key rotation can rewrap data-encryption keys rather than re-encrypt underlying data in supported designs. It also cautions that old and new key versions may both need to remain available until rewrapping is complete. Azure Key Vault — Configure cryptographic key auto-rotation.
The saving can be enormous because a 32-byte data key is tiny compared with a multi-gigabyte or multi-terabyte object.
20. The envelope needs enough metadata to decrypt later
An encrypted object usually needs metadata such as:
- algorithm/mode identifier;
- wrapped DEK;
- KEK/key identifier;
- key version where required;
- nonce/IV;
- authentication tag;
- associated-data definition;
- format version.
Do not assume a global application configuration will always remember which key or algorithm protected an old object. Long-lived ciphertext needs a self-describing or reliably linked envelope.
Metadata should identify a key without exposing plaintext key material. A key ID is not itself the key.
21. A KMS centralises high-value key operations
A Key Management Service provides controlled creation, storage, policy, cryptographic operations, versioning and audit around keys.
A managed KMS can reduce the need for applications to handle root key material directly. Instead of downloading a master key into configuration files, an application authenticates to the service and requests an encrypt, decrypt, wrap, unwrap or signing operation according to permission.
A KMS does not remove the need for access governance. Whoever can call Decrypt effectively has access to plaintext under the scope of that key, even if the key itself never leaves the service.
22. An HSM creates a stronger boundary around key material and cryptographic operations
A Hardware Security Module is a cryptographic module designed to generate, protect and use cryptographic keys inside a specialised hardware boundary.
Depending on configuration and product, keys may be non-extractable, meaning the private or secret key material is not permitted to leave the HSM. The application sends operations to the module instead of receiving the plaintext key.
AWS CloudHSM documentation distinguishes extractable and non-extractable keys and notes that non-extractable keys cannot be exported from the HSM. AWS CloudHSM — Key management best practices.
An HSM reduces some key-exposure paths. It does not make every application request legitimate. A compromised highly privileged identity can still ask an HSM to perform authorised operations unless surrounding access controls, quotas and approvals constrain it.
23. FIPS 140-3 validates cryptographic modules, not your whole application
NIST FIPS 140-3 defines security requirements for cryptographic modules, covering areas such as module specification, interfaces, roles/authentication, physical security, sensitive security parameters, self-tests and lifecycle assurance. NIST FIPS 140-3.
A validated cryptographic module is useful assurance about that module under its validation scope. It is not proof that the surrounding application has correct access controls, key hierarchy, retention, threat modelling or incident response.
Do not turn a component certification into an end-to-end security claim.
24. Key generation is the beginning of the lifecycle, not a one-time setup task
A cryptographic key should be generated with enough entropy and under conditions appropriate to its purpose. A key produced from predictable input can be weak even if the selected algorithm is strong.
For production systems, key generation should normally rely on approved cryptographic libraries, managed key services or hardware-backed modules rather than hand-written random-number logic. The generation environment is part of the trust boundary.
A key record should identify:
- key purpose;
- algorithm and size;
- owner;
- creation time;
- generation method;
- environment;
- allowed operations;
- exportability;
- rotation policy;
- recovery policy;
- destruction policy.
These are operational facts about the key. They belong in a governed inventory even when the key material itself remains hidden inside a KMS or HSM.
25. One key should not silently acquire every purpose
A key used to encrypt backups should not automatically become the signing key for software releases. A key used to protect one tenant’s data should not automatically protect every tenant merely because reusing it is convenient.
Purpose separation reduces blast radius and makes policy easier to reason about. It can also allow different rotation, recovery and access rules for different jobs.
Common purpose distinctions include:
- data encryption;
- key wrapping;
- digital signatures;
- message authentication;
- TLS certificates;
- backup encryption;
- database storage encryption;
- application-level field encryption.
Some algorithms or key types are technically capable of several operations. That does not mean operational policy should permit all of them.
26. Key scope determines compromise radius
Suppose one KEK protects the wrapped DEKs for every dataset in an organisation. Operationally this is simple. But compromise or accidental destruction of that key has organisation-wide consequence.
A more granular design may use:
- one KEK per environment;
- one per tenant;
- one per business domain;
- one per application;
- one per data classification;
- one per geographic region.
Granularity increases inventory and operational complexity. The design should therefore minimise blast radius without creating an unmanageable forest of keys.
27. Development and production should not share high-value keys casually
If production and development share the same KEK, a development environment can become a route to production decryption capability.
Strong environment separation means:
- different key identities;
- different access roles;
- different service credentials;
- different audit trails;
- explicit migration rather than copying secrets between environments.
Masked or synthetic test data can often remove the need for production decryption keys in development altogether.
28. Multi-tenant encryption requires an explicit tenant boundary
One application may serve thousands of tenants. The encryption design needs to state whether tenants share one KEK, use separate KEKs, or use a hierarchy in which tenant-scoped DEKs are wrapped by a smaller set of higher-level keys.
Separate tenant keys can improve isolation and support tenant-specific revocation or cryptographic erasure. But they create more key objects, policies and rotation events.
Shared higher-level keys reduce operational count but increase the amount of data affected by compromise.
The correct choice depends on contractual, regulatory, isolation and operational requirements. The important point is that tenant boundaries should not be accidental consequences of whichever key ID the first developer happened to configure.
29. Imported keys shift part of the trust boundary outside the KMS
Some organisations generate key material outside a cloud key service and import it. This can support external custody requirements, migration or bring-your-own-key models.
The moment key material exists outside the managed service, additional questions appear:
- Where was it generated?
- Was it ever present in plaintext on disk?
- Who handled it?
- How was it transported?
- Which copies exist?
- Can it be exported again?
- How is backup handled?
Imported key material can satisfy legitimate control requirements while also expanding operational responsibility. “Customer-managed” is not automatically “more secure”; it means more of the security model belongs to the customer.
30. Extractable and non-extractable keys represent different operational choices
An extractable key can be exported under defined mechanisms. A non-extractable key is intended to remain inside its protected module or service boundary.
Non-extractability can reduce key-exfiltration risk, but it affects migration and recovery. If the service or HSM cluster is lost and the architecture has no supported backup or replicated recovery path, the ciphertext may become permanently unreadable.
AWS CloudHSM documents that non-extractable keys cannot be exported from the HSM. That is a meaningful control and a meaningful availability constraint. AWS CloudHSM — Key management best practices.
31. Key export should be treated as a high-consequence event
Exporting key material moves it across a trust boundary. Even when wrapped under another key, the operation creates additional artefacts and potential copies.
High-consequence export workflows can require:
- specific export-authorised roles;
- dual approval;
- approved wrapping keys;
- destination verification;
- time-bounded credentials;
- enhanced audit;
- post-transfer confirmation;
- secure destruction of temporary material.
Do not let ordinary application roles export keys merely because they are permitted to use them for cryptographic operations.
32. Permission to use a key is not the same as permission to administer it
A well-designed key service separates roles such as:
- create or import keys;
- set key policy;
- encrypt or wrap;
- decrypt or unwrap;
- rotate;
- disable;
- schedule destruction;
- cancel destruction;
- export where permitted;
- audit key usage.
An application needing decryption should not automatically receive permission to delete or change the key.
Separation reduces the chance that one compromised workload identity can both read protected data and destroy the key needed for recovery.
33. Dual control is useful where one person’s mistake would have extreme consequence
Some high-value operations can require two or more authorised participants.
Examples include:
- exporting a high-level key;
- destroying a root or tenant key;
- restoring an archived key;
- changing a key policy that grants broad decryption;
- performing emergency bulk detokenisation or decryption.
Dual control is not required for every routine decrypt request. It is a mechanism for operations whose consequence justifies stronger procedural separation.
34. Key-use logs are part of the evidence system
Key services should record consequential operations where the platform supports it:
- which identity requested use;
- which key/version;
- which operation;
- when;
- from which service or environment;
- whether it succeeded;
- policy changes;
- rotation and disablement;
- destruction scheduling.
Do not log plaintext DEKs or decrypted payloads merely to improve diagnostics. Audit should preserve evidence of key use without creating a second secret store.
35. A key inventory is the control plane for cryptographic lifecycle
An organisation should be able to answer:
- Which keys exist?
- What do they protect?
- Who owns them?
- Which systems can use them?
- Which versions are active?
- Which old versions are still needed?
- Which backups depend on them?
- Which are scheduled for rotation or destruction?
A KMS can store the key objects, but governance still needs these relationships. A key with no known protected data is difficult to retire safely; a dataset with no known key dependency is difficult to recover confidently.
36. Key lineage connects ciphertext to the material needed to recover it
Encryption introduces a dependency graph:
Ciphertext → DEK → Wrapped DEK → KEK Version → KMS/HSM → Access Policy
If any required element disappears, decryption may fail.
Store enough key metadata with the encrypted object or in a durable registry so the system can identify the correct key version later.
This is a specialised form of lineage. The broader principles in Metadata and Data Lineage still apply: provenance and dependency should remain reconstructable.
37. Rotation creates new key material; it does not automatically transform all old ciphertext
Key rotation generally means creating or activating a new key version for future cryptographic operations.
A common misconception is that rotating a KEK instantly causes all existing data to be encrypted under the new version.
Google Cloud KMS explicitly notes that rotating a key creates a new primary version but does not automatically re-encrypt data protected by previous versions. Old versions remain necessary until data or wrapped keys are migrated. Google Cloud KMS — Key rotation.
Azure documentation likewise describes services where DEKs may be rewrapped with a new KEK version and warns that service-specific adoption can take time. Azure Key Vault — Configure cryptographic key auto-rotation.
38. Rotate for a reason, not because a calendar number looks secure
Rotation can reduce the amount of data protected under one key version and supports response to compromise or changing policy.
Triggers can include:
- scheduled cryptoperiod;
- suspected compromise;
- employee or operator change where policy requires it;
- algorithm migration;
- tenant transition;
- regulatory requirement;
- service migration;
- key-version count or age policy.
NIST SP 800-57 discusses cryptoperiods and lifecycle considerations rather than prescribing one universal rotation frequency for every use. NIST SP 800-57 Part 1 Rev. 5.
Do not apply a single 30-, 90- or 365-day number to every key without considering algorithm, use volume, compromise consequence and platform design.
39. Rotation requires version-aware decryption
New writes may use key version 7 while old ciphertext still depends on version 6, 5 or 4.
Therefore the encrypted envelope or associated metadata needs enough information to locate the correct historical version.
A healthy rotation design separates:
- primary/active version: used for new encryption;
- decrypt-capable historical versions: retained for existing ciphertext;
- disabled versions: unavailable for ordinary use but not yet destroyed;
- destroyed versions: no longer recoverable under normal operation.
40. Rewrapping changes which KEK protects a DEK without touching bulk ciphertext
In an envelope-encryption design, the application can often:
- unwrap the DEK using the old KEK version;
- wrap the same DEK under the new KEK version;
- replace the encrypted DEK metadata;
- leave the bulk ciphertext unchanged.
This operation is much cheaper than decrypting and re-encrypting a large payload.
It still needs careful reconciliation. If the application overwrites the old wrapped DEK before proving the new one is valid, a failed migration can make data unreadable.
41. Re-encryption changes the data-encryption key or ciphertext itself
Re-encryption can mean decrypting data and encrypting it again under new key material.
This may be necessary when:
- the DEK is suspected compromised;
- the algorithm or mode changes;
- data scope changes;
- old DEKs need retirement;
- the key hierarchy itself is redesigned.
Google Cloud documents a separate re-encryption process after rotation and warns that destroying a key version still in use can cause permanent data loss. Google Cloud KMS — Re-encrypting data.
42. Rotation is a migration, not just a key-service button
A mature rotation route is:
Create New Version → Authorise New Version → Begin New Writes → Rewrap/Re-encrypt Existing Dependents Where Required → Verify Coverage → Observe Decryption Errors → Disable Old Version → Hold → Destroy Only After Recovery Evidence
The exact stages depend on the platform. The principle is that creation of a new version is only the first step.
43. Downstream adoption can lag behind the key service
A KMS can declare version 7 primary immediately while a database, object store or application continues using version 6 until it refreshes configuration or rewraps state.
Therefore, key rotation should observe actual dependents rather than infer completion from the KMS state alone.
Useful signals include:
- percentage of new encryption using the new version;
- remaining wrapped DEKs under old versions;
- service-specific adoption state;
- decrypt calls to old versions;
- rotation errors;
- replica or backup dependencies.
44. Suspected key compromise changes the problem from maintenance to incident response
If a key may have been exposed, scheduled rotation may be too slow and ordinary version coexistence may be inappropriate.
Incident response should determine:
- which key/version is affected;
- whether plaintext key material was exposed or only use permissions were abused;
- which ciphertexts depend on it;
- which systems could request decrypt;
- which logs show suspicious use;
- whether data needs re-encryption;
- whether old versions can be disabled safely;
- which legal, contractual or regulatory notifications apply.
A compromised service credential with decrypt permission can expose data even when the key material itself never left an HSM.
45. Key material compromise and key-use compromise are different incidents
Two broad scenarios should be distinguished:
- material compromise: an attacker obtains the secret/private key material or a usable exported copy;
- use-path compromise: an attacker obtains an identity allowed to invoke decryption but does not obtain the key material itself.
The first may require replacing the key and all protected data depending on scope. The second may require credential revocation, policy repair and exposure assessment even if cryptographic key rotation alone adds little protection.
Incident handling should match the actual failure boundary.
46. Disablement is a containment state; destruction is a final state
Disabling a key can stop ordinary cryptographic use while preserving the possibility of re-enabling it during investigation or recovery.
Destroying key material can make protected data permanently inaccessible.
A good lifecycle therefore uses intermediate states where supported:
- ACTIVE;
- ROTATED/HISTORICAL;
- DISABLED;
- PENDING_DESTRUCTION;
- DESTROYED.
These state names vary by platform. Their operational meaning should be explicit.
47. Recovery planning asks what happens when the key service or key becomes unavailable
Encryption increases the number of dependencies required for data recovery.
A backup is not recoverable merely because the ciphertext file exists. Recovery may also require:
- the correct historical KEK version;
- wrapped DEKs;
- HSM/KMS configuration;
- identity and permission state;
- algorithm/envelope version;
- nonce/IV and authentication metadata.
If one element is missing, backup restoration can produce perfectly intact ciphertext that nobody can decrypt.
48. Decide explicitly which keys require backup
Some key material should be recoverable. Some ephemeral keys should not.
For long-lived data encryption, an unrecoverable KEK can turn infrastructure failure into permanent data loss. A managed KMS may provide durable replicated storage. An HSM deployment may require cluster replication, secure backup or wrapped export depending on architecture.
Backup of extractable key material should itself be encrypted, access-controlled, geographically and administratively appropriate, and tested through restoration.
Do not create plaintext “emergency copies” of master keys in spreadsheets, shared drives or personal password managers unless an approved design specifically requires and protects that representation.
49. Key escrow is a governance decision with serious trade-offs
Key escrow stores recoverable key material or recovery capability with a designated custodian or process.
Escrow can protect availability and business continuity. It also creates another high-value recovery path that attackers may target.
If used, define:
- custodian;
- approval threshold;
- storage medium;
- encryption/wrapping;
- location;
- access logging;
- test frequency;
- revocation;
- retirement.
Escrow is neither automatically required nor automatically unsafe. Its value depends on the consequence of key loss versus the consequence of another recovery path existing.
50. Disaster recovery must restore the key hierarchy in the correct order
Imagine an encrypted database backup whose DEKs are wrapped by a KEK stored in a key service.
A recovery sequence may require:
- restore or reconnect the KMS/HSM trust boundary;
- restore identities and authorisation;
- confirm historical key versions;
- restore wrapped-DEK metadata;
- restore ciphertext;
- test decryption of known control records;
- only then reopen the recovered data service.
Restoring ciphertext before restoring key access is not wrong, but calling the database “recovered” before decryptability is proven would be premature.
51. Backups create long tails of key-version dependency
A production dataset may have migrated from KEK version 4 to version 7. Current live data no longer needs version 4. A three-year-old backup may still depend on it.
Destroying version 4 can therefore convert the old backup into unusable ciphertext.
Before retiring a key version, map:
- live data;
- snapshots;
- archives;
- replicas;
- offline exports;
- disaster-recovery copies;
- third-party protected copies.
This is where key management intersects directly with retention and backup policy.
52. Cryptographic erasure destroys access by destroying the required key
Cryptographic erasure makes encrypted data inaccessible by destroying or irreversibly revoking the key material needed to decrypt it.
This can be operationally powerful for very large encrypted datasets because deleting one small high-level key can make a large ciphertext population unreadable.
However, the claim is only valid if:
- the target data is actually encrypted under the affected key hierarchy;
- no usable key copies remain;
- no plaintext copies exist elsewhere;
- no independently encrypted derivative remains accessible;
- backups do not retain another usable key path;
- the destroyed key cannot be regenerated from retained seed or escrow material.
Cryptographic erasure is therefore a key-management operation plus an inventory/lineage proof problem.
53. Cryptographic erasure and data deletion are not identical
After key destruction, ciphertext bytes may remain on disks, backups or media while being computationally inaccessible under the intended threat model.
A policy may accept that as destruction in some contexts or require additional physical/media disposal in others.
Do not label key destruction “deletion” automatically. State the achieved end state precisely and apply current legal/contractual rules where consequential.
See Data Deletion and Destruction Verification.
54. Key destruction needs proof stronger than “delete call succeeded”
For high-consequence key destruction, verify:
- which exact key/version was targeted;
- which approval authorised it;
- whether copies or replicas exist;
- whether escrow/recovery material remains;
- whether the platform destruction state is final or delayed;
- which ciphertexts became inaccessible;
- whether critical backups were intentionally invalidated.
A scheduled destruction state is not the same as completed destruction.
55. Accidental key loss is a data-loss incident even when ciphertext survives
If a required key disappears, encrypted data may become unrecoverable without any bytes being deleted.
This is why confidentiality and availability must be designed together. A system can be perfectly successful at keeping attackers out and perfectly successful at keeping the organisation out as well.
Recovery tests should include key failure, not only server failure.
56. KMS availability becomes application availability when decryption is on the critical path
If every application request needs a remote KMS unwrap operation, a KMS outage or network partition can prevent reads even though the database is healthy.
Architectures may reduce this dependence through:
- short-lived in-memory DEK caches;
- local cryptographic agents;
- service replication;
- graceful degradation;
- pre-unwrapped session keys under strict controls.
Each optimisation changes the exposure boundary. Caching plaintext DEKs improves availability and latency while increasing the time key material exists in application memory.
57. Key caching is a deliberate exposure–latency trade-off
Suppose an application decrypts 10,000 records per second. Calling a remote key service for every record may be inefficient.
One approach is to unwrap a DEK once and reuse it in memory for a short period or bounded number of operations.
The trade-off:
- fewer KMS calls;
- lower latency;
- better resilience to brief outages;
- but more plaintext-key residence time;
- and slower revocation effect if a key is disabled centrally.
Cache lifetime should therefore be part of the threat model and incident-response design.
58. Plaintext key material in memory is still key material
Even when master keys stay in an HSM, DEKs can appear in application memory during encryption or decryption.
Risks include:
- process memory dumps;
- debuggers;
- core dumps;
- swap;
- memory disclosure vulnerabilities;
- overly verbose crash reporting;
- long-lived global variables.
Use libraries and runtime patterns that minimise exposure where practical. Avoid copying plaintext key bytes through unnecessary layers.
59. Encryption keys are not ordinary configuration secrets
API tokens and encryption keys are both sensitive, but they often have different lifecycles and consequences.
A service credential can be revoked and replaced without transforming stored ciphertext. Replacing a data-encryption or wrapping key may require rewrapping or re-encrypting data.
Do not treat master encryption keys as ordinary environment variables merely because the deployment system has a generic “secrets” feature.
60. Secret managers and key-management systems overlap but have different primary jobs
A secret manager commonly stores credentials, API tokens, passwords and configuration secrets for retrieval by authorised workloads.
A KMS commonly protects cryptographic keys and performs cryptographic operations under controlled policy, often without exposing high-level plaintext key material.
Some platforms blur the boundary or integrate both. The architectural question is whether the workload needs to retrieve a secret value or request a cryptographic operation using protected key material.
61. Asymmetric-key recovery depends on whether the private key must survive
A signing key and an encryption private key have different recovery expectations.
If a signing private key is lost, old signatures can still be verified with the public key, but new signatures require a replacement identity/key version and corresponding trust update.
If an encryption private key is lost while ciphertext can only be decrypted with that private key, the protected data may be unrecoverable.
Therefore key backup and rotation policy should consider the exact cryptographic purpose.
62. Public keys are public, but their authenticity still matters
Public-key material does not need confidentiality, but a receiver must know that the public key belongs to the intended identity.
An attacker who substitutes their own public key can redirect encryption or verification trust.
Certificates, fingerprints, trust stores and authenticated key directories address this binding problem. Public distribution is not the same as unauthenticated distribution.
63. Certificate lifecycle is key lifecycle plus identity lifecycle
TLS certificates bind an identity or name to a public key under a certificate authority system.
Operational management includes:
- private-key generation and storage;
- certificate issuance;
- hostname/identity scope;
- expiry;
- renewal;
- revocation;
- trust-chain updates;
- service reload and verification.
A certificate can renew successfully while an application continues serving the expired old certificate because the process never reloaded it. Verification must reach the live endpoint.
64. Cryptographic agility means being able to change algorithms and key schemes without losing the estate
Algorithms age. Standards change. Vulnerabilities emerge. Hardware improves.
A durable encrypted format should therefore preserve enough versioning metadata to support migration.
Useful design elements include:
- algorithm identifier;
- envelope version;
- key identifier/version;
- nonce/IV format;
- authentication-tag location;
- associated-data rules;
- migration state.
Do not hard-code one algorithm assumption into millions of objects without an upgrade route.
65. Post-quantum migration is a planning problem before it is a panic problem
Quantum-resistant cryptography is evolving into production standards, particularly for public-key cryptography. The migration problem affects key exchange, signatures, certificates, protocols and long-lived protected information differently.
This article does not prescribe a post-quantum algorithm stack. The key-management lesson is to inventory where asymmetric cryptography is used, how long protected information must remain confidential, which protocols support migration, and whether cryptographic agility exists.
Do not replace well-understood symmetric encryption indiscriminately merely because “quantum” appears in a threat discussion. The impact differs by cryptographic primitive.
66. Provider-managed encryption and customer-managed encryption answer different control questions
Many cloud services encrypt data at rest by default using provider-managed keys. This can provide strong baseline protection with minimal operational work.
Customer-managed keys add direct customer control over key policy, rotation, disablement, destruction and often audit visibility.
The additional control is useful when organisations need:
- separate key ownership;
- customer-controlled disablement;
- key-specific audit;
- regulatory or contractual key custody;
- tenant or regional isolation;
- bring-your-own-key arrangements.
It also adds responsibility. A misconfigured or destroyed customer-managed key can make an otherwise healthy cloud service unable to access its data.
67. A customer-managed key does not guarantee identical rotation behaviour across services
Cloud services integrate with KMS systems differently.
After a key rotates, one service may immediately rewrap all DEKs, another may use the new version only for new writes, and another may continue using the originally configured version until explicitly changed.
Google Cloud’s CMEK documentation describes several service-specific rotation patterns, including rewrapping existing DEKs, using the new version only going forward, or continuing with the originally configured version depending on the integrated service. Google Cloud KMS — CMEK key rotation.
Therefore, “KMS rotation enabled” is not enough evidence. Verify the dependent service’s actual adoption behaviour.
68. BYOK changes key custody; it does not remove cloud dependency
Bring Your Own Key generally means the customer generates or controls key material and imports it into a provider-supported KMS or HSM boundary.
This can create clearer custody and portability requirements. But once the service uses the imported key, availability still depends on the cloud key service, identity system, policy and the integration between the service and that key.
BYOK should therefore be described precisely:
- Who generated the material?
- Where does plaintext material exist?
- Can the provider export it?
- Can the customer revoke use?
- How is rotation performed?
- How is migration handled?
69. “Hold your own key” is meaningful only if the service genuinely cannot decrypt without you
Some architectures attempt to keep the provider outside the decryption path entirely, with keys remaining under customer control.
This can reduce provider-side plaintext access but can also restrict server-side search, indexing, analytics, support and recovery.
The strongest claim is not “we own the key” but “which components can produce plaintext under which conditions?” Follow the decryption route rather than the marketing label.
70. Geographic key placement affects sovereignty and recovery
Keys can be region-bound, replicated across regions or globally available depending on platform and design.
Geographic choices affect:
- latency;
- resilience;
- disaster recovery;
- administrative jurisdiction;
- cross-border access;
- regulatory obligations;
- blast radius.
A multi-region application with a single-region key service can become unavailable during a regional outage. A globally replicated key can improve resilience while creating a broader governance footprint.
See Data Sovereignty, Residency and Jurisdiction.
71. Multi-region keys need coordinated version state
If several regions can encrypt or decrypt, they need a coherent understanding of which key versions are current and which remain valid for historical data.
Rotating one region while another continues creating ciphertext under an older version can be acceptable when documented, or a policy failure when uniform use is required.
Record version adoption by region rather than assuming all replicas changed simultaneously.
72. Database encryption can exist at several layers simultaneously
A database system may combine:
- disk/volume encryption;
- database transparent encryption;
- column-level encryption;
- client-side field encryption;
- TLS connections;
- encrypted backups;
- KMS/HSM-protected master keys.
These layers are not redundant when they defend different boundaries.
But more layers can create recovery complexity. Document which layer owns which threat so engineers do not assume that one encrypted layer makes another unnecessary or that every layer needs a separate key hierarchy.
73. Object encryption should bind object identity and key metadata durably
Encrypted files and objects often live much longer than the application version that wrote them.
A durable object envelope can record:
- object version;
- algorithm;
- wrapped DEK;
- KEK identifier/version;
- nonce;
- authentication tag;
- associated-data rules;
- creation time;
- migration state.
If the application changes its default key in 2028, an object written in 2026 should still identify the material needed for decryption.
74. Backup encryption should not depend blindly on the same failure domain as production
Suppose production data and backups use the same KEK and the same privileged identity can both delete the data and destroy the key.
An attacker who compromises that identity can destroy both production and recovery capability.
Depending on consequence, organisations may use:
- separate backup keys;
- separate administrative roles;
- different accounts or projects;
- isolated vaults;
- immutable backup controls;
- independent key-retention policies.
Separation increases resilience against a single credential or administrative error.
75. A backup restore test must prove decryption, not only file restoration
A restore test that confirms backup bytes arrived on a server is incomplete when the backup is encrypted.
Verify:
- required key versions exist;
- the recovery identity can use them;
- the envelope metadata is intact;
- known control records decrypt;
- application-level checks pass;
- old keys scheduled for retirement remain available where intentionally required.
Key recovery is therefore part of backup testing, not a separate paperwork exercise.
76. Logs need encryption too—but encryption does not solve over-logging
Audit logs, application logs and telemetry can contain sensitive information.
Encryption protects stored log files and transport. But if an application logs full card numbers, private messages or plaintext keys unnecessarily, the organisation has created an avoidable sensitive dataset.
Minimise sensitive logging first; encrypt the logs that legitimately remain.
77. Never put plaintext cryptographic keys into ordinary logs
Debug logging can accidentally capture:
- DEKs;
- private keys;
- secret environment variables;
- full decrypted payloads;
- key export material;
- cryptographic request parameters.
A log platform often has broader access and longer retention than the application. One debug line can therefore defeat a carefully designed KMS boundary.
78. Encryption changes what can be searched
Encrypted values generally cannot be indexed using ordinary plaintext comparison without decryption or a specialised scheme.
This creates design choices:
- decrypt in a trusted application and search there;
- maintain a separate protected search token;
- use deterministic encryption for equality under carefully reviewed conditions;
- use specialised searchable-encryption techniques;
- avoid searching the protected field.
Every workaround leaks or preserves some information. Searchability is a privacy/security trade-off, not a free feature.
79. Deterministic ciphertext leaks equality patterns
If the same plaintext under the same context always produces the same ciphertext, an observer can tell which records share the same value even without knowing that value.
For a low-entropy domain such as country code, gender category or yes/no flag, frequency analysis can reveal likely mappings.
Use deterministic encryption only when equality search genuinely matters and the leakage model is acceptable.
80. Format-preserving encryption preserves compatibility and some structure
Legacy systems sometimes require encrypted substitutes that match a fixed format or character set.
Format-preserving encryption can help when applications expect a specific pattern. The preserved format also reveals structural information and may shrink the possible plaintext domain.
Compatibility should not be confused with anonymity.
81. Tokenisation and encryption are different transforms
Encryption is mathematically reversible with the correct key. Tokenisation replaces a sensitive value with a token whose mapping may be stored elsewhere.
A token vault may use encryption internally, but the conceptual interface differs: consumers use a surrogate token rather than ciphertext representing the original data.
See Data Masking, Tokenisation and De-Identification for that owner.
82. Passwords should usually be hashed, not reversibly encrypted
An authentication password usually does not need to be recovered in plaintext. The system needs to verify whether a supplied password matches the stored verifier.
That job is better served by a modern password-hashing function with appropriate salt and work factor than by reversible encryption.
Encryption is correct when later plaintext recovery is required. Password verification usually should avoid that requirement entirely.
83. Hashing is not encryption
A cryptographic hash maps input to a fixed-size digest and is designed as a one-way function rather than a reversible transformation under a key.
Hashes support integrity, fingerprints, signatures and other constructions. They do not hide low-entropy identifiers automatically; a hashed phone number or email address can still be guessed from a dictionary.
Do not label hashed identifiers “encrypted” or “anonymous”.
84. Digital signatures prove origin/integrity; they do not hide content
A digital signature lets a receiver verify that a message was signed by the holder of a private key and that the signed content was not modified, subject to the algorithm and trust model.
It does not make the message secret. Encryption and signing can be combined when both confidentiality and authenticity are required.
This distinction matters because key lifecycle differs: a signing key can be rotated while old signatures remain verifiable through historical public keys and trust metadata.
85. Give keys explicit lifecycle states
A useful internal state model might include:
- PLANNED;
- GENERATED;
- ACTIVE_FOR_ENCRYPT;
- DECRYPT_ONLY;
- DISABLED;
- COMPROMISED;
- PENDING_DESTRUCTION;
- DESTROYED.
The exact vocabulary can differ. The benefit is avoiding ambiguous statements such as “old key” or “retired key”.
A key may be retired from new encryption while still required for decryption. That is very different from a destroyed key.
86. Version the key policy as well as the key
Key material version 7 can remain unchanged while access policy changes from “Application A may decrypt” to “Applications A and B may decrypt”.
That policy change can materially increase exposure without creating a new cryptographic key version.
Audit and impact analysis should therefore track:
- key version;
- policy version;
- principal bindings;
- effective dates;
- approval;
- reason for change.
87. Review effective decryption authority, not only who can view the key object
A user might lack permission to read KMS configuration yet still belong to an application role that can request decryption.
Another user may administer the key but lack access to ciphertext.
Effective risk depends on combinations:
- can access ciphertext;
- can invoke decrypt;
- can change policy;
- can export key material;
- can erase audit logs;
- can destroy key versions.
See Data Access Governance and Entitlements.
88. Separate data administration, key administration and audit where consequence warrants it
If one identity can read all ciphertext, grant itself decrypt permission, export keys and delete audit evidence, the encryption architecture has a concentrated control point.
High-consequence systems can separate:
- data owner;
- key administrator;
- application runtime role;
- security reviewer;
- audit reader;
- destruction approver.
Separation does not guarantee safety, but it makes some misuse require more than one compromised role.
89. Emergency decryption should be explicit and reviewable
Incident response may require temporary broader access.
A break-glass path can include:
- strong authentication;
- specific incident ID;
- time-bounded permission;
- restricted key scope;
- enhanced logging;
- post-event review;
- automatic expiry.
“Emergency” should not become a permanent role that bypasses ordinary controls.
90. Workload identity is often more important than a human key administrator during normal operation
In production, applications usually decrypt data through service identities rather than a human clicking a KMS console.
Therefore protect:
- service-account credentials;
- instance/workload identities;
- token issuance;
- role assumption;
- network path to KMS;
- application authorisation.
A perfectly protected KMS can still be abused by a compromised application identity with broad decrypt rights.
91. Bind decryption to context where the platform allows it
Some KMS designs support encryption context, associated metadata or policy conditions that can constrain use.
For example, a wrapped DEK may be intended only for:
- tenant 847;
- object type “invoice”;
- production environment;
- one service role.
Binding context can prevent a valid ciphertext/key pair from being reused in an unintended object or tenant.
Context values themselves may appear in logs or policies, so do not place sensitive plaintext there casually.
92. Scheduled rotation and compromise replacement have different urgency
Scheduled rotation assumes old key versions remain trustworthy enough for controlled historical decryption.
Compromise response may require:
- immediate disablement;
- forced re-encryption;
- credential revocation;
- broader investigation;
- shortened cache lifetime;
- emergency application rollout.
Do not treat a suspected-compromise event as “run normal rotation a little earlier”.
93. Revocation latency is part of the key-control design
Disabling a key centrally may not immediately stop every plaintext use.
Applications may hold:
- cached DEKs;
- already-decrypted data;
- active TLS sessions;
- memory-resident secrets;
- locally replicated keys.
Measure how long effective decryption capability survives after central revocation. This is especially important for emergency containment.
94. Key-use anomalies can reveal attacks that data-layer logs miss
Examples:
- sudden bulk decrypt calls;
- decrypt from a new workload identity;
- cross-region key use;
- unusual after-hours administration;
- repeated failed unwraps;
- unexpected export attempts;
- rapid policy broadening.
An anomaly does not prove malicious activity. It is evidence for investigation.
95. A cryptographic inventory should cover more than encryption keys
Include:
- data-encryption keys;
- key-encryption keys;
- signing keys;
- TLS private keys;
- certificate authorities and trust anchors;
- tokenisation keys;
- HMAC keys;
- backup keys;
- legacy algorithms/formats;
- hardware/security-module dependencies.
This inventory enables cryptographic agility because the organisation knows what must change when an algorithm, certificate authority or service reaches end of life.
96. AI pipelines need encryption controls across prompts, retrieval and derived artifacts
AI systems can create new plaintext surfaces:
- prompts;
- retrieved documents;
- embedding pipelines;
- temporary model context;
- evaluation datasets;
- feedback logs;
- vector indexes;
- generated exports.
Encrypting the source database does not automatically protect every derivative.
Access and encryption controls should follow data into retrieval and evaluation stores where appropriate.
See AI Data Management.
97. Embeddings should not be assumed non-sensitive because they are numeric vectors
An embedding is a derived representation. Its confidentiality depends on source content, model, attack model and use.
Vector stores can reveal semantic relationships and may contain links back to source identities.
Encrypt vector databases and backups according to classification, and enforce retrieval permissions independently of encryption.
98. Education example: protect learner records without giving one key universal reach
Consider an education platform storing learner identity, attendance, assessments, parent contact and billing.
A possible design separates:
- operational database storage encryption;
- TLS between application and database;
- field-level encryption for especially sensitive notes;
- application service identity for routine decryption;
- separate KEK for backups;
- separate development keys;
- audit of bulk decrypt or export.
Teachers still need access to appropriate learning information. Encryption should not create a maze that prevents legitimate classroom work. Access policy decides who sees which fields; encryption strengthens storage and service boundaries around that decision.
99. Finance example: payment data and operational separation
A finance platform can tokenise payment identifiers while encrypting transaction records and backups. A payment processor role may detokenise or decrypt narrowly for transaction operations. General analytics uses surrogates and aggregate values.
The KEK protecting payment data can have stronger administration and export controls than ordinary internal analytics keys.
One compromise should not automatically expose both payment identity mappings and every analytical dataset.
100. Research example: pseudonymisation plus encryption solve different layers
A research dataset may replace direct participant identities with project-scoped pseudonyms. The pseudonymised dataset is still encrypted at rest and in transit.
The crosswalk that maps pseudonyms back to real identities can use a separate key and tighter access policy.
Pseudonymisation reduces routine identity exposure; encryption protects stored/transmitted representations. Neither substitutes for the other.
101. Key laboratory: one million encrypted learner documents
We now work through a synthetic architecture. The numerical values are illustrative, not production measurements.
Assume an education platform stores 1,000,000 learner documents. Each document averages 1 megabyte. The total plaintext volume is therefore approximately 1 terabyte before storage overhead and replication.
The platform chooses envelope encryption:
- one randomly generated DEK per document;
- AES-based authenticated encryption for the document payload;
- one regional KEK in a managed KMS;
- the wrapped DEK stored beside each ciphertext;
- associated data binding tenant ID, object ID and envelope version;
- separate backup KEK;
- no production KEK access from development.
This is an architecture exercise, not a prescribed design for every education system.
102. Fine-grained DEKs can mean many encrypted keys but few high-level keys
One million documents means one million DEKs under this design.
If each DEK is 32 bytes, the raw plaintext key material represented across the estate is approximately:
1,000,000 × 32 bytes = 32,000,000 bytes, or about 32 MB before envelope overhead.
Those DEKs do not need to remain stored in plaintext. Each is wrapped under the KMS-managed KEK and stored as encrypted key material beside its document.
The system may therefore manage one million encrypted DEK blobs while keeping only a small number of high-level KEKs in the KMS.
103. Compare the compromise radius of one DEK with one KEK
If one document DEK is compromised, the immediate cryptographic blast radius can be one document, subject to copies and derivatives.
If the KEK plus the ability to obtain all wrapped DEKs is compromised, the blast radius can include every document protected under that KEK.
This difference justifies tighter controls around the KEK than around each individual wrapped DEK record.
104. Rotate the KEK without rewriting one terabyte of document ciphertext
Suppose KEK version 4 becomes due for scheduled rotation.
A new version 5 is created and becomes the version used for new encryption. The one million historical documents still contain DEKs wrapped under version 4.
The platform chooses to rewrap all historical DEKs. It does not decrypt and re-encrypt the 1 TB of document payloads.
Conceptually the migration processes one million small wrapped-key records rather than one million megabyte documents.
If the encrypted DEK envelope averages, say, 128 bytes including metadata for this hypothetical case, the rewrapping workload touches roughly:
1,000,000 × 128 bytes = 128,000,000 bytes, around 128 MB of envelope material before API/protocol overhead.
That is orders of magnitude smaller than rewriting a 1 TB payload estate. Real services add substantial request, metadata and operational overhead; the arithmetic is illustrative of the structural difference.
105. Do not overwrite the only recoverable wrapped DEK before verification
A safe per-object migration can use a staged state:
- Read wrapped DEK under version 4.
- Unwrap under authorised KMS operation.
- Wrap the DEK under version 5.
- Store new wrapped DEK as pending.
- Test unwrap of version 5 and decrypt a control operation.
- Mark version 5 envelope active.
- Retain or remove old wrapped DEK according to rollback policy.
The exact implementation can optimise batching or dual-envelope storage, but the safety principle is simple: prove the new path before destroying the old path.
106. Rotation completion is a coverage calculation
Suppose 998,500 of 1,000,000 documents have been rewrapped successfully.
Migration coverage is:
998,500 / 1,000,000 = 0.9985 = 99.85%.
That sounds excellent, but 1,500 documents still depend on the old KEK version.
If version 4 is destroyed now, those 1,500 documents can become unreadable.
A security percentage is not a substitute for understanding the remaining exceptions.
107. The unresolved 0.15% needs reasons, not one “failed” label
Suppose the remaining 1,500 consist of:
- 900 archived objects in a cold tier;
- 300 objects with corrupted envelope metadata;
- 200 objects held by a third-party storage process;
- 100 objects under legal/operational hold awaiting review.
Each category requires a different action. Repeatedly retrying the same rewrap job will not repair corrupted metadata or renegotiate a third-party process.
108. Backups can keep the old key version alive after live migration reaches 100%
Assume all one million live documents are rewrapped under version 5. Production no longer calls version 4.
However, monthly backups from the previous year still contain envelopes under version 4.
The organisation has three broad choices:
- retain version 4 until those backups expire;
- reprocess the backups where operationally appropriate;
- accept that destroying version 4 intentionally makes those backup editions unrecoverable.
The decision belongs to retention, recovery and security policy together.
109. Now change the scenario: version 4 is suspected compromised
Scheduled migration assumed version 4 remained trustworthy. A compromise changes the urgency.
The platform should determine:
- whether key material leaked or only an application identity was abused;
- which documents were decryptable during the exposure window;
- whether bulk decrypt activity occurred;
- whether cached DEKs remain in services;
- which backups and exports are affected;
- whether re-encryption under new DEKs is required rather than simple rewrapping.
If version 4’s key material itself leaked, rewrapping the same DEKs under version 5 does not remove the attacker’s copy of the plaintext DEKs if those DEKs were also exposed. Scope matters.
110. A stolen decrypt credential can require a different repair from a stolen KEK
Suppose an attacker obtains a service credential allowed to call KMS decrypt for ten minutes, but no high-level key material can be exported.
The immediate actions may include:
- revoke the service credential;
- review KMS decrypt logs;
- identify ciphertext the service could access;
- rotate application credentials;
- inspect plaintext exfiltration routes;
- shorten or invalidate DEK caches;
- repair the application vulnerability.
Rotating the KEK can be prudent in some incidents, but it does not by itself answer whether data was already decrypted and copied.
111. Destruction must wait until the recovery dependency is understood
Before destroying version 4, the platform creates a key-dependency report:
| Dependency | Version 4 use | Disposition |
|---|---|---|
| Live documents | 0 | Rewrapped to v5 |
| Current search derivatives | 0 | Rebuilt |
| Recent backup set | Present | Retain until expiry |
| Archived legal-hold export | Present | Separate approved key-retention exception |
| Development | 0 | Separate key hierarchy |
The correct outcome is not yet “destroy”. The report shows legitimate dependencies.
112. Prove a restored backup can still decrypt
Choose a controlled backup edition and restore it into an isolated recovery environment.
Verify:
- the envelope metadata survives;
- the correct historical KEK can be referenced;
- the recovery role can unwrap DEKs;
- known sample documents authenticate and decrypt;
- current revoked documents are handled according to the recovery procedure;
- the environment can be destroyed safely after the exercise.
This is stronger evidence than “the backup job is green”.
113. Simulate a KMS outage without creating a security bypass
Suppose the KMS becomes unreachable for five minutes.
An application that caches DEKs for ten minutes may continue serving some recently accessed objects. An uncached object may become temporarily unreadable.
The application should not fall back to a plaintext master key stored in configuration merely to preserve availability. That would convert a resilience test into a secret-management failure.
Design graceful behaviour: explicit temporary unavailability, read-only cached scope, or controlled queueing may be safer than bypassing cryptographic policy.
114. Associated data can stop ciphertext from moving into the wrong tenant context
Assume document A belongs to tenant 100 and document B belongs to tenant 200.
If the encryption operation authenticates tenant ID and object ID as associated data, copying A’s ciphertext into B’s database row causes authentication failure when the application attempts to decrypt under B’s expected context.
This protects against one class of substitution error without needing the associated data itself to be encrypted.
115. One DEK per object is not always the right granularity
One million DEKs create one million envelope records and potentially many KMS unwrap operations.
An alternative might use one DEK per tenant per day. That reduces key count and KMS traffic but increases compromise radius.
There is no universal optimum.
Choose granularity using:
- data sensitivity;
- object size;
- decrypt frequency;
- KMS latency/cost;
- tenant isolation;
- cryptographic-erasure requirements;
- rotation/recovery complexity.
116. Key-management cost should include operations, not only monthly KMS price
A detailed model can include:
- key-service API calls;
- HSM capacity;
- engineering time;
- rotation jobs;
- recovery tests;
- audit storage;
- incident response;
- key migration;
- performance overhead;
- availability design.
The cheapest KMS bill can coexist with an expensive fragile architecture.
117. Common encryption misconceptions
- “Encrypted means private”: encryption does not establish legitimate collection or purpose.
- “The key never leaves the HSM, therefore data cannot leak”: authorised decrypt operations can still expose plaintext.
- “Rotation re-encrypts everything”: many systems simply create a new version for future use.
- “TLS is end-to-end encryption”: TLS protects the configured transport endpoints.
- “Hashing is encryption”: hashing is not a reversible keyed transform.
- “Disk encryption protects against a compromised application”: the running application may receive plaintext normally.
- “Customer-managed keys are always safer”: they add control and responsibility.
- “Destroying a key deletes all data”: plaintext or independently encrypted copies may remain.
- “One master key is simpler”: it may create unacceptable blast radius.
- “More frequent rotation is always better”: rotation has operational cost and must be matched to risk.
118. Named failure modes
- Key beside ciphertext: the storage attacker gets both protection layers together.
- Universal KEK: one compromise exposes the entire estate.
- Development inheritance: lower-trust environments receive production decrypt authority.
- Rotation theatre: a new key version exists but dependents keep using the old one.
- Early destruction: an old key is destroyed while backups still depend on it.
- Rewrap without verification: the old envelope is overwritten before the new one is proven.
- KMS super-role: one identity can decrypt, change policy and destroy keys.
- Export escape: a protected HSM key is exported into a weaker environment.
- Plaintext debug: key or decrypted data enters logs.
- Cache-blind revocation: central disablement is assumed to end every local plaintext-key use immediately.
- Certificate expiry outage: private-key/certificate lifecycle is unmanaged.
- Recovery without key restore: backup bytes are restored but ciphertext remains unreadable.
- Crypto-erasure overclaim: key destruction is declared complete while plaintext copies survive.
- Algorithm lock-in: ciphertext format has no migration version.
- Provider-label trust: “HSM-backed” or “FIPS validated” is treated as proof of application security.
119. Decision gate: which encryption layer should you use?
Ask in this order:
- Which threat boundary must be strengthened?
- Which receiver still needs plaintext?
- Does the database need to search the protected field?
- Does infrastructure administration need to be excluded from plaintext?
- What is the recovery requirement?
- What is the acceptable key blast radius?
- How much operational complexity can the team maintain safely?
Then choose the smallest sufficient combination of transport, storage and application-layer encryption.
120. Decision gate: managed KMS or dedicated HSM?
A managed KMS is often appropriate when the organisation needs strong managed key protection, policy, audit and integration without operating dedicated cryptographic hardware.
A dedicated or customer-controlled HSM can be appropriate when:
- non-extractable key custody is a hard requirement;
- special cryptographic operations are required;
- compliance/custody demands stronger dedicated boundaries;
- the organisation has the expertise to operate HSM lifecycle safely.
Do not choose HSMs because “more hardware” sounds more secure. Operational mistakes in cluster backup, quorum, migration or administration can create serious availability risk.
121. Decision gate: rotate, rewrap or re-encrypt?
Use rotation when new key material should become active.
Use rewrapping when the DEK remains trusted but should be protected by a new KEK.
Use re-encryption when the data key, algorithm, ciphertext or compromise scope requires fresh encryption.
These operations can occur together, but they solve different layers.
122. Decision gate: should this key be recoverable?
Ask:
- Would key loss destroy important data?
- Can the data be regenerated from an authoritative source?
- Does recovery create an unacceptable extra attack path?
- Can escrow be protected under dual control?
- How long must historical ciphertext remain decryptable?
Ephemeral session keys and long-lived archive keys should not share one recovery policy by default.
123. Decision gate: is this key safe to destroy?
Before final destruction, verify:
- No live object requires the key.
- No retained backup requires the key unless intentional cryptographic erasure is approved.
- No wrapped child key still depends on it.
- No legal/operational hold requires recovery.
- No escrow copy remains unless its retention is intentional.
- The destruction authority is correct.
- The resulting loss of access matches policy.
124. Encryption architecture checklist
- What threat is encryption addressing?
- Which layers encrypt the data?
- Where does plaintext exist?
- Which algorithm/mode is approved?
- How are nonces/IVs managed?
- What associated data is authenticated?
- What is the DEK scope?
- What is the KEK scope?
- Where is the KEK protected?
- Can high-level keys be exported?
- Which identities can encrypt, decrypt, rotate and destroy?
- How is key use audited?
- How does search/indexing work over encrypted fields?
- How are backups encrypted and recovered?
- How does the design survive KMS/HSM outage?
125. Key lifecycle checklist
- Who owns the key?
- What purpose may it serve?
- When was it generated?
- Which version is active for new encryption?
- Which historical versions remain in use?
- What rotation policy applies?
- Which dependent services have adopted the new version?
- Which wrapped DEKs remain under old versions?
- Which backups require historical versions?
- How is compromise handled?
- What recovery path exists?
- What would prove that recovery works?
- How is disablement distinguished from destruction?
- What evidence is required before final destruction?
- Can the estate migrate to a new algorithm or KMS provider?
126. Key-compromise incident checklist
- Identify exact key and version.
- Determine material compromise versus use-path compromise.
- Contain compromised identities.
- Measure cached/delegated decrypt capability.
- Identify protected datasets and wrapped child keys.
- Review decrypt/export logs.
- Decide whether to disable, rotate, rewrap or re-encrypt.
- Preserve evidence.
- Assess plaintext exfiltration rather than assuming ciphertext protection prevented it.
- Check backups, replicas, exports and third parties.
- Verify the repaired decryption path.
- Review access policy and separation of duties.
- Record the final key state.
- Trigger applicable notification/governance processes.
- Add regression controls.
127. A maturity ladder
- Encrypted: basic storage and transport protection exist.
- Key-separated: keys are not stored casually beside ciphertext.
- Envelope-managed: DEKs and KEKs have explicit hierarchy.
- Least-privileged: use and administration are separated.
- Version-aware: rotation and historical decryption are controlled.
- Recoverable: backups include tested key dependencies.
- Compromise-ready: material/use-path incidents have distinct response routes.
- Crypto-agile: algorithms, providers and key hierarchies can migrate without losing data.
128. Teaching workshop: identify what encryption does—and does not—prove
Exercise 1: encrypted disk
A database volume uses full-disk encryption. An attacker steals the powered-off drive. What does the control help with?
Suggested answer: it can protect the raw stored blocks from ordinary reading without the unlock key. It does not prove the running database is safe from a compromised database/application account.
Exercise 2: TLS everywhere
An API uses TLS from browser to load balancer and plaintext HTTP from load balancer to application inside a private network. Can the team say “encrypted in transit end to end”?
Suggested answer: not accurately. The first hop is encrypted; the second hop is not. The team should name the transport boundary precisely.
Exercise 3: rotate versus re-encrypt
A KEK rotates from version 4 to version 5. Old DEKs remain wrapped under version 4. Has the old data been re-encrypted?
Suggested answer: no. A new KEK version exists, but old envelopes still depend on version 4 until rewrapped or otherwise migrated.
Exercise 4: destroy too early
Production shows zero decrypt calls to version 3 for 30 days. Can the key be destroyed?
Suggested answer: not from that fact alone. Retained backups, annual archives, offline exports or legal-hold copies may still require it. The observation window only covers visible production usage.
Exercise 5: KMS key never exported
A KMS master key never leaves its HSM-backed boundary. A service role with decrypt permission is compromised. Is plaintext safe?
Suggested answer: not necessarily. The attacker may use the legitimate decrypt API even without exporting key material. Identity and authorisation remain part of the security model.
Exercise 6: crypto-erasure
A tenant-specific KEK is destroyed, but a CSV export created last month contains plaintext records. Is the tenant’s data cryptographically erased everywhere?
Suggested answer: no. The encrypted population dependent on the destroyed key may be inaccessible, but the plaintext export is a separate copy outside that protection route.
Exercise 7: one key for every tenant
Why might a platform avoid one global KEK?
Suggested answer: compromise or accidental destruction would have very large blast radius. More granular keys can improve isolation, though they increase management complexity.
Exercise 8: backup test
The backup file restored successfully, but no historical KMS key versions are available. Is recovery complete?
Suggested answer: no. The ciphertext exists but cannot yet be proven decryptable. Recovery requires the key path as well as the data bytes.
129. Primary-source reading guide
The following sources support the standards and platform examples used above. They do not prove that any particular deployment satisfies the full architecture described here.
- NIST SP 800-57 Part 1 Rev. 5 — Recommendation for Key Management: General.
- NIST FIPS 140-3 — Security Requirements for Cryptographic Modules.
- AWS KMS — Cryptography essentials and envelope encryption.
- AWS KMS — Key hierarchy.
- Google Cloud KMS — Envelope encryption.
- Google Cloud KMS — Key rotation.
- Google Cloud KMS — Re-encrypting data.
- Microsoft Azure Key Vault — Key rotation.
- Microsoft Azure Key Vault — Key workload migration.
- AWS CloudHSM — Key management best practices.
Cryptographic recommendations and service capabilities change. Check the exact platform, region, service integration, validation status and current standards before implementing a high-consequence design.
130. The deeper principle: the key is part of the data system
Encryption is often drawn as a lock icon beside a database. That picture hides the operational truth. The lock has a key, the key has an owner, the owner has credentials, the credentials have a lifecycle, the key has versions, the versions protect different ciphertext populations, backups preserve old dependencies, applications cache decrypted material, and recovery needs the whole chain to remain coherent.
That is why key management is not a supporting footnote to encryption. It is the operating system that determines whether encryption actually protects data without destroying availability.
The strongest design keeps five statements simultaneously true:
- unauthorised possession of ciphertext does not reveal plaintext;
- authorised workloads can decrypt only within justified scope;
- keys can change without silently losing old data;
- compromise can be contained and investigated;
- recovery can reconstruct the exact cryptographic dependencies needed to restore service.
Final idea: encrypt the data, but govern the key as if it were the concentrated form of every ciphertext it can unlock—because operationally, that is what it becomes.
Data Management Series
- What Is Data Management?
- Data Security and Privacy
- Data Access Governance and Entitlements
- Data Backup, Recovery and Resilience
- Data Deletion and Destruction Verification
- Data Masking, Tokenisation and De-Identification
- Data Dependency and Impact Analysis
Data Management Series · DATA.MANAGEMENT.063 · Educational technical edition.
