Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / April 2005

Tip: Looking for answers? Try searching our database.

Getting derived key from PBE

Thread view: 
Michel Gallant - 22 Apr 2005 16:07 GMT
Is there any way to access the DERIVED key (say a 3DES key)
in J2SE and PBE?
I think that although the internally derived IV is accessible, the
derived key is not. Is that correct?

e.g.

  String MYPBEALG = "PBEWithSHA1AndDESede" ;
  PBEParameterSpec  pbeParamSpec = new PBEParameterSpec(salt, count);
  String password = "ssshh! a difficult secret" ;
  PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray());
  keyFac = SecretKeyFactory.getInstance(MYPBEALG);
  SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec);
  Cipher pbeCipher = Cipher.getInstance(MYPBEALG);
  pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec);

  byte[] IV = pbeCipher.getIV() ; //actual internally generated IV

  byte[] key = pbeKey.getEncoded();   //this just returns the password as a byte[]

- Mitch
ekuleshov@gmail.com - 22 Apr 2005 18:16 GMT
> Is there any way to access the DERIVED key (say a 3DES key)
> in J2SE and PBE?
[quoted text clipped - 15 lines]
>
>    byte[] key = pbeKey.getEncoded();   //this just returns the password as a byte[]

 There are some helper classes in BouncyCastle provider that will
return derived key params.

 regards,
 Eugene


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.