Skill 2.2.4
Use encryption keys to encrypt or decrypt data
Key Concepts
Encrypt and Decrypt work on up to 4 KB of data, which suits secrets such as passwords or API keys. For larger data you use envelope encryption: GenerateDataKey returns a plaintext data key and an encrypted copy; you encrypt the data locally, discard the plaintext key and store the encrypted key with the data. To decrypt, call Decrypt on the data key, then decrypt the data locally.
An encryption context, a set of non-secret key-value pairs, can be passed to these calls. The same context must be supplied to decrypt, which binds the ciphertext to its purpose and shows up in CloudTrail logs. The AWS Encryption SDK implements envelope encryption and data key caching for you.