Link: Convert keys between GnuPG, OpenSsh and OpenSSL
23 Oct 2015From Convert keys between GnuPG, OpenSsh and OpenSSL:
OpenSSL to OpenSSH
Private keys format is same between OpenSSL and OpenSSH. So you just a have to rename your OpenSSL key:
cp myid.key id_rsa
In OpenSSL, there is no specific file for public key (public keys are generally embeded in certificates). However, you extract public key from private key file:
ssh-keygen -y -f myid.key > id_rsa.pub
[Update] Also converting from OpenSSH private key to .pem in X.509 format, which is a format required by Microsoft Azure VMs:
openssl req -x509 -key ~/.ssh/id_rsa -nodes -days 365 -newkey rsa:2048 -out myCert.pem