def _unwrap()

in src/dynamodb_encryption_sdk/delegated_keys/jce.py [0:0]


    def _unwrap(self, algorithm, wrapped_key, wrapped_key_algorithm, wrapped_key_type, additional_associated_data=None):
        # type: (Text, bytes, Text, EncryptionKeyType, Optional[Dict[Text, Text]]) -> DelegatedKey
        # pylint: disable=unused-argument
        """Wrap content key.

        :param str algorithm: Text description of algorithm to use to unwrap key
        :param bytes content_key: Raw content key to wrap
        :param str wrapped_key_algorithm: Text description of algorithm for unwrapped key to use
        :param EncryptionKeyType wrapped_key_type: Type of key to treat key as once unwrapped
        :param dict additional_associated_data: Not used by :class:`JceNameLocalDelegatedKey`
        :returns: Delegated key using unwrapped key
        :rtype: DelegatedKey
        """
        if wrapped_key_type is not EncryptionKeyType.SYMMETRIC:
            raise UnwrappingError('Unsupported wrapped key type: "{}"'.format(wrapped_key_type))

        unwrapper = encryption.JavaCipher.from_transformation(algorithm)
        unwrapped_key = unwrapper.unwrap(wrapping_key=self.__key, wrapped_key=wrapped_key)
        return JceNameLocalDelegatedKey(
            key=unwrapped_key,
            algorithm=wrapped_key_algorithm,
            key_type=wrapped_key_type,
            key_encoding=KeyEncodingType.RAW,
        )