cse_2.py 356 B

12345678910
  1. def get_encryption_aes_key(key, kms_client):
  2. encryption_context = {"kms_cmk_id": key}
  3. response = kms_client.generate_data_key(
  4. KeyId=key, EncryptionContext=encryption_context, KeySpec="AES_256"
  5. )
  6. return (
  7. response["Plaintext"],
  8. encryption_context,
  9. base64.b64encode(response["CiphertextBlob"]).decode(),
  10. )