亚马逊S3:奇怪的错误 - “有时候'SignatureDoesNotMatch,有时它 [英] Amazon S3: Strange Error -' Sometimes' SignatureDoesNotMatch, sometimes it does

查看:2766
本文介绍了亚马逊S3:奇怪的错误 - “有时候'SignatureDoesNotMatch,有时它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发code的销售人员。我们使用Force.com的亚马逊网络服务应用程序的AppExchange中。该应用程序是由亚马逊提供的。

我下载的机器上,从Amazon S3的文件。

有时候,我收到以下提到的错误。有趣的是,只是有时我得到这个错误,它的工作原理,即使是同一个文件的时间休息。

 <错误>
< code取代; SignatureDoesNotMatch< / code取代;
<消息>
我们计算请求签名不您提供的签名相匹配。检查你的密钥和签名方法。
< /消息>
 

我尝试使用Amazon提供两个URL模式。期满被设定为1小时链接产生之后,因此可能不是一个问题。

  URL1: - http://adminportal.s3.amazonaws.com/sample.pdf?AWSAccessKeyId=AKIAIRUZSRRCVSLXZCIA&Expires=1372653478&Signature=RvMJ1gJL+qNKmnRkqzuytmlUTGQ=
URL2: - http://s3.amazonaws.com/adminportal/sample.pdf?AWSAccessKeyId=AKIAIRUZSRRCVSLXZCIA&Expires=1372658253&Signature=%2FmI0m0PTlHJpJ%2FP5d%2FX3OApqzcI%3D
 

该签名是由亚马逊提供的类产生的,我想这应该很好地工作的所有时间。

有人能详细点为什么会S3给这个错误只是偶尔?

解决方案

最后,我能解决这个问题,在这里是怎么了?

有关文件示例URL在Amazon S3是 -

<$p$p><$c$c>http://adminportal.s3.amazonaws.com/sample.pdf?AWSAccessKeyId=AKIAIRUZSRRCVSLXZCIA&Expires=1372653478&Signature=RvMJ1gJL+qNKmnRkqzuytmlUTGQ=

下面的签名是由亚马逊提供的类生成的。

不知道什么原因,Force.com的亚马逊网络服务的应用程序正在生成的签名包含空格。

例如。在给定的URL,空间被替换+。

要摆脱这个问题,只是URL连接$ C C的签名$。编码将替换特殊字符和空格的问题将得到解决。

I am developing code for salesforce. We are using 'Force.com for Amazon Web Services' App from Appexchange. The app is provided by Amazon.

I am downloading files from Amazon S3 on a machine.

Sometimes I am getting the below mentioned error. Interesting thing is, only sometimes I get this error, rest of the times it works, even for the same file.

<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your key and signing method.
</Message>

I tried using both URL patterns provided by Amazon. Expires is set for 1hr after link generation, hence may not be an issue.

URL1:- http://adminportal.s3.amazonaws.com/sample.pdf?AWSAccessKeyId=AKIAIRUZSRRCVSLXZCIA&Expires=1372653478&Signature=RvMJ1gJL+qNKmnRkqzuytmlUTGQ=
URL2:- http://s3.amazonaws.com/adminportal/sample.pdf?AWSAccessKeyId=AKIAIRUZSRRCVSLXZCIA&Expires=1372658253&Signature=%2FmI0m0PTlHJpJ%2FP5d%2FX3OApqzcI%3D

The signature is generated by class provided by Amazon, I guess it must work well all of the times.

Can someone elaborate why would S3 give this error only sometimes?

解决方案

Finally I was able to solve this problem, here is how?

Sample URL for file on Amazon S3 is-

http://adminportal.s3.amazonaws.com/sample.pdf?AWSAccessKeyId=AKIAIRUZSRRCVSLXZCIA&Expires=1372653478&Signature=RvMJ1gJL+qNKmnRkqzuytmlUTGQ=

Here the Signature is generated by classes provided by Amazon.

For unknown reasons, 'Force.com for Amazon Web Services' app was generating signature which contain SPACES.

E.g. In the given URL, space is replaced by '+'.

To get rid of the problem, just URL encode the signature. Encoding will replace spaces with special character and problem will be resolved.

这篇关于亚马逊S3:奇怪的错误 - “有时候'SignatureDoesNotMatch,有时它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆