-
Notifications
You must be signed in to change notification settings - Fork 869
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
Unable to use Java AWS SDK v2 to get object using SHA256 #4694
Comments
@gorell can you share the full stacktrace of the error? |
@debora-ito here it is:
|
@debora-ito just to clarify - we've customized our JDK to use SHA256 (and not MD5 which we don't support) for checksum |
The Java SDK will validate the MD5 checksum by default on GetObject. This is a client-side configuration, separate from the GetObject You can disable this default MD5 checksum validation in the S3 Client by setting a custom S3Configuration: S3Client s3Client = S3Client.builder()
.serviceConfiguration(S3Configuration.builder().checksumValidationEnabled(Boolean.FALSE).build())
.region(Region.US_WEST_2)
.build(); |
Got it @debora-ito , thank you. So is there a way to configure the GetObject validation to be SHA256? Given how the PutObject is configured. |
In this use-case, the SDK will automatically validate the SHA256 checksum on GetObject, after finishing reading the object. The SDK validates any of the 4 checksum types supported by the |
But it looks like it does it with MD5, that's the reason I've opened this issue. |
Ok, I took a step back and went through the question again. I also talked to the rest of the team about this issue.
S3Client s3Client = S3Client.builder()
.serviceConfiguration(S3Configuration.builder().checksumValidationEnabled(Boolean.FALSE).build())
.region(Region.US_WEST_2)
.build(); To clarify: setting @gorell Will the fix of (1) address the issue you are reporting here? Is there anything else I'm missing? |
@debora-ito The answer to you question is 'yes', the fix of (1) will do the job, thank you very much |
Great, thank you for confirming. I'll comment here once we have more updates on the fix. |
The fix is available in version |
@debora-ito - This appears to be an issue with the delete api. "There is no way to disable MD5 for S3Client.deleteObjects because the service API requires the MD5 checksum". https://github.com/aws/aws-sdk-java-v2/blob/master/core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/http/pipeline/stages/HttpChecksumStage.java |
Describe the bug
hi team,
after putting the object using the checksum algorithm SHA256 as following,
we're trying to get this object:
but MD5 checksum (and not SHA256) is applied instead, via this hard-coded reference this
and we're getting the exception: java.lang.IllegalStateException: Unexpected error creating MD5 checksum
note: headObject works fine
what are we missing?
thanks in advance
Expected Behavior
GetObject should work
Current Behavior
Getting an exception (see above)
Reproduction Steps
Please see the code in the bug description
Possible Solution
No response
Additional Information/Context
No response
AWS Java SDK version used
2.20.42
JDK version used
openjdk 11.0.14.1
Operating System and version
Linux service-5b7c8c4788-c62fp 5.4.238-148.347.amzn2.x86_64 #1 SMP Thu Apr 6 19:42:57 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: