Problem with PBE

Linden D. Anderson (linden.anderson@Coastek.com)
Wed, 10 Mar 1999 10:59:57 -0800

Date: Wed, 10 Mar 1999 10:59:57 -0800
From: "Linden D. Anderson" <linden.anderson@Coastek.com>
To: java-security@java.sun.com
Subject: Problem with PBE

I downloaded and installed JCE (jce12-rc1-dom).

I wrote a program which does hashing and everything works.

I copied code from the JCE Doc which shows an example of PBE, but I get
the following error message when I try to run it:

java.security.NoSuchAlgorithmException: Algorithm PBEWithMD5AndDES not
available

I tracked down the code and it happens here (see the ***):

String aPassword = new String("Do not share this with anybody");

Provider sunJce = new com.sun.crypto.provider.SunJCE();

PBEKeySpec pbeKeySpec;
PBEParameterSpec pbeParamSpec;
SecretKeyFactory keyFac;

// Salt
byte[] salt = {
(byte)0xc7, (byte)0x73, (byte)0x21, (byte)0x8c,
(byte)0x7e, (byte)0xc8, (byte)0xee, (byte)0x99
};

// Iteration count
int count = 20;

// Create PBE parameter set
pbeParamSpec = new PBEParameterSpec(salt, count);

// Convert password into SecretKey object,
// using a PBE key factory
pbeKeySpec = new PBEKeySpec(aPassword.toCharArray());
*** keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES");

Is the doc wrong?

Thanks, Linden....

--
Linden D. Anderson
Senior Member Technical Staff - Java Development
Coastek Inc.
5522 Scotts Valley Drive
Scotts Valley, CA 95066-3473

Direct (831)430-4401 FAX (831)438-2979

e:Mail: linden.anderson@coastek.com Website: http://www.coastek.com

"Java, it's not just for breakfast anymore!" --Linden 1998