So I've seen many many posts on how to do the conversion with private key; but does anyone one know how I can do this with just only public key? As I'm trying to convert someone else's public key.

Or is this something not possible and I need to ask them to generate one themselves?

  • 1
    PEM format can wrap up a few different things. Could you clarify. Are you trying to create a certificate (x509) or are you just trying to convert the public key format? Feb 11, 2019 at 10:43
  • are you trying to get a private key from a public key ? assymetric key were meant to make this impossible. Could you give more details ?
    – Archemar
    Feb 11, 2019 at 10:45
  • @PhilipCouling Sorry, I should've added what I was trying to do. It is for encrypting files to share. Feb 11, 2019 at 10:59

1 Answer 1


If you are just looking to convert a public key, not create a certificate then you only need the public key.

ssh-keygen -f id_rsa.pub -e -m pem > id_rsa.pub.pem

Will read a public key file id_rsa.pub (containing just your friend's public key) and convert it to pem format.

The private key would be needed for something like a self signed certificate (in x509 format) because it's the private key that generates the signature.

  • Thank you; this is what I was looking for. Feb 11, 2019 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.