做批量删除,添加Content-MD5内容之后,一直返回这个错误,实在误解,求各位解答。
ACCESS_ID: 84wb5aoz2hkfvw7raqbuvafd
ACCESS_KEY: uFEwAT8H4AbrC5KKPDCxsjHC9pI=
Content-MD5 生成方式如下:
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] hash = md5.ComputeHash(this._content);
this._content.Position = 0;
md5.Clear();
this._contentMd5 = Convert.ToBase64String(hash, Base64FormattingOptions.None);
发送内容如下:
POST /thinkcity?delete HTTP/1.1
Date: Sun, 07 Oct 2012 12:56:23 GMT
Content-Type:
Content-MD5: ZdjlNT4JzRvLFHTKwtuIEg==
Authorization: OSS 84wb5aoz2hkfvw7raqbuvafd:aMa2sTvy s8iCR6loSxTMEpifdA=
User-Agent: aliyun-openservices-sdk-dotnet_0.0.0.0
Host: storage.aliyun.com
Content-Length: 87
<Delete><Quiet>true</Quiet><Object><Key>1.76榫嶆棌浼犲.rar</Key></Object></Delete>
返回错误如下:
<?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 4F 53 54 0A 5A 64 6A 6C 4E 54 34 4A 7A 52 76 4C 46 48 54 4B 77 74 75 49 45 67 3D 3D 0A 0A 53 75 6E 2C 20 30 37 20 4F 63 74 20 32 30 31 32 20 31 32 3A 35 36 3A 32 33 20 47 4D 54 0A 2F 74 68 69 6E 6B 63 69 74 79 3F 64 65 6C 65 74 65 </StringToSignBytes>
<SignatureProvided>aMa2sTvy s8iCR6loSxTMEpifdA=</SignatureProvided>
<StringToSign>POST ZdjlNT4JzRvLFHTKwtuIEg== Sun, 07 Oct 2012 12:56:23 GMT /thinkcity?delete</StringToSign>
<OSSAccessKeyId>84wb5aoz2hkfvw7raqbuvafd</OSSAccessKeyId>
<RequestId>50717BF6ACD33BD244118D20</RequestId>
<HostId>storage.aliyun.com</HostId>
</Error>
std::string char_md5(char* data,size_t len)
{
MD5_CTX md5;
unsigned char md[16];
string hash="";
MD5_Init(&md5);
if (len > 0) {
MD5_Update(&md5,data, len);
}
MD5_Final(md,&md5);
hash=weblib::base64Encode(md,16);
return hash;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。