All Products
Search
Document Center

Signature Mechanism

Last Updated: Apr 27, 2018

The Content Moderation service performs identity authentication for every access request. Therefore, you must contain the signature information in the request no matter whether you submit a request through the HTTP or HTTPS protocol. Content Moderation verifies the requester identity using symmetric encryption of the Access Key ID and Access Key Secret. The Access Key ID and Access Key Secret are officially issued to visitors by Alibaba Cloud (you can apply for and manage them on the Alibaba Cloud official website).

In specific

  • The Access Key ID indicates the identity of the visitor.
  • The Access Key Secret is the secret key used to encrypt the signature string and to verify the signature string on the server. It must be kept strictly confidential and only be known to Alibaba Cloud and the user.

When you visit a server, the following method is used to sign the request:

  1. Serialize the request header. For all HTTP headers beginning with “x-acs-“, concatenate into a string in the following stepsA. Extract all HTTP headers beginning with “x-acs-“B. Sort the extracted headers in ascending orderC. For each header, concatenate + “:” + + “\n”
  2. Serialize URI and query parameters. As there is only one parameter (ClientInfo), concatenate + “?clientInfo=” + , note that no URL encoding is required
  3. Build the complete signature string, in order to be signed,“POST\napplication/json\n” + + “\n” + “application/json” + “\n” + + “\n” + +
  4. Based on the signature string built in step #3, encrypt it with the HMAC-SHA1 algorithm, and base64 encoding; and then put it into Authorization signature in the HTTP header: “acs ” + + “:” + . Note that the secret key within algorithm HMAC-SHA1 is the same as Access Key Id secret.

Example of the signature string in the image synchronous API:

  1. POST
  2. application/json
  3. C+5Y0crpO4sYgC2DNjycug==
  4. application/json
  5. Tue, 14 Mar 2017 06:29:50 GMT
  6. x-acs-signature-method:HMAC-SHA1
  7. x-acs-signature-nonce:339497c2-d91f-4c17-a0a3-1192ee9e2202
  8. x-acs-signature-version:1.0
  9. x-acs-version:2017-01-12
  10. /green/image/scan?clientInfo={"ip":"127.0.0.2","userId":"120234234","userNick":"Mike","userType":"others"}