aws-sdk-android icon indicating copy to clipboard operation
aws-sdk-android copied to clipboard

Is it possible to upload files using TransferUtility with SSE-C encryption enabled?

Open soham-cn opened this issue 4 years ago • 8 comments

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

soham-cn avatar Sep 27 '20 10:09 soham-cn

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

devop13 avatar Sep 28 '20 19:09 devop13

for Android it's not [working]

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

richardmcclellan avatar Sep 29 '20 15:09 richardmcclellan

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.

soham-cn avatar Sep 29 '20 16:09 soham-cn

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.

TrekSoft avatar Sep 30 '20 21:09 TrekSoft

Any Update on this issue? @richardmcclellan @TrekSoft @raphkim

zkb-butt-1989 avatar Dec 27 '21 16:12 zkb-butt-1989

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

did you find any solution to tackle this? @soham-cn

zkb-butt-1989 avatar Dec 28 '21 07:12 zkb-butt-1989

Hey Guys Any One there?

zkb-butt-1989 avatar Jan 04 '22 15:01 zkb-butt-1989

@zkb-butt-1989 We currently don't support SSE-C encryption in TransferUtility. We plan to support this and update here when available.

sdhuka avatar Feb 03 '22 21:02 sdhuka