1

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?

3
  • 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? Commented 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 ? Commented 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. Commented Feb 11, 2019 at 10:59

1 Answer 1

7

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.

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.