aws-amplify / aws-sdk-android

AWS SDK for Android. For more information, see our web site:
https://docs.amplify.aws
Other
1.03k stars 549 forks source link

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

Open soham-cn opened 4 years ago

soham-cn commented 4 years ago

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):

Device Information (please complete the following information):

devop13 commented 4 years ago

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

richardmcclellan commented 4 years ago

for Android it's not [working]

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

soham-cn commented 4 years ago

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.

TrekSoft commented 4 years ago

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.

zkb-butt-1989 commented 2 years ago

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

zkb-butt-1989 commented 2 years ago

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 commented 2 years ago

Hey Guys Any One there?

sdhuka commented 2 years ago

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