# Re: Problem with PBE

Jan Luehe (Jan.Luehe@eng.sun.com)
Wed, 10 Mar 1999 13:04:59 -0800 (PST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Yang-Chao Lin: "Re: JCE 1.2"
- Previous message: Linden D. Anderson: "Problem with PBE"
- Maybe in reply to: Linden D. Anderson: "Problem with PBE"

    Date: Wed, 10 Mar 1999 13:04:59 -0800 (PST)

    From: Jan Luehe <Jan.Luehe@eng.sun.com>

    Subject: Re: Problem with PBE

    To: java-security@java.sun.com, linden.anderson@Coastek.com

Linden:

I could not find the example you are referencing in the
JCE 1.2 RC1 user guide.

Anyways, after you have instantiated the provider
("Provider sunJce = new com.sun.crypto.provider.SunJCE();"),
you need to register it, like this.

Security.addProvider(sunJce);

Then the algorithm will be found.

Thanks,

Jan

> 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
>
>

- Next message: Yang-Chao Lin: "Re: JCE 1.2"
- Previous message: Linden D. Anderson: "Problem with PBE"
- Maybe in reply to: Linden D. Anderson: "Problem with PBE"