I wrote a pass phrase Encryption code that when I run it outside Tomcat env.
it works fine, but when I run it on Tomcat, it fails.
this is part of the code:
public static String encrypt(String passPhrase, String inputPhrase) {
String algorithm = "PBEWithMD5AndDES";
byte[] salt = new byte[8];
int iterations = 20;
byte[] output = new byte[128];
try {
// Register the security provider
Security.addProvider(new com.sun.crypto.provider.SunJCE());
// Create a key from supplied passphrase
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray());
SecretKeyFactory secretKeyFactory =
SecretKeyFactory.getInstance(algorithm);
SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
.
.
.
It creates a PBE KeySpec, when the code gets to creating SecretKeyFactory,
fails.
Since "PBEWithMD5AndDES" algorithm is part of the sunjce_provider.jar, I am
assuming that Provider never gets registered.
anybody else run into similar issues? Any insight is appreciated.
Ilhami Topaloglu
ePredix
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>