Signature
Simlessly
# Request Header Parameters:
Parameter | Description |
---|---|
AccessKey | Requester identifier, provided by Simlessly Platform, used in request header when calling the API. |
Timestamp | Timestamp of present time (in milliseconds), valid for 10 mins and used in request header. |
RequestID | UUID generated for each request, used in request header. Each requestID can only be used once. |
Signature | Data packet signing result, non-case-insensitive, used in request header. |
# Signature Calculation:
Use the HMACSHA256 encryption.
# Calculation by HMACSHA256:
- signData = Timestamp + RequestID + AccessKey + RequestBody
- signature = HMACSHA256(signData, SecretKey)
//Java signature algorithm implementation
public static String HMACSHA256(String data, String SecretKey) throws Exception {
Mac sha256HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(SecretKey.getBytes("UTF-8"), "HmacSHA256");
sha256HMAC.init(secretKey);
byte[] array = sha256HMAC.doFinal(data.getBytes("UTF-8"));
StringBuilder sb = new StringBuilder();
for (byte item : array) {
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
}
return sb.toString().toUpperCase();
}
# Field Description
Field | Description |
---|---|
SecretKey | Key generated by Simlessly Platform, not transmitted over the Internet |
AccessKey | Public key generated by Simlessly Platform for signature encryption |
# Signature Demo
Timestamp=1628670421
RequestID=4ce9d9cdac9e4e17b3a2c66c358c1ce2
AccessKey=11111
signature=7EB765E27DF5373DEA2DBC8C41A7D9557743E46C8054750F3D851B3FD01D0835