How to use the azure-storage-blob.azure.storage.blob._encryption._decrypt_blob function in azure-storage-blob

To help you get started, we’ve selected a few azure-storage-blob 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-sdk-for-python / azure-storage-storage / blob / _download_chunking.py View on Github external
def _process_content(blob, start_offset, end_offset, require_encryption, key_encryption_key, key_resolver_function):
    if key_encryption_key is not None or key_resolver_function is not None:
        try:
            return _decrypt_blob(
                require_encryption,
                key_encryption_key,
                key_resolver_function,
                blob,
                start_offset,
                end_offset)
        except Exception as error:
            raise HttpResponseError(
                message="Decryption failed.",
                response=blob.response,
                error=error)
    else:
        return b"".join(list(blob))
github Azure / azure-storage-python / azure-storage-storage / blob / _deserialization.py View on Github external
# For range gets, only look at 'x-ms-blob-content-md5' for overall MD5
    content_settings = getattr(props, 'content_settings')
    if 'content-range' in response.headers:
        if 'x-ms-blob-content-md5' in response.headers:
            setattr(content_settings, 'content_md5', _to_str(response.headers['x-ms-blob-content-md5']))
        else:
            delattr(content_settings, 'content_md5')

    if validate_content:
        computed_md5 = _get_content_md5(response.body)
        _validate_content_match(response.headers['content-md5'], computed_md5)

    if key_encryption_key is not None or key_resolver_function is not None:
        try:
            response.body = _decrypt_blob(require_encryption, key_encryption_key, key_resolver_function,
                                          response, start_offset, end_offset)
        except:
            raise AzureException(_ERROR_DECRYPTION_FAILURE)

    return Blob(name, snapshot, response.body, props, metadata)

azure-storage-blob

Microsoft Azure Blob Storage Client Library for Python

MIT
Latest version published 9 days ago

Package Health Score

96 / 100
Full package analysis