Getting NoSuchAlgorithmException while using PBE
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Avi_Sharma
Posted On:   Thursday, December 14, 2006 08:59 AM

I am trying to use the PBEwithMD5AndDES algorithm for encryption on the following environment java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2) Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cn142sr1w-20041028 (JIT enabled: jitc)) I am using IBMJCE provider for JCE which comes as default with above JDK. I am always getting NoSuchAlgorithmException exception , when I run the following code for Password Base Encryption logic KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount); SecretKey key = SecretKeyFactory.getInstance("PBEwithMD5AndDES").generateSecret(keySpec)   More>>

I am trying to use the PBEwithMD5AndDES algorithm for encryption on the following environment


java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cn142sr1w-20041028 (JIT
enabled: jitc))


I am using IBMJCE provider for JCE which comes as default with above JDK.


I am always getting NoSuchAlgorithmException exception , when I run the following code for Password Base Encryption logic


			
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
SecretKey key = SecretKeyFactory.getInstance("PBEwithMD5AndDES").generateSecret(keySpec); >> At this line I get Algorithm not supported exception



I tried to change the above code with the following line
			
SecretKey key = SecretKeyFactory.getInstance("PBEwithMD5AndDES", "IBMJCE").generateSecret(keySpec);



and if I run the program now then I get the excpetion NoSuchProviderException, even though IBMJCE is registered as a provider. I verified this using this

Provider pr = Security.getProvider("IBMJCE");


I am not able to ascertain the exact cause of this error, as both algorithm and provider are supported by IBM JDK.


Thanks!    <<Less
About | Sitemap | Contact