An application encrypts large files by calling AWS KMS's GenerateDataKey operation to obtain a plaintext data key and its KMS-encrypted copy, encrypts the file locally with the plaintext data key, discards the plaintext key from memory, and stores only the encrypted copy of the data key alongside the file. What is this pattern called, and why does KMS support it?
- Client-side master key rotation, used because KMS cannot rotate customer master keys automatically
- Envelope encryption, used because AWS KMS's Encrypt and Decrypt API calls have a payload size limit unsuited to large data, so the bulk data is encrypted locally with a data key while only that small data key is protected directly by KMS
- Field-level encryption, used because KMS can only encrypt structured JSON fields, not arbitrary binary files
- Envelope encryption, used specifically to avoid ever calling the KMS API during encryption operations
Why B? And why not the others?
Correct answer: B. Envelope encryption, used because AWS KMS's Encrypt and Decrypt API calls have a payload size limit unsuited to large data, so the bulk data is encrypted locally with a data key while only that small data key is protected directly by KMS
This is envelope encryption: the KMS Encrypt and Decrypt operations accept only small payloads, so applications instead use GenerateDataKey to obtain a data key, encrypt the potentially large payload locally with that key, and let KMS protect only the small data key itself by returning and storing its encrypted form. This lets KMS scale to arbitrarily large data while every cryptographic key material operation still goes through KMS. The option calling this client-side master key rotation is wrong on the facts alone: AWS KMS does support automatic annual rotation of the cryptographic material behind eligible customer managed keys, so the premise that rotation is impossible is false, and the pattern described has nothing to do with rotation. The option calling this field-level encryption restricted to JSON is wrong because KMS and envelope encryption work on arbitrary binary data up to size limits set by the application's own design, not on a specific structured format. The option claiming the pattern avoids calling the KMS API entirely is wrong because GenerateDataKey (and, on decryption, a Decrypt call to unwrap the encrypted data key) are themselves KMS API calls; envelope encryption reduces how much data crosses that API, it does not eliminate the calls.
Source: AWS KMS documentation: Envelope encryption and GenerateDataKey