← Back to section · Digital Security

Cloud KMS and BYOK: Who Actually Holds the Keys

How envelope encryption and key hierarchies work in cloud key management services, and the real trade-offs of BYOK, HYOK and external key management in control, availability and compliance.

Published 22 November 2026 · 5 min read · PQ Frontier

Cloud KMS and BYOK: Who Actually Holds the Keys
AI-generated site artwork
Video explainer · Cloud Security: Workloads and Shared Responsibility

Why the cloud needs dedicated key management

Encrypting data before it goes into the cloud is only the first step. The next question arrives immediately: where do the keys live? If keys sit in the same system as the ciphertext, encryption is just one more door guarded by the same lock; if keys are scattered through configuration files on application servers, rotation, auditing and revocation all turn into nightmares. A cloud key management service (KMS) exists to answer this question: it keeps root keys inside hardware security modules (HSMs) and exposes only an API of the form “encrypt or decrypt this small blob with that key”. The key material itself never leaves the hardware boundary in plaintext.

The flow an application sees usually works like this: the application asks the KMS to generate a data key, and receives both the plaintext key and a copy wrapped by the root key. The application encrypts its data locally with the plaintext data key, erases it from memory, and stores only the wrapped data key alongside the ciphertext. To decrypt later, it sends the wrapped data key back to the KMS to recover the plaintext. This structure is envelope encryption: the heavy work of encrypting bulk data happens locally, while the KMS only ever handles a few hundred bytes of key wrapping, which keeps performance and cost under control.

Envelope encryption and the key hierarchy

The point of envelope encryption is the hierarchy. At the bottom are data keys (DEKs), created per object and used once; above them sits the root key (vendors use various names, often master key or KEK), whose only job is to wrap and unwrap data keys. Root keys are few, rarely rotated, and tightly protected by the HSM; data keys are numerous and can be replaced freely. This division of labour buys two concrete benefits. First, rotating a root key does not require re-encrypting all historical data — the data keys simply get re-wrapped under the new root key. Second, audit logs get a natural choke point: every call that unwraps a data key is recorded, so who unlocked which batch of data, and when, is visible at a glance.

It is worth being precise about what envelope encryption does and does not do. It provides centralised key management and auditability; it is not automatically security. If an application’s credentials are stolen, the attacker can call the decrypt API with a legitimate identity — so the real line of defence is the KMS access policy: which identities, under what conditions, may perform which operations on which root keys. The cryptography is what gives that policy a place to stand.

BYOK: what bringing your own key actually changes

In the default model, the cloud provider generates and hosts the root keys, and you barely notice they exist. Bring Your Own Key (BYOK) lets you import key material generated in your own environment into the KMS as the source of a root key. It changes three things of substance. First, provable provenance: the key is generated in your own HSM or offline environment, so the generation process can be audited and the quality of the randomness demonstrated. Second, the power of revocation: delete the imported material and the corresponding root key in the cloud becomes unusable immediately, rendering everything wrapped under it unreadable — the closest thing to a one-click destruction of cloud data, and particularly valuable at contract termination or during a major incident. Third, compliance alignment: some industry regulations require keys to be generated by, and remain under the control of, the data owner, and BYOK is the common route to satisfying such clauses.

The costs are equally concrete. Part of the availability responsibility moves back to you: if imported material is lost with no backup, the data is permanently gone and the provider cannot rescue it. Import, rotation and expiry management become processes you must run yourself. And one point of clarity: BYOK changes where the key comes from and who can kill it. Data being processed in the cloud is still decrypted into plaintext in cloud memory, so BYOK protects against loss of control at the key layer, not against observation at the compute layer.

HYOK and external key management: root keys outside the cloud

The step beyond is Hold Your Own Key (HYOK) and external key management: the root key never enters the cloud at all. It stays in your own data centre or a third-party key store, and whenever a cloud service needs to unwrap a data key, it must call out to the external key system to complete the operation. Control is at its strongest: cut the connection and all cloud data becomes unreadable at once, and the complete usage log of the key stays in your hands.

The price is the most tangible of the three models. Every cryptographic operation gains a cross-network call, adding latency and failure points; if the external key system goes down or the network path breaks, the cloud workloads behind it stop too — the cloud’s high-availability architecture ends up hanging off one private line and your own machine room. This model is therefore normally reserved for the small subset of workloads under the heaviest regulatory pressure with the most sensitive data, not as a fleet-wide default. The common engineering compromise is tiering: ordinary data on cloud-native KMS, regulated data on BYOK, and only a small core on external key management.

Four questions to ask before choosing

First: if this key is revoked or deleted, how much data unavailability can the business tolerate, and what is the recovery path? Second: how long are key usage audit logs retained, and can they be exported into your own systems for long-term keeping? Third: is rotation automatic or manual, how many historical versions are kept, and who owns the risk that old data cannot be unwrapped? Fourth — the one most often overlooked: how algorithm-agile is this key system? Can the algorithms behind root and data keys be upgraded smoothly towards post-quantum requirements, and how far has the provider’s KMS actually got in supporting new algorithms such as ML-KEM? Keys are the master switch for data security in the cloud; asking these four questions at selection time is far cheaper than retrofitting the answers later.

Tags: Cloud KMSBYOKEnvelope EncryptionKey Management