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.