Home  >  Article  >  Backend Development  >  API interface symmetric encryption and decryption function issues

API interface symmetric encryption and decryption function issues

WBOY
WBOYOriginal
2016-08-08 09:06:521081browse

I wrote an encryption function and the corresponding decryption function in PHP. When PHP calls the PHP interface, there is no problem. But when the front-end ajax calls my PHP interface, the ajax parameters cannot be encrypted because the front-end cannot use PHP at all. function, should I use js to rewrite my PHP encryption function? Even if you write it out, it is not safe for the js source code to be exposed to the outside. Do you have any good methods? Is there a solution that allows both ajax and PHP to make authorization calls?

Reply content:

I wrote an encryption function and the corresponding decryption function in PHP. When PHP calls the PHP interface, there is no problem. But when the front-end ajax calls my PHP interface, the ajax parameters cannot be encrypted because the front-end cannot use PHP at all. function, should I use js to rewrite my PHP encryption function? Even if you write it out, it is not safe for the js source code to be exposed to the outside. Do you have any good methods? Is there a solution that allows both ajax and PHP to call authorization calls?

Search for Diffie-Hellman key exchange algorithm

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn