-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3Template
fails to upload file when using client side encryption
#1339
Comments
Hey @gbaso tnx on reporting! Are you interested in contributing? |
I'm not sure what the best approach would be. Avoid computing MD5 checksum when The change itself seems to be localized to |
Hmmm, tbh I would remove checksum fully if encryptionClient is present. I wouldn't even calculate it not sure if it makes sense. What do you think? |
I'm not sure it's even possible to instruct the encryption client to compute a checksum after the encryption. Encrypting the file ourself for the checksum is not doable since the data key and possibly any initialization parameters would be different from the actual encrypted file to upload. Would you still compute the MD5 checksum when using the plain |
Moreover, |
Type: Bug
Component:
S3
Describe the bug
s3Template.upload(bucket, key, inputStream)
fail when a bean of typeS3EncryptionClient
is defined, withS3Exception: The Content-MD5 you specified did not match what we received
.Analyzing the HTTP exchange with wireshark shows that
S3Template
adds the headerContent-MD5
with the checksum of the plaintext file. However, S3 computes the checksum of the encrypted payload, causing a mismatch.S3Client
sidesteps this issue by not providing aContent-MD5
header in the request, sos3Client.putObject(put -> put.bucket(bucket).key(key), inputFile)
works as expected.Sample
Example application with instructions and a comparison of HTTP exchanges: https://github.com/gbaso/spring-cloud-aws-s3-encryption
The text was updated successfully, but these errors were encountered: