How to use the azure-storage-queue.azure.storage.queue._error._ERROR_MESSAGE_NOT_ENCRYPTED function in azure-storage-queue

To help you get started, we’ve selected a few azure-storage-queue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-storage-python / azure-storage-queue / azure / storage / queue / _encryption.py View on Github external
:param function resolver(kid):
        The user-provided key resolver. Uses the kid string to return a key-encryption-key implementing the interface defined above.
    :return: The plain text message from the queue message.
    :rtype: str
    '''

    try:
        message = loads(message)

        encryption_data = _dict_to_encryption_data(message['EncryptionData'])
        decoded_data = _decode_base64_to_bytes(message['EncryptedMessageContents'])
    except (KeyError, ValueError):
        # Message was not json formatted and so was not encrypted
        # or the user provided a json formatted message.
        if require_encryption:
            raise ValueError(_ERROR_MESSAGE_NOT_ENCRYPTED)

        return message
    try:
        return _decrypt(decoded_data, encryption_data, key_encryption_key, resolver).decode('utf-8')
    except Exception:
        raise AzureException(_ERROR_DECRYPTION_FAILURE)

azure-storage-queue

Microsoft Azure Azure Queue Storage Client Library for Python

MIT
Latest version published 2 months ago

Package Health Score

96 / 100
Full package analysis

Popular azure-storage-queue functions