我用来签名的字符串如下
GET
sqs.us-east-1.amazonaws.com
/XXXXXXXXXXX/Localhost
AWSAccessKeyId=XXXXXNGOTNJCTGAXXXXX&Action=ReceiveMessage&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-12-26T07%3A56%3A37Z&Version=2012-11-05
前 3 行后面有 '\n' 字符,但最后没有,我也试过在最后加上 '\n',但结果是一样的
我是他们计算
HMAC_SHA256(AWSKey,string)
我已经分别验证了 HMAC_SHA256 的正确性,最后我调用了 HMAC Base 64 编码的 URL
https://sqs.us-east-1.amazonaws.com/XXXXXXXXXXX/Localhost?AWSAccessKeyId=XXXXXNGOTNJCTGAXXXXX&Action=ReceiveMessage&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-12-26T07%3A56%3A38Z&Version=2012-11-05&Signature=06nzru1EroDLJTJDjExLbyUyQzEcct3wAp%2Bm7TOBTjb0aPWSJTIXXXXX
XX..XX 是我添加的。
在浏览了几次文档之后,我没有发现相同的错误,但我收到了一个签名不匹配错误。
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
</Message>