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.
-
google.com -> "javascript encryption java decryption" or only "javascript encryption" ?Andreas– Andreas2012-06-01 08:49:16 +00:00Commented Jun 1, 2012 at 8:49
-
@Andreas i have done googling before posting and tried out the solutions given in that nothing worked that out for me as such and its not a blind post.neo– neo2012-06-01 08:52:41 +00:00Commented Jun 1, 2012 at 8:52
-
Not sure why i am not getting answers but only downvotes :). Downvotes are welcome if u really feel its a sily question but can i get a bettter answer before thatneo– neo2012-06-01 08:56:24 +00:00Commented Jun 1, 2012 at 8:56
-
Then post what you've done and the code you've tried which isn't working instead of asking us to do your job ;)Andreas– Andreas2012-06-01 08:57:45 +00:00Commented Jun 1, 2012 at 8:57
-
1You're probably getting downvoted because you have not shown what you have tried to solve the problem yourself. On a sidenote, there are only 2 possible answers to your current question: "yes" and "no". Try to rephrase your question in such a way that we can actually guide you in the right direction.Maza89– Maza892012-06-01 09:00:56 +00:00Commented Jun 1, 2012 at 9:00
3 Answers
Found this library on web and apparently it is what you are seeking of.
You can find about Java decryption here.
1 Comment
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).
Comments
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.