• Cloud Container Engine

  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. APIs
  5. Authenticating Requests
  6. AK/SK Authentication
  7. Request Signing Procedure

Request Signing Procedure


  1. Download the API gateway signing tool from the following website:


  2. Extract the package.
  3. Create a Java project, and reference the extracted JAR to the dependency path.

Sign a Request

  1. Create a request com.cloud.sdk.DefaultRequest (JAVA) used for signing.
  2. Set the target API URL, HTTPS method, and content of request com.cloud.sdk.DefaultRequest (JAVA).
  3. Sign request com.cloud.sdk.DefaultRequest (JAVA).
    1. Call SignerFactory.getSigner(String serviceName, String regionName) to obtain a signing tool.
    2. Call Signer.sign(Request<?> request, Credentials credentials) to sign the request created in step 1.

      The following code shows the details:

      //Select an algorithm for request signing.
      Signer signer = SignerFactory.getSigner(serviceName, region);
      //Sign the request. The request will change after the signing.
      signer.sign(request, new BasicCredentials(this.ak, this.sk));
  4. Convert the request signed in the previous step to a new request that can be used to make an API call and copy the header of the signed request to the new request.

    For example, if Apache HttpClient is used, convert DefaultRequest to HttpRequestBase and copy the header of the signed DefaultRequest to HttpRequestBase.

    For details, see descriptions of AccessServiceImpl.java in section Sample Code.