简体   繁体   中英

encryption in javascript and decryption in java

Is it possible to do a simple encryption JavaScript and retrieve the data in java. I am aware of the javascript encryption disadvantages but i have to do the same for as of now . there is no posibiliy of using SSL instead.

Found this library on web and apparently it is what you are seeking of.

Blowfish Encyption Library

You can find about Java decryption here .

There are javascript implementations of RSA, Blowfish, DSA, TEA and others (try google for code). You'll have to do some testing to find out what implementations create the same representation of the encrypted content.

There's not really a huge benefit in using a very sophisticated algorithm / large key size since there are vulnerabilities in the transfer of the javascript (and any keys) over a non-secured connection (even if you imlpement an asymmetric cypher and only send the public key, a MITM can modify the javascript to send an unencrypted version). If it were me, I' proably go with TEA (a quick google turned up lots of implementations, including a java one here ).

If it really, really has to be JS cryptography, the Stanford Javascript Crypto Library is worth a look. It has been designed to follow modern requirements as much as possible, as described in the paper about it. Of course it will suffer from the general shortcomings of browser-based Javascript cryptography as well, but unfortunately there seem to be more shaky parts in the sources, as owlstead mentions in the comments. It is still under development and these parts will hopefully be improved. But given that there is no equivalent to something like OpenSSL in Javascript, it might be worth a try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM