A database of customer records needs encrypting, and the obvious plan is one key applied to everything. That plan has an awkward property: rotating the key means re-encrypting every row we own. So we almost never rotate it, and it sits for years in config files, in environment variables, in a handful of engineers' terminal history.
Envelope encryption splits the problem in two. A data key encrypts the actual records — generated freely, one per record or per tenant, short-lived and safe to rotate. A master key encrypts the data keys, lives inside a hardware module, and never leaves it. We can't read it either.
Reading a record means asking the key service to unwrap its data key, in memory, for that one operation. Every unwrap is logged with who, what and when. A leaked data key exposes one tenant; rotating the master key touches the small keys rather than the whole estate.
When something is too valuable to move, we stop moving it — and move the thing that points to it instead.
