Something like this should do the trick:

        byte[] encodedKey;      // read from file
        PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encodedKey);
        KeyFactory keyFactory = KeyFactory.getInstance("DSA");
        DSAPrivateKey privKey = (DSAPrivateKey)keyFactory.generatePrivate(keySpec);

Regards,

Steven

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Mark W. Webb
Sent: Thursday, 30 August 2001 5:53 AM
To: [EMAIL PROTECTED]
Subject: reading in PKCS8 DSA priv key to java


I know this may be off topic, but I wrote some code to create a DSA key
pair,
and matching certificate.  The private key is stored in a file with PKCS8
encoding.  I want to be able to read the private key file into my java
program.  The certificate is used by a C based program.

Can someone give me some help as to how and read the private key into my
java
program.

Thank you.


--
Mark Webb
Software Engineer
Dolphin Technology
1300B Floyd Ave
Rome, NY 13440

Phone: (315) 334-4892 x222
Fax: (315) 339-4846
Email: [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to