
How to Ship Customer Managed Encryption Keys in Enterprise SaaS
How do you ship customer managed encryption keys for enterprise SaaS without rewriting the data layer? You wrap every tenant's data keys with a per-tenant KMS CMK, treat envelope encryption as the only write path, and expose rotation and revocation as tenant-owned operations.
The hard part is not AES. It is the governance surface around the key: who grants decrypt, how rotation propagates, what an auditor sees when a tenant revokes. AWS KMS is the implementation here, Postgres or DynamoDB behind it, a multi-tenant SaaS already in production.
What the Security Review Actually Asks For
Enterprise procurement teams have a checklist now. It is short and it is non-negotiable: the customer controls the key, can rotate it, can revoke it, and can prove it was used only when their data was accessed. GDPR Article 32 lists encryption as an appropriate technical measure, which gives legal a clean lever to insist on it. Real-world encryption coverage is thinner than most buyers assume, which is why CMEK has moved from "nice to have" to deal-gating. PCI DSS Requirement 3.7.4 wants a documented cryptoperiod per key, and NIST SP 800-57 recommends one to two years for symmetric encryption keys.
What the reviewer wants to see: a per-tenant KMS key under their control, a grant model the tenant can audit, envelope encryption for anything larger than a few kilobytes, and a revocation path that stops future decrypts within minutes. Everything else is implementation detail.
The KMS Wiring Underneath
One CMK per tenant, aliased by tenant ID. The alias (alias/tenant-acme-prod) is what application code references; the underlying key ID changes during rotation without application awareness. A KMS grant to the application role issues Decrypt and GenerateDataKey permissions scoped to that single CMK, which means a grant revoked by the tenant takes the application offline for that tenant inside of a minute.
Envelope encryption is not optional. AWS KMS caps direct Encrypt calls at a small per-request size, so the pattern is to call GenerateDataKey, encrypt bulk data locally with the plaintext DEK, store the wrapped DEK next to the ciphertext, and discard the plaintext DEK from memory. Caching the plaintext DEK for a short TTL, seconds to a few minutes, is how you keep KMS request counts and latency sane.
The data model matters. Add a kms_key_arn column at the tenant level, a dek_wrapped column at the ciphertext level, and a dek_version column so rotation can be lazy. Writing the key ARN with the record is what lets a strangler-fig migration work: new rows use the new key, old rows re-encrypt on next read. This is the same discipline that makes a multi-tenant SaaS with proper data isolation hold up under a security review.

Accepting Imported Material or a Cross-Account CMK
Customers past a certain revenue threshold want to generate the key material themselves. AWS KMS supports two paths. The first is Import Key Material: the tenant creates a KMS key with EXTERNAL origin, downloads the wrapping public key, wraps their own AES-256 material with it, and uploads. The tenant can delete the key at any time, and that control is the reason for this path.
The second is cross-account. The tenant's KMS CMK lives in their own AWS account, and your application role is granted kms:Decrypt and kms:GenerateDataKey via a key policy statement on their side plus an IAM policy on yours. Use a stable role ARN per environment so the tenant's security team can write a policy they understand. Log the external account ID on every grant, every alias change, and every rotation.
External Key Store exists for the small set of customers who want key material in an on-prem HSM entirely outside AWS. It adds latency and operational burden. Take it only when a specific deal demands it, not as a default offering.
Rotation, Revocation, and the Audit Trail
AWS KMS automatic rotation runs on a defined cadence, with AWS-managed key rotation tightened substantially in 2022. For data that matters, expose a tenant-triggered on-demand rotation that generates a new DEK on every write and lazily re-wraps old DEKs on next read. Match the cryptoperiod the tenant's own policy declares, which is almost always between one and two years.
Revocation is where most implementations are thin. Revoking a grant stops new Decrypt calls quickly, but anything already decrypted and sitting in a cache or a logs pipeline is out of scope. Document the cache TTL in the security addendum, because the reviewer will ask. For harder revocation, the tenant disables or schedules deletion of their CMK; your reads start failing with AccessDeniedException, which is exactly what they want to prove to their board.
Every KMS API call lands in CloudTrail with the caller identity, the CMK, the encryption context, and the request time. Attach the tenant ID to the encryption context on every GenerateDataKey call. The reviewer will want to filter CloudTrail by their tenant ID, not by your service.
Performance, Cost, and the 4 KB Ceiling
The direct-Encrypt size limit is why envelope encryption exists; it is also why you cache DEKs. A hot write path calling GenerateDataKey on every insert will burn request budget and add 10 to 30 ms per operation. The pattern that holds up: a per-tenant DEK cache keyed by key ARN and version, short TTL, mandatory flush on rotation event, and a circuit breaker on KMS throttling errors.
Cost is predictable. A tenant with a thousand customers and a twenty-second DEK cache rarely crosses $50 per month in KMS fees. Fortune 500 security teams do not negotiate this line; it is below their noise floor. The budget pressure lives in the data layer refactor, not in KMS billing.
Where CMEK Sits in the Control Stack
CMEK is one control inside a broader tenant isolation story. Row-level security and tenant-scoped IAM live behind the key. SCIM provisioning controls who gets issued a role at all, and zero trust segmentation controls what that role can reach. Sell the key as a parameter the tenant owns; sell the rest as the surface around it.
The build is usually a two to four week effort for a team with clean service boundaries and a single data access layer. If encryption is scattered across the codebase, the cost is in the refactor, not the KMS calls. The honest estimate usually starts with an API architecture review that maps every call site touching encrypted fields before a single KMS alias is created.
The Number to Watch
Measure the time from a tenant revoking a grant to the last successful Decrypt in your logs. Under two minutes is what a serious security review will accept. Over ten minutes, and the control is theater: the DEK cache is too long, the audit lag is too wide, or the application is holding plaintext material it should not. Rotation schedules and FIPS validation get checked once a year by an auditor. Revocation latency gets checked during the deal, and it is the number that keeps a mid-market SaaS vendor from losing a Fortune 500 account to the vendor who already built it.
