A developer is writing a Java application that needs to encrypt a database export file of before uploading it to Amazon S3. The security policy requires client-side envelope encryption using an AWS KMS customer managed key. Which AWS KMS API operation should the developer use to obtain the necessary data key to encrypt this file locally?
- GenerateDataKeyAnswer
- BEncrypt
- CGenerateDataKeyWithoutPlaintext
- DGetParametersByPath
Answer
GenerateDataKey
The correct answer is the GenerateDataKey operation. In client-side envelope encryption, the application calls GenerateDataKey, which generates a unique symmetric data key under the specified customer managed key. KMS returns both the plaintext key (which the Java application uses to encrypt the file locally) and the encrypted version of that same data key (which is uploaded to Amazon S3 alongside the encrypted file).
Step-by-Step Solution
Key Concept
AWS KMS Envelope Encryption and Data Key Generation