1
What is the best way to traffic data between JS and PHP vie GET method? Imagine a $http request made on Angularjs passing ex parameters: minhaurl? id=2&name="Joao"
The ideal would be to encrypt the parameters. But the BASE64 is flawed in relation to UTF8.
So, how to send data in encrypted form via GET and decrypt in PHP and send the answers encrypted in PHP and decrypt in js?
It is mandatory to use the get method?
– Cassiano Mesquita
If you are talking about Base64 security it is not to encrypt and neither any method I know will serve you like this, I believe the way is to use HTTPS.
– Guilherme Nascimento
Not really. I could use the POST. But my question is whether it would be possible to make the GET secure. Even if I use the POST, it would still be possible for any personnel to capture the headers and inspect the variables. which makes my application insecure. So independent of GET or POST. How to encrypt and ensure decoding in JS/PHP
– Israel Zebulon
To use get safely you would need to use an SSL certificate and use HTTPS. And the safest way is by the post method.
– Cassiano Mesquita
JWT still has many flaws ...
– Israel Zebulon
Any encryption would be insecure in client side, since it is possible to know which algorithm was used to encrypt. You need data to be encrypted in PHP before rendering HTML - the ID
1
becomesa3d296261dbda886e8685e4bad338bf4
– Papa Charlie
Base64 is not encryption and Base64 has no problem with UTF-8. And there is no point in "encrypting" anything on the JS side, as it can be undone with peace of mind. Even if you send a different key to the JS for each request, whoever intercepts the communication will have access to it. HTTPS is what you can do (and even so, against third parties, because on the client side, everything is accessible).
– Bacco
It has some faults yes: http://stackoverflow.com/questions/30106476/using-javascripts-atob-to-decode-base64-doesnt-properly-decode-utf-8-strings
– Israel Zebulon
Try to encrypt the contents of the data using the Crypto-js: https://github.com/brix/crypto-jslibrary
– Roger Sampaio