Your Customer Revoked the Key. Why Can You Still Read the Data?
Opened data keys can outlive the kill switch, so FDEs should time it before agreeing to let customers hold their own encryption keys.
In brief
- Key revocation has a delay: add up KMS propagation time, cache TTL and the task that holds a key longest.
- On AWS, deleted key material can be reimported; once the symmetric KMS key itself is deleted, the data is beyond rescue even if you still have the original material.
- Losing the connection to KMS and having a key revoked are two different incidents, and code must handle them separately.
Make an AWS KMS key unusable, and an EC2 instance with an attached EBS volume encrypted under that key keeps reading and writing as normal. AWS documentation explains why: EC2 encrypts disk I/O with a data key held in the Nitro hardware. Only after the volume is detached does the next attempt to attach it fail, until the key becomes usable again.
Customer security teams often think of revocation as pulling a plug. When they ask in a security review to hold their own keys, they are asking to buy a kill switch. If you answer “supported” without knowing how long that switch takes to work, you have promised something nobody has measured.
An FDE therefore owes the customer three answers: how long until the data can no longer be read, what breaks at that point, and how to come back. All three follow from one mechanism.
The customer’s key rarely touches the data
In envelope encryption, a data key encrypts the data, and the customer’s key encrypts that data key. The application asks KMS to open the data key, then uses it in memory. Revoking the root key blocks the next opening; data keys that are already open remain intact.
Holding on to the data key is a reasonable choice. Slack engineers have described how their enterprise key management service caches data keys in memory for five minutes, instead of calling AWS KMS for every message or file, to balance cache hit rate, performance and KMS call limits.
A shorter TTL gives the customer a faster cutoff at the price of more calls.
Customers also tend to call everything “BYOK”. Bring them back to who holds the key material, because that determines who carries the risk:
| Model | Where the key lives | What the customer takes on |
|---|---|---|
| Standard CMK | In KMS; on AWS, KMS generates the material by default | Managing usage permissions, and disabling and deleting keys |
| BYOK on AWS | The customer imports material into an empty KMS key | Keeping a backup outside AWS; if it is permanently lost, decryption is no longer possible |
| AWS External Key Store | In a key management system outside AWS | Availability and latency every time the key is needed |
On the last row, AWS itself warns that the availability and latency risks outweigh the security benefits for most customers. Before accepting that request, ask which regulation requires it. If the answer is “we want to be able to cut access”, CMK may already be enough.
Switched off at 9:00, unreadable at 9:46
Take a hypothetical example: you deploy a document search service that uses the customer’s key in Google Cloud KMS. The application caches data keys for 300 seconds, and a background job takes a data key and then works for 40 minutes straight. The customer disables the key version at 09:00:00.
Google says a newly disabled version typically remains usable for up to one minute. A request at 09:00:59 can therefore still open a data key and cache it until 09:05:59. If the background job takes the key from the cache at 09:05:58, it goes on reading data until 09:45:58.
The formula is propagation time, plus TTL, plus the task that holds a key longest: 1 + 5 + 40, or about 46 minutes. That is the typical case and no ceiling: Google says operations with this kind of propagation time can take hours in exceptional cases. Removing IAM permissions takes effect within seconds, but it only cuts the smallest term.
The largest term is the one to fix. Have the job fetch its key again every 60 seconds and lower the TTL to 60 seconds, and the total falls to about three minutes.
The cost: under steady traffic, each data key on each process goes from 12 to 60 KMS calls an hour. If each tenant has just one data key, 40 tenants across 5 processes go from 2,400 to 12,000 calls an hour. With more data keys, multiply again.
A silent KMS does not mean the key was revoked
A network outage and a revoked permission can look the same at the application layer, but they call for different responses.
MongoDB Atlas checks the customer’s KMS configuration every 15 minutes. If credentials become invalid, or the key is deleted or disabled, the next check shuts down the database processes.
When Atlas cannot connect to KMS, or suspects a false alarm, it does not shut them down.
You can build the same distinction into your own cache. The two error classes below are custom; an adapter translates each provider’s errors into them:
import time
class KeyRevoked(Exception): pass
class KmsUnreachable(Exception): pass
class DataKeyCache:
def __init__(self, kms, ttl=60, clock=time.monotonic):
self.kms, self.ttl, self.clock = kms, ttl, clock
self.items = {}
def get(self, tenant, wrapped):
now = self.clock() # measure age from before the KMS call
hit = self.items.get((tenant, wrapped))
if hit and now - hit[1] < self.ttl:
return hit[0]
self.items.pop((tenant, wrapped), None)
try:
plain = self.kms.decrypt(wrapped)
except KeyRevoked:
self.drop(tenant) # drop every key for this tenant
raise
self.items[(tenant, wrapped)] = (plain, now)
return plain
def drop(self, tenant):
for k in [k for k in self.items if k[0] == tenant]:
del self.items[k]
On KeyRevoked, the process deletes all of the tenant’s data keys, stops serving that tenant and alerts the right person. On KmsUnreachable, the error propagates so that the layer above can retry; unexpired keys still work, but their lifetime is not extended. If you keep stretching the TTL while KMS is silent, anyone who can block the network can also keep read access.
This code does not sweep out expired keys that nobody asks for, and each process has its own cache. For real use, add a periodic cleanup loop, then measure across every process.
Write a promise others can check
Start with a question for the customer’s security lead: “When you disable the key, what must stop, within how many minutes, and who is allowed to turn it back on?” Then map the data key’s path, add up the terms and fix the largest. Finally, run a trial on a test key and put the results into this template:
KEY REVOCATION COMMITMENT: <customer / environment>
Revocation action: <disable key version | remove IAM permission>
Authorized operator: <customer-side role>
Reads/writes stop after: <target> minutes; measured <result>, on <...>
Exceptions: <KMS provider delays>
Users will see: <error code, message>
Out of scope: <existing data, indexes, logs, backups>
Recovery: <who enables the key, startup order, how to verify>
Partially written data: <where it is held, how much may be lost>
The timeline has to be specific because products differ. OpenAI’s guidance is to wait about an hour for caches to expire before testing revocation. After that, ChatGPT Enterprise users cannot read old conversations, while API users lose access to earlier batch files and fine-tuned models. Atlassian says suspending a site typically takes up to 30 minutes or an hour.
There is precedent for the last line, too: Atlassian warns of the possible loss of up to an hour of data from before the revocation, and allows recovery only within a set period. If your customer cannot accept losing a single record, find out before you design the write queue.
Four mistakes to avoid
Confusing disabling with deleting. This is the most expensive mistake. On AWS, deleting imported material can be reversed by importing it again. Deleting the KMS key itself cannot: with a symmetric encryption key, the remaining ciphertext is lost for good even if the customer still holds the exact original material.
AWS enforces a waiting period of 7 to 30 days, 30 by default, and lets you cancel the deletion during that time, but the key is unusable from the moment the wait begins. Azure Storage, for its part, requires soft delete and purge protection to be enabled on the key vault. Put these safeguards on your deployment checklist.
Assuming that turning on CMK protects old data. With Azure Databricks managed services, existing data is not re-encrypted when a key is first added. Before go-live, ask which key covers the data from the pilot phase.
Testing with a single request. Azure Storage returns 403 for read and write operations on its blocked list, but data operations outside that list may still run. Databricks keeps the data key in memory, so reads and writes fail only once the cache interval has passed.
Forgetting plaintext that has left the encrypted zone. Excerpts in a search index, or content that has slipped into logs, do not vanish when the key is disabled. Encrypt them under the same key or list them plainly under “Out of scope”.
Exercise: let the clock prove it
Write a fake KMS in which each tenant has three states: active, revoked and disconnected. Pass a fake clock to DataKeyCache, load two data keys for each of tenants A and B, then write two tests.
The first test revokes A: from second 60, A’s next call is rejected and the cache is cleared of A’s keys, while B keeps running.
The second cuts the connection: from second 60, the cache no longer returns any old data key, although keys nobody has asked for may still sit in memory.
To clear those as well, add a cleanup loop and give it its own test.
Then repeat the exercise with a real KMS in a test environment: write down your prediction, disable the key and time the last successful request. On your resume, go beyond “KMS experience”. State how you tested key revocation, the delay before and after your fix, and the additional KMS calls it cost.
When a job posting mentions tenant isolation, security reviews or deploying in a customer’s VPC, be ready to tell that story.
One day the customer will press the button, perhaps for a drill, perhaps for a real incident. People will then check the clock against the number you wrote down.
Was this article useful?
Thanks for the feedback!
12 sources
- Importing key material for AWS KMS keys
- Protecting imported key material
- Delete an AWS KMS key
- How unusable KMS keys affect data keys
- External key stores - AWS Key Management Service
- Customer-managed keys for account encryption - Azure Storage | Microsoft Learn · 2026-08-18
- Cloud KMS resource consistency
- Customer-managed keys for managed services - Azure Databricks | Microsoft Learn · 2026-11-12
- Engineering dive into Slack Enterprise Key Management · 2019-03-18
- Encryption at Rest using Customer Key Management
- EKM KMS key lifecycle
- Revoke Atlassian access to your KMS encryption keys