API permission design summary

Source: Internet
Author: User

Encryption mode md5 (POST parameter (in ascending order, except the key sign parameter) + User key) PHP encryption algorithm code: [php] foreach ($ p as $ v) {$ temp = explode ("=", $ v); $ pArr [$ temp [0] = $ temp [1];} ksort ($ pArr ); foreach ($ pArr as $ k => $ v) {$ pStr2. = $ k. $ v;} md5 ($ pStr2. $ secret) Note: During encryption, the timestamp must be carried to prevent client tampering. The client sorts the parameters that need to be passed in ascending order, and then adds the key corresponding to the key (the key is saved in the server database, which cannot be made public) perform MD5 encryption and pass the parameter sign to the server. After the server obtains the sign value, it sorts the passed parameters by the same algorithm, queries the user's key to obtain the key, and then performs an encryption algorithm, the obtained server-side sign is compared with the sign passed by the client. If it is the same, it means it can be passed. If someone tampered with the data in the middle, the encrypted sign is inconsistent, which ensures the reliability and security of data transmission.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.