A developer is implementing client-side decryption for a microservice that retrieves encrypted configuration files (each under KB in size) from an external datastore. The files were encrypted using envelope encryption with an AWS KMS customer managed key. The datastore contains the ciphertext payload and the encrypted data key (ciphertext data key). Which two steps must the developer's application perform to decrypt the payload?
- Call the Decrypt API operation of AWS KMS, passing the ciphertext data key to retrieve the plaintext data key.Answer
- Decrypt the ciphertext payload locally using the retrieved plaintext data key and the appropriate decryption algorithm.Answer
- CCall the Decrypt API operation of AWS KMS, passing the ciphertext payload directly to retrieve the decrypted plaintext payload.
- DRetrieve the plaintext data key from AWS Systems Manager Parameter Store by querying a SecureString parameter.
- ECall the GenerateDataKey API operation of AWS KMS, passing the ciphertext data key to recover the plaintext data key.
Answer
To decrypt the payload, the application must call the KMS Decrypt API operation with the ciphertext data key to get the plaintext data key, and then decrypt the ciphertext payload locally using that plaintext data key.
To decrypt a payload that was encrypted using envelope encryption, the client application first extracts the encrypted data key (ciphertext data key) that is stored alongside the payload. The application then sends this ciphertext data key to AWS KMS by calling the Decrypt API operation. AWS KMS decrypts the data key using the specified customer managed key and returns the plaintext data key to the application. Finally, the application uses this plaintext data key to decrypt the ciphertext payload locally. This ensures that the heavy decryption workload is done client-side and the sensitive raw payload is never sent over the network to AWS KMS.
Step-by-Step Solution
Key Concept
AWS KMS Envelope Encryption Decryption Workflow