# 1. Merchant Subscription Event Notification - Signature Process

# Signature Process

  • Parameters involved in encryption: excluding byte-type parameters, such as file and byte stream, remove the sign field, and remove the parameter with an empty value(Both of null and empty);
  • Sort in ascending order according to the ASCII code of the key value of the first character (in ascending alphabetical order), if the same character is encountered, it will sort in ascending order according to the ASCII code of the key value of the second character, and so on;
  • Combine the sorted parameters and their corresponding values into the format of parameter=parameter value, and connect these parameters with the & character to generate a string at this time;
  • Concatenate the merchant key &secret=${secret} at the end of the parameter concatenated string to form the final original string
  • The original string is encrypted using the sha1 algorithm

# Signature original string example Java Demo

String originString = "amount=100.00&appId=f90addc4861540ef9312e87d8f360e08&version=1.0";
originString = originString + "&secret=xxxxxxx";
DigestUtils.sha1Hex(originString);