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 / December 2003

Tip: Looking for answers? Try searching our database.

crypto Help

Thread view: 
climber666[X]libero[.]it - 18 Dec 2003 15:22 GMT
Hi, i have a doubt, i'm not able to resolve about crypto key generation:
when i genererate a 3des key in this way:

SecretKey key1 = new SecretKeySpec("key24Byte".getBytes("UTF-8"), "DESede");

and this other:

DESedeKeySpec keySpec = new DESedeKeySpec(("key24Byte".getBytes("UTF-8"));
SecretKeyFactory skf = SecretKeyFactory.getInstance("DESede");
SecretKey key2 = skf.generateSecret(keySpec);

and perform:
System.out.println(base64(key1.getEncoded()));
System.out.println(base64(key2.getEncoded()));

i can see 2 different strings?
thanks!
Michael Amling - 19 Dec 2003 01:23 GMT
> Hi, i have a doubt, i'm not able to resolve about crypto key generation:
> when i genererate a 3des key in this way:
[quoted text clipped - 12 lines]
>
> i can see 2 different strings?

  Are you asking why two randomly selected keys would be different?

--Mike Amling
climber666[X]libero[.]it - 19 Dec 2003 08:38 GMT
> > Hi, i have a doubt, i'm not able to resolve about crypto key generation:
> > when i genererate a 3des key in this way:
[quoted text clipped - 14 lines]
>
>    Are you asking why two randomly selected keys would be different?

the initial key string is the same, but key1 and key2 are different, why?
Thanks.
Michael Amling - 20 Dec 2003 03:13 GMT
>>>Hi, i have a doubt, i'm not able to resolve about crypto key generation:
>>>when i genererate a 3des key in this way:
[quoted text clipped - 16 lines]
>
> the initial key string is the same, but key1 and key2 are different, why?

  It would be easier if you dumped the results out in hex. For
instance, do they both start with 6B657932 34427974 65? Are the parity
bits treated differently?

--Mike Amling
Karl Scheibelhofer - 22 Dec 2003 13:54 GMT
your key will have the wrong size anyway. a triple DES key has to be 16 byte
or 24 byte (112 or 168 bit effectively). the SecretKeySpec class does not
check this. i am rather surprised that the DESedeKeySpec constructor did not
throw an exception because of the too short size.
note that 16 byte (112 bit effectively) key are not supported by all
implementations.

 Karl

--

Karl Scheibelhofer, IAIK - Graz University of Technology
Inffeldgasse 16a, 8010 Graz, Austria
Fax: +43 316 873 5520
http://jce.iaik.tugraz.at/

> Hi, i have a doubt, i'm not able to resolve about crypto key generation:
> when i genererate a 3des key in this way:
[quoted text clipped - 13 lines]
> i can see 2 different strings?
> thanks!


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.