Skip to content

Incorrect Base64 encoded x-amz-content-sha256 value #3807

Open
@danielcweeks

Description

@danielcweeks

Describe the bug

SigV4 Signing produces incorrect value for checksum header

This line in AbstractAws4Signer is producing base64 encoded values for the x-amz-content-sha256 header instead of the required "Lowercase base 16 encoding." value.

Expected Behavior

The x-amz-content-sha256 header value should be e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Current Behavior

The x-amz-content-sha256 header value currently produced is 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= and signature verification fails

Reproduction Steps

Construct signing params

      Aws4SignerParams params =
          Aws4SignerParams.builder()
              .signingName(signingName)
              .signingRegion(signingRegion)
              .awsCredentials(credentialsProvider.resolveCredentials())
              .checksumParams(
                  SignerChecksumParams.builder()
                      .algorithm(Algorithm.SHA256)
                      .isStreamingRequest(false)
                      .checksumHeaderName(SignerConstant.X_AMZ_CONTENT_SHA256)
                      .build())
              .build();

Create a signer

Aws4Signer signer = Aws4Signer.create();

Sign and inspect the header value

SdkHttpFullRequest sdkRequest = SdkHttpFullRequest.builder()....build();
SdkHttpFullRequest signedSdkRequest = signer.sign(sdkRequest, params);

signedSdkRequest.headers().get("x-amz-content-sha256")

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

master

JDK version used

Java 17

Operating System and version

OSC

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p3This is a minor priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions