Lion Cipher Lab

Envelope encryption for free: run your own KMS with Vault's transit engine

Why it matters

Almost every serious system you will ever touch encrypts its data with envelope encryption, and almost nobody can explain it. S3, EBS, RDS, BigQuery, Azure Storage, Kubernetes secrets-at-rest, backup tools, disk encryption — all of them generate a throwaway key for the data and then encrypt that key with a key they never let out of a vault. If you cannot draw that two-layer picture, cloud encryption questions in interviews go badly and, worse, you will design something that either leaks keys or falls over under load. The reason this is normally hard to learn is money: a cloud KMS key costs a…

What you'll learn

Steps in this lab

  1. What a KMS is, and why we are faking one on your laptop
  2. Start a Vault dev server in Docker (and understand what you just accepted)
  3. Enable transit, make a key, and encrypt something small
  4. Hit the wall on purpose: try to push a big file through the KMS
  5. Envelope encryption, done properly — the vocabulary and then the deed
  6. Get it back: unwrap the data key and decrypt the file
  7. Rotate, rewrap, retire — the part almost no tutorial teaches
  8. Translate it: the same six moves in AWS, Google Cloud and Azure
  9. Why this, not that — when a KMS is the wrong answer
  10. Clean up, and what you should be able to draw now

Open the full interactive lab →