Function | Feature description |
UriEncode() | Encode the string with the following restrictions:
|
Lowercase() | Converts a string to lowercase. |
Hex() | Performs hexadecimal encoding on a string. |
SHA256Hash() | Implements the SHA-256 algorithm. |
HMAC-SHA256() | Implements the HMAC-SHA256 algorithm. |
Trim() | Removes whitespaces from both sides of a string. |
Header name | Description |
x-tos-content-sha256 | Specifies the format of the client-uploaded file and the signature method used. The values are explained as follows:
|
Content-Encoding | In this scenario, when the Content-Encoding value includes tos-chunked, it indicates that uploading data in multiple chunks is allowed and must be used together with x-tos-content-sha256. tip When saving an object, TOS does not store the tos-chunked attribute as user data, nor does it return the tos-chunked attribute in Content-Encoding when downloading the object. |
x-tos-trailer | Indicates the algorithm used for checksum in Trailing Header; the value can only be x-tos-hash-crc64ecma. It must be used together with x-tos-content-sha256 and Content-Encoding: tos-chunked. |
x-tos-decoded-content-length | Used for server-side verification of the received valid data length. Optional, set to the original file size. tip When setting the x-tos-decoded-content-length value, exclude the length of format data, signature data, and trailing header data introduced by multi-chunk encoding. For example: to upload a 4GB file, set the value to 4294967296. |
Content-Length | Optional, the length of the HTTP request body. tip
|
Parameter | Description |
HTTPMethod | The method used by the HTTP request, for example, PUT, GET, HEAD, or DELETE. |
CanonicalURI | UriEncode(<PATH>)
|
CanonicalQueryString | Encoding format of Query parameters in request: UriEncode(<QueryParam1>) + '=' + UriEncode(<value>) + '&' + UriEncode(<QueryParam2>) + '=' + UriEncode(<value>) + '&' + ... UriEncode(<QueryParamN>) + '=' + UriEncode(<value>) tip
|
CanonicalHeaders | Encoding format of the header in the request: Lowercase(<HeaderName1>) + ':' + Trim(<value>) + '\n' Lowercase(<HeaderName2>) + ':' + Trim(<value>) + '\n' ... Lowercase(<HeaderNameN>) +':' + Trim(<value>) + '\n' tip
|
SignedHeaders | Specify the headers to include in the signature: Lowercase(<HeaderName1>) + ';' + Lowercase(<HeaderName2>) + ... + Lowercase(<HeaderNameN>) tip
|
HashedPayload | Constant: STREAMING-TOS4-HMAC-SHA256-PAYLOAD-TRAILER |
Parameter | Note |
Algorithm | The signature algorithm currently supports only the HMAC-SHA256 algorithm. |
RequestDate | Request UTC time using the format: yyyyMMddTHHmmssZ. |
CredentialScope | Credential scope value in the format: yyyyMMdd/region/tos/request. |
CanonicalRequest | Result of the normalization request in the previous section. |
Parameter | Value |
Bucket name | examplebucket |
Object name | exampleobject |
Region | cn-beijing |
Time | Sat, 1 Jan 2022 00:00:00 GMT |
AccessKeyId | testAK |
SecretAccessKey | testSK |
Example | Value |
signature string (StringToSign) | TOS4-HMAC-SHA256-PAYLOAD 20220101T000000Z 20220101/cn-beijing/tos/request d40b66cf0054d1642843670d10fa095e1609c7896f25df217770b0abe717693b e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 bf718b6f653bebc184e1479f1935b8da974d701b893afcf49e701f3e2f9f9c5a |
Signature | b474d8862b1487a5145d686f57f013e54db672cee1c953b3010fb58501ef5aa2 |
chunked data | 10000;chunk-signature=b474d8862b1487a5145d686f57f013e54db672cee1c953b3010fb58501ef5aa2 <65536-bytes> |
Example | Value |
Signature string (StringToSign) | TOS4-HMAC-SHA256-PAYLOAD 20220101T000000Z 20220101/cn-beijing/tos/request b474d8862b1487a5145d686f57f013e54db672cee1c953b3010fb58501ef5aa2 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 41edece42d63e8d9bf515a9ba6932e1c20cbc9f5a5d134645adb5db1b9737ea3 |
Signature | 041169d545f3f4a02fe2e3d066bfb1798dd5f3417ae8cecd0e43690aafbe79d1 |
Data | 400;chunk-signature=041169d545f3f4a02fe2e3d066bfb1798dd5f3417ae8cecd0e43690aafbe79d1 <1024 bytes> |
Example | Value |
StringToSign | TOS4-HMAC-SHA256-PAYLOAD 20220101T000000Z 20220101/cn-beijing/tos/request 041169d545f3f4a02fe2e3d066bfb1798dd5f3417ae8cecd0e43690aafbe79d1 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
Signature | e05ab64fe1dfdbf0b5870abbaabdb063c371d4e96f2767e6934d90529c5ae850 |
Data | 0;chunk-signature=e05ab64fe1dfdbf0b5870abbaabdb063c371d4e96f2767e6934d90529c5ae850 |
Example | Value |
StringToSign | TOS4-HMAC-SHA256-TRAILER 20220101T000000Z 20220101/cn-beijing/tos/request e05ab64fe1dfdbf0b5870abbaabdb063c371d4e96f2767e6934d90529c5ae850 2e4ab969aa65b1ad6def2db10e4d3a8260683d194dbaf757f90e8a37960a4b3c |
Signature | 41e14ac611e27a8bb3d66c3bad6856f209297767d5dd4fc87d8fa9e422e03faf |
Data | x-tos-hash-crc64ecma:smtwW8C72Y8= x-tos-trailer-signature:41e14ac611e27a8bb3d66c3bad6856f209297767d5dd4fc87d8fa9e422e03faf |