#NEWLINE# def download_object( bucket , obj , out_file , encryption_key , key_hash ) : #NEWLINE# #INDENT# 'Downloads an object protected by a custom encryption key.' #NEWLINE# service = create_service ( ) #NEWLINE# request = service . objects ( ) . get_media ( bucket = bucket , object = obj ) #NEWLINE# request . headers [ 'x-goog-encryption-algorithm' ] = 'AES256' #NEWLINE# request . headers [ 'x-goog-encryption-key' ] = encryption_key #NEWLINE# request . headers [ 'x-goog-encryption-key-sha256' ] = key_hash #NEWLINE# out_file . write ( request . execute ( ) )