2

I've been going crazy over this for hours. I'm trying to use the SendMessage API call to the Amazon SQS message queue.

I'm following the Signature Version 2 method (http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html)

I receive the error for a non matching signature. I've been thinking it has to do with the lexicographic byte ordering but I've spent hours trying to figure it out and had no luck :-/

I can send a message successfully with this as my "query string components": "AWSAccessKeyId=AKIAIEXAMPLE&Action=SendMessage&Expires=2013-02-22T12%3A19%3A30&MessageBody=12321&SignatureMethod=HmacSHA256&SignatureVersion=2&Version=2012-11-05"

broken down as these name value pairs for easy reading:

["AWSAccessKeyId", "Action", "Expires", "MessageBody", "SignatureMethod", "SignatureVersion", "Version"]

["AKIAIEXAMPLE", "SendMessage", "2013-02-22T12%3A19%3A30", "12321", "HmacSHA256", "2", "2012-11-05"]

But NOT with this set of query string components:

"AWSAccessKeyId=AKIAIEXAMPLE&Action=SendMessage&Expires=2013-02-22T12%3A19%3A30&MessageBody=234&SignatureMethod=HmacSHA256&SignatureVersion=2&Version=2012-11-05"

broken down as:

["AWSAccessKeyId", "Action", "Expires", "MessageBody", "SignatureMethod", "SignatureVersion", "Version"]

["AKIAIEXAMPLE", "SendMessage", "2013-02-22T12%3A19%3A30", "234", "HmacSHA256", "2", "2012-11-05"]

The only difference between the two is the MessageBody's value (12321 works, 234 doesn't) and I've tried a variety of values, both using characters and integers and can't seem to put my finger on the problem.

Any suggestions would be greatly appreciated.

4

0 回答 0