0
votes

I want to access ciphertext value from google cloud bucket file and extract values of the file and pass to kms decrypt in python.

reqCipherText = service.objects().get_media(bucket=bucket_name, object=fileName)

Note: I dont want to download file from GCP bucket and read then pass to KMS decrypt.

1

1 Answers

0
votes

I found one solution:

downloaded = io.BytesIO()
downloader = googleapiclient.http.MediaIoBaseDownload(downloaded, reqCipherText)
done = False
while done is False:
    _, done = downloader.next_chunk()
downloaded.seek(0)
return format(downloaded.read())