Explainer

What is envelope encryption? A plain-English guide

Envelope encryption protects data with a data key, then locks that key with a master key. Learn how it works, why it helps, and where teams go wrong.

By the Cloudverg engineering team · · 5 min read

What it is

Envelope encryption is a way of protecting data with two layers of keys. First, a data key encrypts your actual data: a file, a database row, a backup. Then a second key, usually called the master key or key-encryption key, encrypts that data key. The encrypted data key gets stored right next to the data it protects.

The name comes from the paper version. The data is the letter. The data key seals the letter. The master key seals the envelope that holds the sealed letter's key. Anyone who finds the letter and the envelope still can't read anything without the master key.

Why not just encrypt everything with one master key? Because master keys are precious and you want them touched as rarely as possible. Envelope encryption lets the big, bulk work happen with disposable keys, while the one key that matters stays locked away and does a tiny job.

How it works

Say your app needs to save a customer file. It asks your key service for a fresh data key. The service hands back two copies: a plaintext version and a version already encrypted under the master key. Your app uses the plaintext key to encrypt the file, using a fast symmetric cipher such as AES-256 in an authenticated mode like GCM. Then it throws the plaintext key away from memory and saves the encrypted copy alongside the file.

To read the file later, the app sends the encrypted data key back to the key service. The service decrypts it with the master key and returns the plaintext data key. The app decrypts the file, uses it, and discards the key again. The master key never leaves the key service, and your app never sees it.

Two details are worth knowing. First, the heavy lifting (encrypting gigabytes) happens locally in your app, so you aren't shipping large files to the key service on every request. Only the tiny data key travels. Second, you can use a different data key for each file, each customer, or each day. If one data key leaks, only what it protected is exposed.

Most major clouds build this in. Their storage and database services generate and wrap data keys for you, and you control the master key through the provider's key management service. You can also do the same thing yourself with a crypto library when you need to.

Why it matters for a business

The biggest win is key rotation. If you encrypted ten terabytes directly under one master key, rotating that key would mean re-encrypting all ten terabytes. With envelope encryption, you only re-wrap the small data keys under a new master key. The bulk data stays untouched. That turns a painful project into a routine task you can schedule.

It also shrinks the blast radius and gives you a clean control point. Access to the master key is governed by permissions and logged. You can see who asked for a decrypt and when. If you need to cut off access, say after an employee leaves or an account is compromised, you can disable the master key or deny the permission, and every data key wrapped under it becomes unusable at once.

For customer security questionnaires and audits, this is a common thing to be asked about. Being able to say who controls the master key, how often it rotates, and where decrypt calls are logged is a much stronger answer than 'the disk is encrypted.' It also supports separation of duties: the team running the app doesn't need to be the team holding the master key.

Common mistakes

The most frequent one is storing the plaintext data key. If your app writes the unwrapped key to a log, a config file, or a debug dump, the whole scheme is undone. Keep plaintext keys in memory only, for as short a time as possible, and check that your logging and crash reports can't capture them.

Another is giving too many people or services permission to decrypt. If every role in the account can call decrypt on the master key, then the master key protects very little. Scope decrypt rights to the specific services that need them, and keep key administration (who can change or delete the key) separate from key usage (who can decrypt with it).

Teams also forget about the master key's own lifecycle. Deleting a master key by accident makes every wrapped data key, and therefore all the data, permanently unreadable. Use deletion waiting periods and alerts where your provider supports them. And make sure backups of encrypted data can still be decrypted: a backup is useless if the key that unwraps it lives only in the account that just got lost.

Finally, don't invent your own cipher setup. Use well-reviewed libraries and your provider's built-in features rather than writing custom crypto glue.

How to get started

Start by finding out what you already have. Most managed storage, databases and queues in the big clouds already use envelope encryption by default, with a provider-managed master key. Check each service's encryption setting and note where it's on, where it's off, and whose key is in use.

Next, decide where a customer-managed master key is worth it. That choice gives you control over rotation, access policy and audit logs, and it makes sense for sensitive data like customer records, financial data and backups. Turn on automatic rotation, write a tight key policy, and send decrypt events to your logging so you can alert on odd activity.

If you'd like an outside check, Cloudverg offers a Cloud security review at $6,500/month (fixed scope, 2 to 3 weeks, renews monthly until cancelled). It includes a read-only review of up to 5 cloud accounts or subscriptions, with encryption checks alongside identity, exposure and logging, plus a ranked fix list. It's one option next to doing the review in-house or hiring another firm.

Frequently asked questions

What is the difference between envelope encryption and regular encryption?

Regular encryption uses one key directly on the data. Envelope encryption uses a data key on the data and a separate master key to protect that data key. This makes key rotation cheaper and keeps the master key out of day-to-day use.

Do I need to build envelope encryption myself?

Usually not. Major cloud storage and database services do it automatically, and their key management services handle the master key. You only write it yourself for custom apps that encrypt their own data, and then you should use a trusted crypto library.

What happens if I lose the master key?

Every data key wrapped under it, and so all the data it protects, becomes unreadable. That's why key deletion should have a waiting period, alerts, and a tested recovery plan. Treat the master key as one of your most important assets.

Monthly plan

Want help with this? Cloud security review

$6,500/month

2 to 3 weeks · Starts within 10 business days

A read-only review of identity, network exposure, encryption and logging across your cloud accounts, with a prioritized fix list.

Renews monthly. Cancel any time.
Prefer to pay once?

Pay $6,500 once for one month of the Cloud security review. It ends on its own, nothing renews.

What is included

Related guides

More cloud security guides   Security and compliance

Smallest way to start

Get a senior architect on your problem this week

Ninety minutes a month on the cloud, AI or security question that is blocking you, a pre-read of your material and a written summary within two business days.

$450/month

Renews monthly. Cancel any time.
Prefer to pay once?

Pay $450 once for one month of the Expert architecture session. It ends on its own, nothing renews.