Message encryption rules
The transaction interfaces provided by this platform all use the HTTP protocol to provide services to the outside world. For the content of the protocol message, the following methods are used to encrypt and verify the signature.
Assuming that all the data sent or received is set M, the parameters of the parameter values ​​in set M are sorted according to the parameter name ASCII code from small to large (dictionary order), and the parameter value(ie value1value2value3 ...) is spliced ​​into a string strX**.
info
- The ASCII code of the parameter name is sorted from small to large(Dictionary order)
- In the original signature string (strX), the parameter values ​​are all the original values, and URL Encode is not performed
- platSign is generated after signing. When receiving platform callbacks, when decrypting and verifying and comparing, do not mention that this field is included in the comparison :::
Developers can refer to the examples provided in the document to understand the specific encryption and decryption process Example Demo, the encryption process is described in detail below.
Assume that the content of the original message sent by the user to the server is as follows:
Sort the key values ​​first, and then concatenate the parameter values. The content of the message generates the message content to be signed strX is:
Then use the private key generated by the merchant (reference configuration merchant) to encrypt the message content:
Finally, the newly generated message is added to the original message as a supplementary field. The complete data message sent to the server is: