generating AES 128 bit key frm password

  • Follow


Hello All,
I want to create 128 bits AES key from (user's password + unique salt
to that user) , key will be used to encrypt his private key in my
database. plz suggest ways for it using JDK 1.5 and SUN JCE provider
only.

My sol'n. is:

step 1> seed SHA1PRNG with (user's password + unique salt to that user)

step 2> initialize keyGenerator with this PRNG
step 3> just call 'GenerateKey()' method once. to get 'same' key all
the time.

I think, there must be smoother way than this.
I tried 'SecretKeyFactory' with PBEKeySpec, but it doesn't generate
"AES" keys

Your suggestions are most welcome. :-)

0
Reply rajeshsbhide2111 (6) 11/8/2006 5:32:44 AM

Majestic wrote:
> Hello All,
> I want to create 128 bits AES key from (user's password + unique salt
> to that user) , key will be used to encrypt his private key in my
> database. plz suggest ways for it using JDK 1.5 and SUN JCE provider
> only.
> 
> My sol'n. is:
> 
> step 1> seed SHA1PRNG with (user's password + unique salt to that user)
> 
> step 2> initialize keyGenerator with this PRNG
> step 3> just call 'GenerateKey()' method once. to get 'same' key all
> the time.
> 
> I think, there must be smoother way than this.

   You can use the first 128 bits of the SHA-1 hash of the password-salt 
concatenation.

--Mike Amling
0
Reply Mike 11/9/2006 10:27:08 PM


Mike Amling wrote:
> Majestic wrote:
> > Hello All,
> > I want to create 128 bits AES key from (user's password + unique salt
> > to that user) , key will be used to encrypt his private key in my
> > database. plz suggest ways for it using JDK 1.5 and SUN JCE provider
> > only.
> >
> > My sol'n. is:
> >
> > step 1> seed SHA1PRNG with (user's password + unique salt to that user)
> >
> > step 2> initialize keyGenerator with this PRNG
> > step 3> just call 'GenerateKey()' method once. to get 'same' key all
> > the time.
> >
> > I think, there must be smoother way than this.
>
>    You can use the first 128 bits of the SHA-1 hash of the password-salt
> concatenation.
>
> --Mike Amling

then, how to generate 'SecretKey' frm those raw key bytes,
SecretKeyFactory doesn't help.
plz give code snippets :-)

thnx in advance.

0
Reply Rajesh 11/10/2006 5:30:55 AM

Rajesh wrote:
> Mike Amling wrote:
>> Majestic wrote:
>>> I think, there must be smoother way than this.
 >>
>>    You can use the first 128 bits of the SHA-1 hash of the password-salt
>> concatenation.
>>
>> --Mike Amling
> 
> then, how to generate 'SecretKey' frm those raw key bytes,
> SecretKeyFactory doesn't help.
> plz give code snippets :-)

   Sorry, I've never used anything in javax.crypto or the JCE.

   Anyone?

--Mike Amling
0
Reply Mike 11/12/2006 12:53:36 PM

3 Replies
664 Views

(page loaded in 0.082 seconds)

Similiar Articles:













7/23/2012 7:37:18 AM


Reply: