p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

security_java thread: java.security.NoSuchAlgorithmException: PBEWithSHAAndBlowfish not found


Message #1 by jifengzhilang200@1... on Sun, 22 Sep 2002 05:40:32
The algorithm is installed on the machine on which you ran your application
but not in the servlet container you're using.  You need to either use a
different algorithm provider that is supported on your container or install
the provider on your container.

http://java.sun.com/products/jce/jce122_providers.html

Greg Dunn
RDQ - Database & Systems Development
NISC St. Peters - SRF
636-922-9122,  Ext. 7690
greg.dunn@n...



-----Original Message-----
From: jifengzhilang200@1... [mailto:jifengzhilang200@1...]
Sent: Sunday, September 22, 2002 5:41 AM
To: Java Security
Subject: [security_java] java.security.NoSuchAlgorithmException:
PBEWithSHAAndBlowfish not found


Hello,everyone:
    I write a application,the application uses the PBE,the code like that:
public static String decrypt(char[] password, String text) throws
java.lang.Exception {
	String salt=text.substring(0,12);
	String cipherText=text.substring(12,text.length());
	BASE64Decoder decoder=new BASE64Decoder();
	byte[] saltArray=decoder.decodeBuffer(salt);
	byte[] cipherTextArray=decoder.decodeBuffer(cipherText);
	PBEKeySpec keySpec=new PBEKeySpec(password);
	SecretKeyFactory keyFactory=SecretKeyFactory.getInstance
("PBEWithSHAAndBlowfish");
	SecretKey key=keyFactory.generateSecret(keySpec);
	PBEParameterSpec paramSpec=new PBEParameterSpec
(saltArray,ITERATIONS);
	Cipher cipher=Cipher.getInstance("PBEWithSHAAndBlowfish");
	cipher.init(Cipher.DECRYPT_MODE,key,paramSpec);
	byte[] plaintextArray=cipher.doFinal(cipherTextArray);
	return new String(plaintextArray);
}
and run the appliation ,that's ok!!!!
    But when i write a servlet ,the servlet use the method in the
application ,the Exception throws:
java.security.NoSuchAlgorithmException: PBEWithSHAAndBlowfish not found
    I use IBM VisualAge for Java Enterprise 4.0,i test the servlet in the
Websphere Test Environment.
I don't know what wrong,thanks for you help.



  Return to Index