dynamodb_encryption_sdk.internal.crypto.encryption

Functions to handle encrypting and decrypting DynamoDB attributes.

Warning

No guarantee is provided on the modules and APIs within this namespace staying consistent. Directly reference at your own risk.

Functions

decrypt_attribute(attribute_name, attribute, ...)

Decrypt a single DynamoDB attribute.

encrypt_attribute(attribute_name, attribute, ...)

Encrypt a single DynamoDB attribute.

dynamodb_encryption_sdk.internal.crypto.encryption.encrypt_attribute(attribute_name: str, attribute: Dict[str, Dict[str, Any]], encryption_key: dynamodb_encryption_sdk.delegated_keys.DelegatedKey, algorithm: str) Dict[str, ByteString][source]

Encrypt a single DynamoDB attribute.

Parameters
  • attribute_name (str) – DynamoDB attribute name

  • attribute (dict) – Plaintext DynamoDB attribute

  • encryption_key (DelegatedKey) – DelegatedKey to use to encrypt the attribute

  • algorithm (str) – Encryption algorithm descriptor (passed to encryption_key as algorithm)

Returns

Encrypted DynamoDB binary attribute

Return type

dict

dynamodb_encryption_sdk.internal.crypto.encryption.decrypt_attribute(attribute_name: str, attribute: Dict[str, Dict[str, Any]], decryption_key: dynamodb_encryption_sdk.delegated_keys.DelegatedKey, algorithm: str) Dict[str, Dict[str, Any]][source]

Decrypt a single DynamoDB attribute.

Parameters
  • attribute_name (str) – DynamoDB attribute name

  • attribute (dict) – Encrypted DynamoDB attribute

  • encryption_key (DelegatedKey) – DelegatedKey to use to encrypt the attribute

  • algorithm (str) – Decryption algorithm descriptor (passed to encryption_key as algorithm)

Returns

Plaintext DynamoDB attribute

Return type

dict