def unwrap()

in src/dynamodb_encryption_sdk/internal/crypto/jce_bridge/primitives.py [0:0]


    def unwrap(self, wrapping_key, wrapped_key):
        # type: (bytes, bytes) -> bytes
        """Unwrap key using AES keywrap.

        :param bytes wrapping_key: Loaded key with which to unwrap
        :param bytes wrapped_key: Wrapped key to unwrap
        :returns: Unwrapped key
        :rtype: bytes
        """
        if self.java_name not in ("AES", "AESWrap"):
            raise NotImplementedError('"unwrap" is not supported by this cipher')

        try:
            return keywrap.aes_key_unwrap(wrapping_key=wrapping_key, wrapped_key=wrapped_key, backend=default_backend())
        except Exception:
            error_message = "Key unwrap failed"
            _LOGGER.exception(error_message)
            raise UnwrappingError(error_message)