AWS Signature Version 4 (AWS4)
紀錄一下計算Signature的部分. 依序的步驟如下, 便可以計算出 signature. 1) canonical request Canonical_Request = HTTP_Request_Method + '\n' Canonical_URI + '\n' Canonical_Query_String + '\n' Canonical_Headers + '\n' Signed_Headers + '\n' HexEncode(Hash(RequestPayload)) 補充: url & query的部分是需要url encoded, 範例如下: Canonical_URI: encoded => /asustor-test/s3/upload/%E4%BA%BA original => /asustor-test/s3/upload/人) Canonical_Query_String: encoded => delimiter=%2F&prefix=s3%2Fupload%2Ftest%2F original => delimiter=/&prefix=s3/upload/test/) 2) string to sign StringToSign = Algorithm + '\n' RequestDate + '\n' CredentialScope + '\n' Hashed( Canonical_Request )) 補充: RequestDate為ISO8601 Basic format (YYYYMMDD'T'HHMMSS'Z') 3) signing key 這邊主要是把secret access key 和 CredentialScope結合起來計算出signing key. (e.g. Credential Scope為20110909/us-east-1/iam/aws4_request) ...