How do I decrypt cipher text in java which is encrypted by windows wincrypt and vice versa.

How can I decrypt cipher text in java, encrypted by wincrypt.h function CryptEncrypt. I am planning to use CALG_RC4.
Who is Participating?
Infinity08Connect With a Mentor Commented:
You can either implement it yourself using this information about RC4 :

(also contains pseudocode and several links to more info). It's not very complicated.

Or use what mareqq suggested ...
mareqqConnect With a Mentor Commented:
You can use the JCA/JCE provider or provider for cryptographic functions.
CEHJConnect With a Mentor Commented:
You might save yourself time and energy in the end by calling it in JNI
ddas_authAuthor Commented:
I think there are challanges in JNI. My program will run in user's windows xp computer. User's jre version and and classpath might be all different. One of the sun documentation mentioned that user has to first uninstall 1.4.0 before installing 1.4.2 in order to achieve correct JNI invocation. Similar things might happen with newer jre upgrade.

Last time I was working on JNI, I found a funny problem. I had to add location of jre jvm.dll to the "path" environment variable.
Hmm. Sounds odd - it's the first i've heard of these issues.

>>All I had to do was set path=%path%;C:\Program Files\Java\jre1.5.0_11\bin\client;

What is 'client'?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.