Skip to content
Ylabator

Customer-Managed Keys and Revocation

Disabling a customer-managed key stops new decrypt operations. It cannot recall plaintext already copied into logs, exports or caches, so key control is only as complete as your inventory of plaintext paths.

Topics
Confidential Computing
Level
Founder / builder
Read
4 min
Published
2026-11-12
Reviewed
2026-11-12
Post-launch queue

The problem

In September 2025, NIST published SP 800-88 Revision 2, its guidelines for media sanitization [1]. NIST's announcement noted that apart from cryptographic erase, which is commonly used across all encrypted media, the revision replaced its technique and tool details with references to other standards [2]. Cryptographic erase is the one method NIST kept describing in its own text: destroy the key, and every copy encrypted under it becomes unreadable at once.

That is the promise behind customer-managed keys in AI products. Hold the key, and you can end a vendor's access by revoking it. Enterprises ask for it when an AI vendor contract might end, or when a regulator expects deletion to reach backups.

The promise has a precondition the sales deck skips: every copy must be encrypted under that key. An AI system makes copies constantly. Prompts land in invocation logs. Retrieved passages land in traces. Users export answers to spreadsheets. A support engineer pastes an error payload into a ticket. When the contract ends and the key is disabled, the encrypted stores go dark and the plaintext copies stay readable. An illustrative case: an enterprise revokes its key on the last day of a contract and finds full prompts in the vendor's observability tool a month later.

How it works

The diagram shows envelope encryption, the pattern cloud key services such as AWS KMS use to protect data at scale.

A key encryption key (KEK) lives in the key management service and never leaves it. It is the customer-managed key. The KEK wraps data keys, one per dataset or object. Each data key encrypts the actual records: the vector index, the memory store, the file uploads, the backups. The wrapped data key is stored next to the ciphertext. To read a record, a service calls the key service to unwrap the data key, then decrypts locally.

A service identity holds a scoped decrypt grant: permission to unwrap data keys for one dataset, from one role, under one encryption context. Operators should not hold decrypt rights at all. Revocation works by removing that grant or disabling the KEK.

Timing is the first trap. AWS documents that disabling a KMS key takes effect almost immediately for cryptographic operations, but the effect on data keys, and on data encrypted by them, is delayed until the KMS key is used again [3]. Its example is an encrypted EBS volume: the data key stays in the Nitro hardware while the volume is attached, so the instance keeps reading and writing after the key is disabled. Only the next attach fails [3]. Any AI service that caches unwrapped data keys behaves the same way.

The second trap is in the diagram's lower right: copied plaintext. Logs and exports sit outside key control unless they were written to a store encrypted under the same key. Deleting a key is also final. AWS requires a waiting period of 7 to 30 days before deletion, after which data encrypted under the key is unrecoverable [4].

Envelope encryption and the limits of revocation

Fig. 13
  1. Key encryption keyCustomer-managed
  2. Data keysPer dataset
  3. Encrypted dataStores and backups
Service identityScoped decrypt grant
Copied plaintextLogs and exports: outside key control
Disabling a customer-managed key stops new decrypt operations. It cannot recall plaintext already copied into logs or exports.
Technical detail

Inventory data keys, key encryption keys, operators, grants, rotation, deletion schedules and recovery procedures. Scope decrypt rights to service identities, and test key disablement in staging before relying on it.

By the numbers

mandatory waiting period before AWS deletes a KMS key, 30 by default [4]
7 to 30 days
extra delay beyond the scheduled deletion date [4]
up to 24 hours
Microsoft-managed encryption always applied to stored Foundry data, with customer-managed keys as an option [5]
AES-256
size of request and response bodies held inline in each Bedrock invocation log record [6]
100 KB
PathReached by key revocationNote
Stores encrypted with wrapped data keysYes, at the next unwrapCached data keys keep working until reload [3]
Foundry stateful features (Responses API, threads, files)Yes, if CMK is configuredSome preview features may not support CMK [5]
Bedrock invocation logsOnly if the log group or bucket uses your keyKept until the logging configuration is deleted [6]
Tags and name fieldsNoMay be used in billing or diagnostic logs [7]
Exports, tickets, copied textNoOutside every key service
Plaintext paths and whether disabling the customer key reaches them, as documented in November 2026 [3][5][6][7]

The stats say revocation is slow by design and deletion is irreversible by design. The table says where revocation never arrives. Two of five paths are outside any key, and one more depends on a logging choice that is off by default and easy to turn on without thinking about encryption [6].

Implementation

Encrypt application data yourself with envelope encryption, so the key boundary covers your own stores and not only the vendor's. The sketch uses AWS KMS for the KEK and AES-GCM for records. The encryption context binds each wrapped key to its dataset, and a key policy can require that context, so a grant for one dataset cannot unwrap another.

envelope.pypython
import os
import boto3
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

kms = boto3.client("kms", region_name="eu-central-1")
KEK = "alias/ai-memory-prod"          # customer-managed key, never leaves KMS

def encrypt_record(plaintext: bytes, dataset: str) -> dict:
    ctx = {"dataset": dataset}        # must match again on decrypt
    dk = kms.generate_data_key(KeyId=KEK, KeySpec="AES_256", EncryptionContext=ctx)
    nonce = os.urandom(12)
    ciphertext = AESGCM(dk["Plaintext"]).encrypt(nonce, plaintext, dataset.encode())
    # Store only the wrapped key. The plaintext data key is dropped here.
    return {"wrapped_key": dk["CiphertextBlob"], "nonce": nonce,
            "ciphertext": ciphertext, "dataset": dataset}

def decrypt_record(rec: dict) -> bytes:
    dk = kms.decrypt(
        CiphertextBlob=rec["wrapped_key"],
        EncryptionContext={"dataset": rec["dataset"]},
        KeyId=KEK,
    )
    return AESGCM(dk["Plaintext"]).decrypt(rec["nonce"], rec["ciphertext"],
                                           rec["dataset"].encode())

Do not cache unwrapped data keys longer than a request unless you have measured the cost. Every cache extends the time between revocation and effect [3].

Then build the inventory the diagram's detail calls for: data keys, KEKs, operators, grants, rotation, deletion schedules and recovery procedures. Scope decrypt rights to service identities, never to people. For each vendor, ask which of its stores use your key, which use its own, and which preview features are excluded [5]. For your own logging, point invocation logs and traces at destinations encrypted with the same KEK, or redact content before it is written [6]. Keep sensitive values out of tags and resource names [7].

Test it

Disable the key in staging and observe. The drill below confirms that new decrypts fail, measures whether anything still serves plaintext, and searches your logs for a canary that should never have been written in clear.

revocation_drill.pypython
import time
import boto3
from envelope import encrypt_record, decrypt_record, kms   # same KMS client

logs = boto3.client("logs", region_name="eu-central-1")
KEY_ID = "1234abcd-12ab-34cd-56ef-1234567890ab"   # staging KEK id (DisableKey needs id or ARN)
CANARY = "CANARY-7f3c9a1e"
LOG_GROUP = "/staging/ai-app/traces"

rec = encrypt_record(f"{CANARY} board approved the sale".encode(), "memory")
assert CANARY.encode() in decrypt_record(rec)

kms.disable_key(KeyId=KEY_ID)
time.sleep(60)                                     # allow for eventual consistency
try:
    decrypt_record(rec)
    raise SystemExit("FAIL: decrypt succeeded with the key disabled")
except kms.exceptions.DisabledException:
    print("PASS: new decrypt refused")
finally:
    kms.enable_key(KeyId=KEY_ID)                   # staging only: restore the key

# Plaintext that escaped key control shows up here regardless of key state.
hits = logs.filter_log_events(logGroupName=LOG_GROUP, filterPattern=f'"{CANARY}"')
found = len(hits["events"])
print(f"canary hits in {LOG_GROUP}: {found}")
raise SystemExit(1 if found else 0)

Expected result: "new decrypt refused", then zero canary hits. A hit is a plaintext path to add to the inventory.

  • While the key is disabled, exercise the running application. Anything still answering from the encrypted store is serving a cached data key. Record how long it lasts.
  • Repeat the canary search in exports, support tooling and the vendor's own logs, through support if needed.
  • Restore from backup with the key disabled. Expect failure, then re-enable and restore.
  • Record the drill date, key ID, configuration version and every exception.

Decision

Customer-managed keys are worth requiring when you need provable revocation at contract end, or cryptographic erase as your deletion method under NIST's guidance [1].

  • Require CMK for the stores that hold content: indexes, memory, files, backups. Ask which features are excluded [5].
  • Encrypt your own logs under the same key, or redact before writing [6].
  • Treat revocation as delayed, not instant. Measure cache lifetimes in a drill [3].
  • Never schedule deletion of a production KEK without a written inventory: after 7 to 30 days it is irreversible [4].

Expect a small KMS bill and a day of engineering for the first drill. The inventory is the real cost, and it is the part that makes the key meaningful.

Sources

  1. [1]SP 800-88 Rev. 2, Guidelines for Media Sanitization (opens in a new tab)NIST, September 2025
  2. [2]Guidelines for Media Sanitization: NIST Publishes SP 800-88r2 (opens in a new tab)NIST, September 2025
  3. [3]How unusable KMS keys affect data keys (opens in a new tab)AWS, November 2026
  4. [4]Delete an AWS KMS key (opens in a new tab)AWS, November 2026
  5. [5]Data, privacy, and security for Foundry Models sold by Azure (opens in a new tab)Microsoft Learn, May 2026
  6. [6]Monitor model invocation using CloudWatch Logs and Amazon S3 (opens in a new tab)AWS, November 2026
  7. [7]Amazon Bedrock data protection (opens in a new tab)AWS, November 2026

Technical guidance, not security certification or legal advice.

All Private AI articles