亚马逊签名使用javascript不匹配

时间:2018-06-16 06:30:01

标签: javascript amazon-web-services amazon-s3

我使用javascript生成了签名。但它表明Signature总是不匹配。

<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/hmac-sha1.js"></script>  
<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/components/enc-base64-min.js"></script>  
 <script>
   var service = "AWSECommerceService";
   var timestamp = new Date().toISOString();
   var operation = "ItemSearch";
   var secret = "MYSECRETKEY";
   var signature = CryptoJS.HmacSHA1(service + operation + timestamp, secret).toString(CryptoJS.enc.Base64);
   console.log('http://ecs.amazonaws.com/onca/xml?AWSAccessKeyId=mykey&AssociateTag=mytag-20&Keywords=harry%20potter&Operation='+operation+'&SearchIndex=Books&Service='+service+'&Timestamp='+timestamp+'&Version=2018-06-01&Signature='+signature);
 </script>

0 个答案:

没有答案