16

I've converted an rsa key to pem using the following command

openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem

However when I try uploading this key to my ubuntu server hosted on Azure I get an error

The certificate is in an invalid format. X.509 standard format in a .cer or .pem file is supported.

What is the correct way of converting an rsa key to pem format?

chicks
  • 574
chris
  • 347

1 Answers1

16

From the Azure site itself:

openssl req -x509 -key ~/.ssh/id_rsa -nodes -days 365 -newkey rsa:2048 -out id_rsa.pem

This will convert your private key into a public key that can be used with Azure.