Data Signature and Decryption

Last Updated on : 2025-01-23 06:16:34download

This topic describes the method of signing message queue data.

Set up signature verification

Before you get the real data, you can set the tamper-proof MD5 signature verification. The signature algorithm is processed in the following procedure:

  1. Format the received JSON parameters (except sign and the parameters with an empty value) into key=val.
  2. Assemble them in ascending order of key. The assembled string looks like this: k1=v1||k2=v2.
  3. Add the Access Secret to the string. Example: k1=v1||k2=v2...kn=vn||key.
  4. Generate the MD5 signature of the final string.
  5. The data is not tampered with if the MD5 signature value is the same as the sign value. Otherwise, the data has been tampered with.

Decrypt the data

The data is decrypted after the signature is verified.

  1. Decode the Base64 encoded data.
  2. Decrypt data using AES/ECB or AES/GCM mode. Use the middle 16 characters of the Access Secret as the key to decrypt and get the actual message data.
  • After you subscribe to the Message Service, AES/ECB mode is used by default to decrypt data.
  • Currently, there is no option available for you to switch on your own. You can submit a service ticket to switch to the AES/GCM mode.