Build Envelope Encryption: Protect Object Storage Content with KMS Data Keys
Advanced · 30 minutes · 5 tasks, checked automatically · 100 points
In this advanced lab you will implement envelope encryption end-to-end on OCI's local emulator. Envelope encryption is the industry-standard pattern used by every major cloud provider: a short-lived *data encryption key* (DEK) is generated by KMS, used to encrypt your plaintext locally, and then the DEK itself is wrapped (encrypted) by a long-lived *key encryption key* (KEK) stored in the KMS Vault. Only the wrapped DEK is persisted alongside the ciphertext in Object Storage — the plaintext DEK never touches disk. You will create a Vault and master key, generate and wrap a DEK, simulate AES-256 encryption of a sensitive file, store both the ciphertext and the wrapped DEK as objects, and finally reverse the entire process to verify round-trip integrity. All work runs against the floci local OCI emulator — no real cloud account required.
What you’ll learn
- Create a KMS Vault and master encryption key (KEK) to act as the root of trust for envelope encryption
- Generate a data encryption key (DEK) via KMS, encrypt a sensitive payload with the plaintext DEK, then discard the plaintext DEK so only the wrapped (KMS-encrypted) DEK is retained
- Store the ciphertext and wrapped DEK as separate objects in an Object Storage bucket, then decrypt the full chain to prove round-trip integrity
How this lab works
- Start the lab: One click starts an emulated cloud on your computer, with the cloud’s own CLI ready: no account and no bill.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work reads the emulated cloud’s resources and says, task by task, what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Runs: An emulated cloud on your computer: no cloud account, no bill
- Cloud: OCI
- Services: kms, object-storage, iam
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop (or Podman / Rancher Desktop) installed and running
- A OCI sandbox created in the Local Cloud Playground
Topics: envelope-encryption, kms, object-storage, iam, security, data-protection, oci, openssl, dek, kek
Create a free account to start this lab.
Keep going
- Lock Down a Cloud Storage Bucket with a Custom IAM Role and Least-Privilege Bindings
- Entra ID Service Principal with Custom RBAC Role Scoped to a Resource Group
- Design Least-Privilege IAM with Dynamic Groups and Resource Principals
- Enforce Least Privilege with IAM Permission Boundaries and Policy Condition Keys
- Give Lambda Least-Privilege Access with an IAM Execution Role
- Encrypt and Decrypt Files with Cloud KMS