Jboss problem with Cryptographic algorithm PBEWithMD5AndDES
843811Dec 24 2009 — edited Dec 28 2009I am trying to deploy a war file which has logic to use java cryptographic logic as below.
when I deploy this war file in weblogic9.2 server it works fine.
But when I try to use this logic in Jboss 4.2.3 it does not work. It returns null when I call Cipher.getInstance().
I am using PBEWithMD5AndDES algorithm.
I am using JDK 1.5.0_10.
Why would same logic work under Weblogic 9.2 and do not work under Jboss 4.2.3 ?
Please help me if anybody knows this issue.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
byte[] salt = {
(byte) 0xAA, (byte) 0x9B, (byte) 0xC8, (byte) 0x32,
(byte) 0x56, (byte) 0x11, (byte) 0xE3, (byte) 0x03
};
// Iteration count
int iterationCount = 19;
try {
KeySpec keySpec = new PBEKeySpec(PASS_CODE.toCharArray(), salt, iterationCount);
SecretKey key = SecretKeyFactory.getInstance(Config.
getProperty("PBEWithMD5AndDES")).generateSecret(keySpec);
_ecipher = Cipher.getInstance(key.getAlgorithm());
_dcipher = Cipher.getInstance(key.getAlgorithm());
// Prepare the parameters to the cipthers
AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);
ecipher.init(Cipher.ENCRYPTMODE, key, paramSpec);
dcipher.init(Cipher.DECRYPTMODE, key, paramSpec);
} catch (InvalidAlgorithmParameterException e) {
System.err.println("EXCEPTION: InvalidAlgorithmParameterException");
} catch (InvalidKeySpecException e) {
System.err.println("EXCEPTION: InvalidKeySpecException");
} catch (NoSuchPaddingException e) {
System.err.println("EXCEPTION: NoSuchPaddingException");
} catch (NoSuchAlgorithmException e) {
System.err.println("EXCEPTION: NoSuchAlgorithmException");
} catch (InvalidKeyException e) {
System.err.println("EXCEPTION: InvalidKeyException");
}