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 2004

Tip: Looking for answers? Try searching our database.

Importing private key from PKCS#8 file format

Thread view: 
Knack - 05 Apr 2004 01:53 GMT
hi,

for the client authentication process,

i have generated my own private key and public key using openssl. i
have also converted the private key to the unprotected pkcs 8 format
using openssl command, so tht java can read n use the key. For
successfull authentication to the server, challenge response is used.

my question is how to sign the challenge generated from the server
with the clients private key? how do we import the private key to sign
the challenge response?

Knack.
Michel Gallant - 05 Apr 2004 05:37 GMT
Are you talking about simply instantiating a PrivateKey from a
PrivateKeyInfo pkcs8 file?

 byte[] encodedPriKey = getFileBytes(args[0]);
 PKCS8EncodedKeySpec pvkKeySpec = new PKCS8EncodedKeySpec(encodedPriKey);
 KeyFactory keyFactory = KeyFactory.getInstance("RSA");
 RSAPrivateKey pvkKey = (RSAPrivateKey)keyFactory.generatePrivate(pvkKeySpec);

- Mitch

> hi,
>
[quoted text clipped - 10 lines]
>
> Knack.
Knack - 07 Apr 2004 04:43 GMT
i generated the .der file using openssl so tht i can read them in my
java program. i tried ur way n i will soon post the output. i am still
bogged down sending the x509 certificate along with the signed
challenge to the server to authenticate. will keep it posted.

Knack.

> Are you talking about simply instantiating a PrivateKey from a
> PrivateKeyInfo pkcs8 file?
[quoted text clipped - 20 lines]
> >
> > Knack.
Michel Gallant - 07 Apr 2004 21:40 GMT
Here is a brief openssl/pkcs #8 cheat sheet and some sample code for
reading pkcs #8:
  http://www.jensign.com/JavaScience/cryptoutils

- Mitch

> i generated the .der file using openssl so tht i can read them in my
> java program. i tried ur way n i will soon post the output. i am still
[quoted text clipped - 27 lines]
> > >
> > > Knack.


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.