Quick revision
The short answer
Customer-managed keys let an enterprise customer revoke our access to their data by disabling a key in their own KMS, which is a strong selling point for banks, healthcare and the public sector. Offering it means per-tenant keys, envelope encryption with tenant data keys wrapped by the customer's key, integration with their key management service, and services that fail safely when a key is revoked. It adds operational complexity, latency on key operations and support work, so I would decide from real customer demand and a pricing model, and design the key hierarchy before writing code.
What to remember
In this answer, we treated customer-managed keys as a business and architecture decision. They let customers revoke our access to their data, which matters to regulated buyers, but they require per-tenant keys, envelope encryption wrapped by the customer's KMS key, safe failure on revocation, and they add latency, operational dependencies and support work. We decide from real demand and pricing, and design the key hierarchy before building.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Customer-managed keys let an enterprise customer revoke our access to their data by disabling a key in their own KMS, which is a strong selling point for banks, healthcare and the public sector. Offering it means per-tenant keys, envelope encryption with tenant data keys wrapped by the customer's key, integration with their key management service, and services that fail safely when a key is revoked. It adds operational complexity, latency on key operations and support work, so I would decide from real customer demand and a pricing model, and design the key hierarchy before writing code.
Why this question is asked
"Bring your own key" appears on almost every enterprise security questionnaire, and sales teams feel the pressure when a large deal depends on it. For an engineering leader, it is a decision with long-lasting architectural consequences, because once a customer can switch off our ability to read their data, every part of the system has to cope with that. Interviewers ask this to see whether we can balance commercial value against cost and design it properly. In this answer, we will recap what customer-managed keys mean, decide whether to offer them, design the key hierarchy, handle revocation, and count the operational costs.
1A Quick Recap: Who Holds the Key
In a typical SaaS product, data is encrypted at rest with keys the provider manages, so the provider can always decrypt. With customer-managed keys (CMK), the customer creates a key in their own cloud KMS, such as AWS KMS in their own account, and grants our service permission to use it for wrapping and unwrapping. The key never leaves their KMS. Our data keys for that tenant are encrypted with it, so if the customer revokes the grant or disables the key, we can no longer unwrap the data keys, and their data becomes unreadable to us.
That is the selling point: the customer has a kill switch and an audit trail in their own KMS of every time we used their key. For regulated customers, this can be the difference between a yes and a no from their risk committee.
2Deciding Whether to Offer It
I would start with evidence, not one loud request. How many deals in the pipeline need it, and how much revenue do they represent? Is it a hard requirement or a checkbox that a strong default encryption story would satisfy? Which clouds and KMS products do those customers use, since supporting AWS, Azure and Google KMS triples the integration work?
Then the economics. CMK is usually offered in an enterprise tier or as a paid add-on, because it costs engineering time, cloud KMS charges per request and ongoing support. If three customers worth 2 million a year need it and the build costs two engineers for two quarters plus a support rota, it can pay off; if the demand is one prospect with an unclear budget, it is better to say "on the roadmap" and invest in a strong default story.
- Real demand in pipeline?YesSize it: deals, revenue, cloudsNoStrengthen default encryption story
- Revenue covers build and run cost?YesPrice as enterprise tier or add-onNoDefer, revisit next planning cycle
- Design key hierarchy firstper-tenant keys, envelope encryption
- Define revocation behaviourwhat fails, how fast, how it recovers
- Pilot with 1 or 2 customersthen general availability
5 steps in order. Play them, or step through them one at a time.
3Designing the Key Hierarchy
The design must be settled before any code, because changing a key hierarchy after data is encrypted means re-encrypting everything. The usual design has three levels. At the top is the customer's key in their KMS (the CMK). Below it, a tenant key or set of tenant data keys, wrapped by the CMK and stored by us. At the bottom, the data actually encrypted with those data keys: database fields, files in object storage, search indexes, backups.
This requires that tenants are separable everywhere: every row, file and message must be encrypted with that tenant's keys, which is hard in a shared database or a shared search index. Caches, logs, analytics copies and backups are where designs usually leak, because they often hold decrypted data outside the hierarchy. Each of them must be either encrypted per tenant or kept free of that tenant's sensitive data.
- Customer KMS key (CMK)in the customer's account; they can disable it
- Tenant key-encryption keywrapped by the CMK, cached briefly by us
- Data keysper table, bucket or time period
- Encrypted datarows, files, indexes, backups
4 layers, from the top down. Step through them one at a time.
Revoking the top layer makes everything below it unreadable to us.
4When the Customer Revokes the Key
Revocation can be deliberate (the customer leaves, or suspects a breach) or accidental (someone in their team deletes a grant). The services must fail safely: when unwrapping fails, requests for that tenant return a clear error, background jobs for that tenant stop and do not retry in a tight loop, and no other tenant is affected.
We also have to decide how fast revocation takes effect. Because we cache unwrapped keys for performance, revocation is not instant; a cache lifetime of five minutes means data can still be read for up to five minutes. That number must be in the contract. And we need a path back: if the customer re-enables the key, the tenant should recover automatically, with clear alerts to our support team and to the customer's administrators in between.
5The Operational Costs
Every read of a cold key is a call to a KMS in another account, sometimes another region, with its own latency (often 5 to 30 milliseconds) and rate limits, so caching and batching are mandatory. The customer's KMS becomes a dependency we do not control: their outage or misconfiguration becomes our incident ticket. Support needs runbooks for "my data is unavailable" that start with checking the customer's key status.
There is also engineering drag. Every new feature that stores data must be checked for the key hierarchy, and every new data store needs per-tenant encryption. That is why I would only build it with a clear commercial case, and once built, treat it as a product feature with an owner, tests that revoke keys in staging, and monitoring of key errors per tenant.
6Follow-up questions
Is customer-managed keys the same as client-side encryption?
No. With CMK we still decrypt data in our service to process it; the customer controls whether we can. With client-side or end-to-end encryption, we never see plaintext at all, which prevents server-side search and processing. CMK is a middle ground that keeps the product working.
Can we offer CMK on a shared multi-tenant database?
Yes, with application-level encryption per tenant, where each tenant's sensitive fields are encrypted with that tenant's data keys. Database-level encryption features usually work per database or per cluster, so they would force a dedicated database per CMK tenant, which is simpler to reason about but more expensive.
7Conclusion
In this answer, we treated customer-managed keys as a business and architecture decision. They let customers revoke our access to their data, which matters to regulated buyers, but they require per-tenant keys, envelope encryption wrapped by the customer's KMS key, safe failure on revocation, and they add latency, operational dependencies and support work. We decide from real demand and pricing, and design the key hierarchy before building.
Open with
Customer-managed keys mean the customer holds the top key in their own KMS and grants us permission to use it, so they can revoke our access at any time and see every use in their own audit log.
Then, if they want more
For banks and healthcare that is a strong selling point, sometimes a hard requirement. But I would not build it on one request. I would size the demand, how many deals need it, how much revenue and on which clouds, and price it as an enterprise tier or add-on, because it costs real engineering and support.
If we go ahead, I design the key hierarchy first: the customer's key wraps a tenant key, which wraps data keys, which encrypt that tenant's rows, files, indexes and backups. That needs tenant separation everywhere, including the places that usually leak, like caches, logs and analytics copies. Then I define revocation behaviour.
When we cannot unwrap the key, that tenant's requests fail with a clear error, jobs stop without retry storms, other tenants are unaffected, and recovery is automatic when the key comes back. Because we cache unwrapped keys, revocation takes effect within a stated time, say five minutes, and that goes into the contract.
Finally, I would be honest about the costs: KMS latency and rate limits, the customer's KMS as a dependency we do not control, support runbooks and a review of every new data store. With a solid commercial case it is worth doing; without one, a strong default encryption story is the better investment.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Security reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Enterprise customers ask to control the encryption keys for their data in your SaaS...": https://scrivio-interview-library.netlify.app/spring-boot/secrets-and-crypto/72960f7d05/