Reputation: 313
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.
Upvotes: 1
Views: 1623
Reputation: 39650
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.
Upvotes: 1
Reputation: 48387
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).
Upvotes: 1
Reputation: 20956
Found this library on web and apparently it is what you are seeking of.
You can find about Java decryption here.
Upvotes: 1