Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes reading pem format private keys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "reading pem format private keys" Watch "reading pem format private keys" New topic
Author

reading pem format private keys

srini Raman
Ranch Hand

Joined: Oct 16, 2006
Posts: 33
Hi,
How can I read pem formated private keys using java classes. I am trying to pass it to PKCS8EncodedKeySpec and then using this in KeyFactory to generate private key.But at this step I get error...Should I decode (Base64)and remove the -----BEGIN RSA private KEY--- ----END RSA PRIVATE KEY--
Strings before passing this to PKCS8EncodedKeySpec ??

Thanks,
Srini
srini Raman
Ranch Hand

Joined: Oct 16, 2006
Posts: 33
Seems I can use Bouncycastle apis for the purpose.It has PEMReader,PEMWriter classes.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: reading pem format private keys
 
Similar Threads
pls check the private key
Store PrivateKey PublicKey in DB
JCE and binary private keys
How to store PublicKey and PrivateKey in database??
Accessing HTTPS URL with a Client PEM file