要调用亚马逊的接口api,现在困到签名了,求有经验的大牛给指导指导
求助 RFC 2104-compliant HMAC with the SHA256 hash algorithm using the string above with our "dummy" Secret Access Key: 1234567890
http://docs.aws.amazon.com/zh_cn/AWSECommerceService/latest/DG/rest-signature.html
------解决思路----------------------
输出:
var str = "GET\nwebservices.amazon.com\n/onca/xml\nAWSAccessKeyId=AKIAIOSFODNN7EXAMPLE&AssociateTag=mytag-20&ItemId=0679722769&Operation=ItemLookup&ResponseGroup=Images%2CItemAttributes%2COffers%2CReviews&Service=AWSECommerceService&Timestamp=2014-08-18T12%3A00%3A00Z&Version=2013-08-01";
using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes("1234567890")))
{
var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(str));
Console.WriteLine(Convert.ToBase64String(hash));
}
j7bZM0LXZ9eXeZruTqWm2DIvDYVUU3wxPPpp+iXxzQc=注意输入字符串里面的换行不是 "\r\n" 而是 "\n" 才能一致。