Unable to reproduce AWS signature from example using HMAC SHA256

后端 未结 2 480
既然无缘
既然无缘 2021-01-24 22:45

I am following this example

http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html

and trying to reproduce the 64 character string for the

2条回答
  •  孤独总比滥情好
    2021-01-24 22:48

    I can't tell from your post but those are quite possibly exactly the same results, formatted differently.

    Your code returns the raw result of the HMAC operation - this is arbitrary binary data so it's not going to print as anything readable. Amazon expect you to provide the hex representation for each byte: your first couple of bytes are "\xae\xee" instead of "aeee"

    The easiest way to do this is call hexdigest rather than digest. Note that you should only do this for the final HMAC (when you sign the string to sign with the signing key) not when constructing the signing key

提交回复
热议问题