A developer is building a client-side utility in Python using the Boto3 SDK to encrypt database export files, each averaging in size, before archiving them to an Amazon S3 bucket. The compliance policy requires the use of client-side envelope encryption with a Customer Managed Key (CMK) stored in AWS KMS. Which of the following SDK workflows represents the correct and most efficient implementation for encrypting each file?
- Call the KMS `generate_data_key` API to retrieve both a plaintext data key and an encrypted data key. Use the plaintext data key to encrypt the file locally, immediately delete the plaintext data key from memory, and store the encrypted file alongside the encrypted data key.Cevap
- BCall the KMS `generate_data_key_without_plaintext` API to retrieve the encrypted data key. Use the encrypted data key to encrypt the file locally, and store the encrypted file along with the encrypted data key.
- CDivide the file into chunks smaller than each. For each chunk, call the KMS `encrypt` API directly using the Customer Managed Key, concatenate the ciphertexts, and upload the final consolidated file.
- DCall the Systems Manager Parameter Store to retrieve the plaintext key material of the Customer Managed Key. Use this key material to encrypt the file locally, and upload the encrypted file.
Cevap
Call the KMS `generate_data_key` API to retrieve both a plaintext data key and an encrypted data key. Use the plaintext data key to encrypt the file locally, immediately delete the plaintext data key from memory, and store the encrypted file alongside the encrypted data key.
The correct implementation is to call the KMS `generate_data_key` API using the Customer Managed Key ID. KMS returns both the plaintext data key and the ciphertext (encrypted) data key. The application uses the plaintext key to encrypt the large file locally (client-side) using an algorithm like AES-256, deletes the plaintext key from memory to maintain security, and stores the encrypted data key alongside the encrypted file (often as S3 metadata) so it can be sent to KMS for decryption later.
Adım Adım Çözüm
Anahtar Kavram
AWS KMS Client-Side Envelope Encryption Workflow
Tahmini Süre:2m 30s