Okay, I'm really a C++ programmer, just recently made the shift to Java. Now, I've got two problems: 1. How does one call a C++ dll (under windows) from java? I know you use the JNI and define the method as native, but where, what how? anyone got a simple little example? 2. I've written a C++ trapdoor encryption function. Now, if I can figure out the way to use the JNI, I can call the dll from Java, but I'd prefer to use straight java, for portability reasons. Does java have an encryption method/algorithm? Or can anyone suggest a place where I can find source code for robust one-way encryption, in java? I can't write the thing myself (cryptograhpy is not my forte and the C++ code uses calls like memset etc). I'd apperiaciate any and all suggestions. Thanks!! Mari
SCJP2<p>"Don't be afraid to try something new, remember amatuers built the ark, professionals built the Titanic!"
If you're using the 1.4 jdk, then the javax.crypto package is included. You probably want to use javax.crypto.Cipher class. It used to be part of a separate download in 1.3 called JCE (Java Cryptography Extension), so if you're using that, you'll have to download it from the sun site. Also, note that the version included with the JDK 1.4 is "weak" to comply with the U.S.'s illogical laws on exporting cryto technology outside the country. If you need a stronger crypto system, you can get that from Sun as well but they make you fill out a questionaire to verify that you are legally allowed to get it. For the native method calls, you can check out the tutorial on Sun's site.: http://java.sun.com/docs/books/tutorial/native1.1/concepts/index.html In fact, I always recomend everyone first search for info on the Sun site, as it is very comprehensive on all things Java. [ July 02, 2002: Message edited by: Rob Ross ]