How to encrypt a POST via Ajax

1

How do I encrypt the posts I send via Ajax? For example in the Telegram Web they do this, it is possible to see by the XHR with the requisitions sent and received.

Example of what it is like on the Telegram Web (I wish my application would look like this too):

Ps: I'm developing with Javascript and PHP.

    
asked by anonymous 26.05.2015 / 05:24

1 answer

1

One way to do this is to use the jCryption library ( link ).

As the example on their page, the browser would send the following request.

POST

http://www.jcryption.org/jcryption.php?jCryption=U2FsdGVkX19Zw/DbJFLurww7uudVpt/sdgTx7ezKlLsxrx82sfFwdaZw7oT9a4Feu0EzKZ7w+yX7UC+R5K2wh/6Kwpt08yQ2K00yP+a2EnE=

HTTP/1.1

And the server would get the data as expected.

"email=john%40smith.com&password=1234&role=Admin&remember=on"
    
26.05.2015 / 22:51