1
爲什麼Amazon AWS如此專業且複雜?爲Amazon S3生成身份驗證標頭
我只是想讓我的應用程序上傳文件到S3。在閱讀網站上的文檔後,我發現我可以使用「POST」請求,只需給出2個參數「key」和「file」。 (沒有其他的東西,沒有政策)但問題是「關鍵」。
「key」是認證標題。但他們只是提出了一個關於如何構建我無法弄清楚的密鑰的僞代碼。
Authorization = "AWS" + " " + AWSAccessKeyId + ":" + Signature;
Signature = Base64(HMAC-SHA1(UTF-8-Encoding-Of(YourSecretAccessKeyID, StringToSign)));
StringToSign = HTTP-Verb + "\n" +
Content-MD5 + "\n" +
Content-Type + "\n" +
Date + "\n" +
CanonicalizedAmzHeaders +
CanonicalizedResource;
CanonicalizedResource = [ "/" + Bucket ] +
<HTTP-Request-URI, from the protocol name up to the query string> +
[ sub-resource, if present. For example "?acl", "?location", "?logging", or "?torrent"];
CanonicalizedAmzHeaders = <described below>
http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html
可一些有經驗的程序員將其轉化爲PHP或JavaScript語言?它是否需要包含外部代碼/庫?因爲我在那裏看到了一些外星人的功能。
使用它,它會爲你做。 http://aws.amazon.com/sdkforphp/ – vascowhite