Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading pem format private keys

 
srini Raman
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems I can use Bouncycastle apis for the purpose.It has PEMReader,PEMWriter classes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic