Hi,
I am trying to encrypt a string before writing it to the database and then trying to decrypt it while fetching from the database.
I have a java program using Cipher class to
Cipher pbeCipher = Cipher.getInstance(“PBEWithMD5AndDES”);
This statement works when I try it from a Java Program. But when I create this as a webMethods Java service, I am getting an exception “exceptionjava.security.NoSuchAlgorithmException: Algorithm PBEWithMD5AndDES not implemented.”
Yes, Cipher is part of the JCE spec which is an optional extension for pre 1.4 JDKs.
Are you using the same VM when running the standalone program versus the Integration Server?
The Integration Server includes a JCE provider that has PBE, but the name has different capitialization. Can you try the following instead? PbeWithMD5AndDES_CBC
I know…it really sucks that there aren’t standard names for specifying common cipher capabilities.
MessageDigest works as a one way hashing. But with Cipher I can just encrypt the string and send it and decrypt in the backend back to the actual string.
Thats why I decided to use Cipher class.
And I am using the same VM when I try to run the service from my local machine. The last time I heard from wm support was about the classpath for my developer being the same as the command prompt from where I am running this program. Those are the same too.
Here is the error that I am getting.
PBEKeySpecNoSuchAlgorithmExceptionjava.security.NoSuchAlgorithmException: Algorithm PbeWithMD5AndDES_CBC not implemented.
Has anyone implemented the encrypting a string thing?
Thanks
Are you getting this error when running your standalone program or within the Integration Server?
Consult your JDK documentation for the available PBE cipher names if you’re running in a standalone program (sounds like PBEWithMD5AndDES works for you).
If you’re running a Java service within the context of the Integration Server, you need to use the one I suggested. Here’s a snippet of Java source that doesn’t throw an exception: