Aws-sdk-android: Is it possible to upload files using TransferUtility with SSE-C encryption enabled?

Created on 27 Sep 2020  路  4Comments  路  Source: aws-amplify/aws-sdk-android

Question
I was trying to upload many files (possibly large files) from Android to S3. I
also wanted my files to be encrypted using a customer-provided key. After
researching a while, I found out about SSE-C in S3. So I tried using it. As I
am uploading many files, some of which are possibly large, I am using
TransferUtility for uploading. However, I am unable to set SSE-C encryption
on the files.

I found some similar articles for iOS and I tested it there, and it's working.
But for Android, it's not. I was able to do it using putObject, but I also
need to upload multiple big files so I don't think putObject is the best
thing to use, anyway.

Can someone help me out here? Is it possible to achieve the same thing using
TransferUtility for Android, or is there a workaround?

Which AWS Services are you utilizing?
S3, Amplify, Cognito

Provide code snippets (if applicable)

objectMetadata.setHeader("x-amz-server-side-encryption-customer-algorithm", ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION)
objectMetadata.setHeader("x-amz-server-side-encryption-customer-key", "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=")
objectMetadata.setHeader("x-amz-server-side-encryption-customer-key-MD5", "dnF5x6K/8ZZRzpfSlMMM+w==")
transferUtility.upload("private/$toRemoteKey", aLocalFile, objectMetadata)

Environment(please complete the following information):

  • aws-android-sdk: 2.15.+ and 2.19.0 (Tried both)
  • Emulator: Min SDK - 16, Target SDK - 30

Device Information (please complete the following information):

  • Device: Simulator, Pixel 3XL API level 22
Feature Request S3

Most helpful comment

Scanning through our codebase it seems we don't currently support this use case. Based on +1s on this ticket we will prioritize the feature request appropriately.

All 4 comments

Even I have a similar use case, and would love to know how this can be tackled with the android SDK

for Android it's not [working]

What exactly is not working? Is there a particular error message you are getting?

No, it's not doing SSE-C when I give the headers (Checked through s3 console). Also, there was no option otherwise to specify the SSE-C customer key in TransferUtility.

Scanning through our codebase it seems we don't currently support this use case. Based on +1s on this ticket we will prioritize the feature request appropriately.

Was this page helpful?
0 / 5 - 0 ratings