当前位置: 动力学知识库 > 问答 > 编程问答 >

Facing difficulties with amazon url signature

问题描述:

I am following each step to create a signature for my url requests to amazon(or at least that's what I think) but it doesn't work.

I am trying to sign an example from the amazon's page( http://docs.aws.amazon.com/AWSECommerceService/latest/DG/rest-signature.html

I have downloaded the s3-sigtester, a javascript file that creates the signatures. The string that I am signing is:

GET \necs.amazonaws.co.uk \n/onca/xml \nAWSAccessKeyId=AKIAJOCH6NNDJFTB4LYA&Actor=Johnny%20Depp&AssociateTag=memagio-21&Operation=ItemSearch&ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews%2CVariations&SearchIndex=DVD&Service=AWSECommerceService&Sort=salesrank&Timestamp=2014-10-19T21%3A21%3A55Z&Version=2009-01-01

The string above is the result from the sigtester. I am feeding it in hex. I get a signature and then, I am trying to access the following url, in order to get the xml values:

http://ecs.amazonaws.co.uk/onca/xml?AWSAccessKeyId=AKIAJOCH6NNDJFTB4LYA

&Actor=Johnny%20Depp&AssociateTag=memagio-21&Operation=ItemSe

arch&ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews%2CV

ariations&SearchIndex=DVD&Service=AWSECommerceService&Signature=vZK%2BhDqtcV1CoTf6%2FN1ohR3Da5M%3D&Sort=salesrank&Ti

mestamp=2014-10-19T21%3A21%3A55Z&Version=2009-01-01

The AWASCcessKeyId and signature key are the AWS keys that I have created. However, I get an error that the signatures do not match. I think that I am following all the steps and I really don't know what's going on. Thanks.

网友答案:

The string that I am signing is:

GET \necs.amazonaws.co.uk \n/onca/xml \nAWSAccessKeyId=AKIAJOCH6NNDJFTB4LYA&Actor=Johnn

I assume \n denotes a newline character (Unicode 000A). The problem is that there should not be spaces before the newlines - it needs to be GET\necs.amazonaws.co.uk\n...

分享给朋友:
您可能感兴趣的文章:
随机阅读: