The interview problem
A tenant stores millions of encrypted blobs. Design envelope encryption and distinguish rotating a wrapping key from rotating the data-encryption key itself.
Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.
1. Scope and worked approach
Assume authenticated encryption with a correct nonce policy and a trusted key service. Encrypt each object or bounded group with a data key; store its wrapped form, algorithm and key identifier beside ciphertext. Authorize both object access and unwrap operations. For wrapping-key rotation, rewrap data keys under the new wrapping key while preserving data ciphertext where the protocol permits. Make metadata replacement conditional and retain recovery information until validation completes.
2. Trace the design or derivation
Locate wrapped keys → rewrap under new root → verify decryptability → switch references → retire old root
Maintain a manifest of wrapping-key versions and checkpoint the migration. Before retiring the old root, verify both active objects and retained backups have a supported decryption path. Rewrapping changes protection of the data key; replacing a compromised data key requires reencryption of the underlying payload as a separate operation.
3. Calculate the example
For one million 10 MB objects, rewriting payload touches about 10 TB before replicas. Rewrapping one 100-byte key record per object touches about 100 MB of logical key metadata, excluding service calls and metadata overhead. Rewrapping does not change a compromised plaintext data key or remove ciphertext copies already exposed.
4. Failure cases and trade-offs
Deleting the old wrapping key too early can make unprocessed objects unreadable. Metadata and ciphertext can become mismatched after a partial update. Per-object keys improve isolation at more key-management overhead; grouped keys reduce metadata but increase shared exposure.
5. Validation, follow-ups and self-review
Interrupt rotation, read both key versions and verify every object before retirement. Test access revocation separately from rotation. Follow-up: when is full data re-encryption required? Reward key-layer distinctions, resumable progress and accurate byte accounting.
Sources and related practice
Technical reference: docs.aws.amazon.com — Envelope encryption and data-key concepts.
Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.
Continue with Rotate service certificates without interrupting traffic; Rotate a customer integration credential without downtime.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.