Getting SignatureDoesNotMatch error from SQS SendMessage

时间:2018-02-03 10:19:30

标签: amazon-sqs aws-sdk-java-2.0

I am constructing my own REST calls for SQS SendMessage Action. All the parameters for SendMessage are in request body. (QueueUrl, Action and MessageBody).

I have created my own signature calculation code(mostly copied from AWS SDK Java).

Now, when my MessageBody="HelloWorld" , it works fine. That means my signature calculation and credentials are correct.

But, when I insert a space , MessageBody="Hello World", I am getting a 403 SignatureDoesNotMatch error from SQS. I also tried "Hello%20World" as MessageBody , but that also returns a 403 error.

Also tried "Hello+World". But got same error.

I found that aws sdk converts spaces to '+' before calculating the hash of payload.

I tried MessageBody="Hello.World" and that also worked perfectly.

Is there any issue with spaces in Message Body ?

I am sending Host and x-amz-date as the only headers in my request.

The error response from SQS suggests that the hash of the payload is the only thing different in the actual and expected canonical request.

0 个答案:

没有答案