JS encryption - python decryption
I want to encrypt some vars in js code and pa开发者_StackOverflow社区ss them to server side (Python). How can I implement this? Thanks in advance!
Activate HTTPS on your server and all communication between the browser and your server will be encrypted, and you won't need to do any additional work in your code.
How you do this depends on what webserver you're using.
HTTPS is definitely the way to go. However, if for whatever reason HTTPS is unavailable (e.g., you're on google app engine with a custom domain), you can try jCryption on the front-end and pyCrypto on the server.
An advantage is that you do not need to buy an SSL certificate or deal with certificate administration. A disadvantage (and it's a big one) is that it is very easy to get encryption wrong and expose your site to security vulnerabilities. Also, without a certificate your site is still vulnerable to certain types of attacks. So make sure you know how the encryption works and proceed with caution.
精彩评论