A developer is building a serverless order processing system using AWS Lambda and Amazon DynamoDB. The system must encrypt order payloads (each approximately ) prior to saving them to DynamoDB. The developer implements envelope encryption using an AWS KMS customer managed key.
During order creation, the Lambda function calls the `GenerateDataKey` API operation, providing an `EncryptionContext` containing `{"OrderID": "ord-8831", "CustomerID": "cust-4402"}`. The application encrypts the order payload using the returned plaintext data key, discards the plaintext key, and saves the ciphertext order payload and the encrypted data key in DynamoDB.
When retrieving and decrypting the order, which approach must the Lambda function use to successfully obtain the plaintext order payload?
- ACall the KMS `Decrypt` API operation passing the ciphertext order payload and the `EncryptionContext` map directly to retrieve the decrypted order payload.
- BCall the Systems Manager Parameter Store `GetParameter` API operation, passing the OrderID to retrieve the cached plaintext data key associated with the encryption context.
- Call the KMS `Decrypt` API operation passing the encrypted data key and the exact same `EncryptionContext` map, then use the returned plaintext data key to decrypt the order payload locally.Answer
- DCall the KMS `Decrypt` API operation passing only the encrypted data key. The encryption context is metadata stored within the encrypted data key and is validated automatically by AWS KMS without requiring client input.