开发者社区> 问答> 正文

自己做CSDK,在上传操作时会发生签名不匹配问题

本人想往名为tingshuo2012的bucket里面上传一个名为1.txt的文件,文件内容就只有4个字符“Thaa”。
发送报文:
PUT /tingshuo2012/1.txt HTTP/1.1
Host: storage.aliyun.com
Cache-control: no-cache
Content-Encoding: utf-8
Date: Sat, 08 Sep 2012 08:47:22 GMT
Content-Type: text/plain
Content-Length: 4
Authorization: OSS ACSB62Mi3KGB9qMU:7xOua IVfNBz6TKY5u tmFPaT8c=
Thaa
其中未用hmac和base64加密前的字段为:
PUT
F74FE9B1783C5A8547266A0C35EF1189
text/plain
Sat, 08 Sep 2012 08:47:22 GMT
/tingshuo2012/1.txt
接收回来的报文为:
HTTP/1.1 403 Forbidden
Date: Sat, 08 Sep 2012 08:47:06 GMT
Content-Type: application/xml
Connection: close
Content-Length: 772
Server: AliyunOSS
x-oss-request-id: 504B060A709EB3AB0C47465B
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>SignatureDoesNotMatch</Code>
  <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
  <StringToSignBytes>50 55 54 0A 0A 74 65 78 74 2F 70 6C 61 69 6E 0A 53 61 74 2C 20 30 38 20 53 65 70 20 32 30 31 32 20 30 38 3A 34 37 3A 32 32 20 47 4D 54 0A 2F 74 69 6E 67 73 68 75 6F 32 30 31 32 2F 31 2E 74 78 74 </StringToSignBytes>
  <SignatureProvided>7xOua IVfNBz6TKY5u tmFPaT8c=</SignatureProvided>
  <StringToSign>PUT
text/plain
Sat, 08 Sep 2012 08:47:22 GMT
/tingshuo2012/1.txt</StringToSign>
  <OSSAccessKeyId>ACSB62Mi3KGB9qMU</OSSAccessKeyId>
  <RequestId>504B060A709EB3AB0C47465B</RequestId>
  <HostId>storage.aliyun.com</HostId>
</Error>
请问签名格式有什么问题吗?Content-MD5的值是正确的,和下载相同文件所得的值是一样的,求大虾指导

展开
收起
wangweiyan2007 2012-09-08 17:10:16 8689 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载