回 1楼(zhangjun19) 的帖子
验证码计算方法如下:
"Authorization: OSS " + AccessId + ":" + base64(hmac-sha1(VERB + "\n"
+ CONTENT-MD5 + "\n"
+ CONTENT-TYPE + "\n"
+ DATE + "\n"
+ CanonicalizedOSSHeaders
+ CanonicalizedResource))
假如发出的请求是:
PUT /quotes/nelson HTTP/1.0
Content-Md5: c8fdb181845a4ca6b8fec737b3581d76
Content-Type: text/html
Date: Thu, 17 Nov 2005 18:49:58 GMT
X-OSS-Meta-Author:
foo@bar.com
X-OSS-Magic: abracadabra
AccessID 是: "44CF9590006BF252F707"
AccessKey 是 "OtxrzxIsfpFjA7SwPzILwy8Bw21TLhquhboDYROV",
VERB=PUT
CONTENT-MD5=c8fdb181845a4ca6b8fec737b3581d76
CONTENT-TYPE=text/html
DATE = Thu, 17 Nov 2005 18:49:58 GMT
CanonicalizedOSSHeaders=x-oss-magic:abracadabra\nx-oss-meta-author:foo@bar.com
CanonicalizedResource=/quotes/nelson
签名的字符串就是:
PUT\nc8fdb181845a4ca6b8fec737b3581d76\ntext/html\nThu, 17 Nov 2005
18:49:58 GMT\nx-oss-magic:abracadabra\nx-oss-meta-author:foo@bar.com\n/quotes/nelson
得到的签名应该是:
63mwfl+zYIOG6k95yxbgMruQ6QI=
在Header中就是:
Authorization: OSS 44CF9590006BF252F707: 63mwfl+zYIOG6k95yxbgMruQ6QI=