Updated on 2025-10-16 GMT+08:00

Step 2: Create a To-Be-Signed String

After a standard HTTP request is constructed and the request hash value is obtained, create a to-be-signed string by combining them with the signature algorithm and signing time.

StringToSign =
Algorithm + \n +
HashedCanonicalRequest

Description:

  • Algorithm signature algorithm. For SHA-256, the algorithm is HMAC-SHA256.
  • HashedCanonicalRequest: standard request generated after hash processing. The pseudocode is as follows:
HashedCanonicalRequest =
HexEncode(Hash(CanonicalRequest))
  • Hash(String): a function for generating a message digest. Currently, SHA-256 is supported.
  • HexEncode(String): Base16 encoding function for returning a digest consisting of lowercase letters. Each byte you enter is expressed as two hexadecimal characters.