[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [iaik-jce] saving and reading private key to/from file
Here is a possible solution for your problem (modulo exception / error
You'll get a byte array which you can write into a file.
KeyFactory kf = KeyFactory.getInstance( privateKey instanceof
RSAPrivateKey ? "RSA" : "DSA" );
pkcs8EncodedKey = ((PKCS8EncodedKeySpec)kf.getKeySpec(privateKey,
> -----Original Message-----
> From: Ronen Lazar [mailto:RonenL@gilian.com]
> Sent: Montag, 18. Dezember 2000 20:03
> To: 'email@example.com'
> Subject: [iaik-jce] saving and reading private key to/from file
> Hello good people,
> Once I've created a private key (say DSA or RSA), I'd like to
> be able to
> store it in a file, and than be able to restore it into a
> PrivateKey object.
> How can that be done?
> I thought using DsaPrivateKey (for DSA private key) could be
> the answer, but
> its decode()/encode() methods are protected, so I doubt it's the right
> Any help would be most appreciated.
> Mailinglist-archive at
> To unsubscribe send an email to firstname.lastname@example.org with the
> folowing content: UNSUBSCRIBE iaik-jce
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html
To unsubscribe send an email to email@example.com with the folowing content: UNSUBSCRIBE iaik-jce