Reading a RSA private key from a pem file.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Huseyin_Davut
Posted On:   Sunday, July 27, 2003 06:04 AM


Hello,


I have a PEM file looking like this:



-----BEGIN RSA PRIVATE KEY----- BQADggEPADCCAQoCggEBAJbETsgA/pwY dGDtUK+Gyx4IGNEFfVrVz1nCfPq5fD5h XRpZW50SWRlbWl4U2VydmVyMQyx4IGNEF
-----END RSA PRIVATE KEY-----




I would like to create java.security.PrivateKey from file containing RSA private key?


Any suggestions?

Many Thanks,
Davut

Re: Reading a RSA private key from a pem file.

Posted By:   Eugene_Kuleshov  
Posted On:   Sunday, July 27, 2003 08:38 PM

Try this. Strip headers, apply Base64 decoder, then use PKCS8EncodedKeySpec with that key material as a parameter of KeyFactory for RSA algorithm to generate private key instance.
About | Sitemap | Contact