in src/dynamodb_encryption_sdk/materials/wrapped.py [0:0]
def _content_key_from_material_description(self):
"""Load the content key from material description and unwrap it for use.
:returns: Unwrapped content key
:rtype: DelegatedKey
"""
if self._unwrapping_key is None:
raise UnwrappingError(
"Cryptographic materials cannot be loaded from material description: no unwrapping key"
)
wrapping_algorithm = self.material_description.get(
MaterialDescriptionKeys.CONTENT_KEY_WRAPPING_ALGORITHM.value, self._unwrapping_key.algorithm
)
wrapped_key = base64.b64decode(self.material_description[MaterialDescriptionKeys.WRAPPED_DATA_KEY.value])
content_key_algorithm = self._content_key_algorithm.split("/", 1)[0]
return self._unwrapping_key.unwrap(
algorithm=wrapping_algorithm,
wrapped_key=wrapped_key,
wrapped_key_algorithm=content_key_algorithm,
wrapped_key_type=EncryptionKeyType.SYMMETRIC,
additional_associated_data=None,
)