(I am using MAC)
My id_rsa starts with
-----BEGIN OPENSSH PRIVATE KEY-----
but I expect it to starts with
-----BEGIN RSA PRIVATE KEY-----
I have send my id_rsa.pub to server administrator to get the access to server, so I don't want to generate a new key.
Is there any way that I can transfer my id_rsa which is a openssh private key to a RSA private key? (command please.)
If I can transfer, do I also need to transfer id_rsa.pub? (command please.) It seems id_rsa.pub doesn't have a header like id_rsa, so I am not sure if I should also transfer this.
Thank you!
install putty: sudo apt install putty. install puttygen: sudo apt install putty-tools. convert the private key to the intermediate format SSHv2: puttygen yourkey -O private-sshcom -o newkey. convert it back to RSA/PEM: ssh-keygen -i -f newkey > newkey_in_right_format.
RSA key is a private key based on RSA algorithm. Private Key is used for authentication and a symmetric key exchange during establishment of an SSL/TLS session. It is a part of the public key infrastructure that is generally used in case of SSL certificates.
So, the OpenSSH private key format ultimately contains a private key encrypted with a non-standard version of PBKDF2 that uses bcrypt as its core hash function. The structure that contains the key is not ASN. 1, even though it's base64 encoded and wrapped between header and footer that are similar to the PEM ones.
You have an OpenSSH format key and want a PEM format key. It is not intuitive to me, but the suggested way to convert is by changing the password for the key and writing it in a different format at the same time.
The command looks like this:
ssh-keygen -p -N "" -m pem -f /path/to/key
It will change the file in place, so make a backup of your current key just in case. -N ""
will set the passphrase as none. I haven't tested this with a passphrase.
The public key should be fine as is.
For full explanation of the above command, see the -m
option here: https://man.openbsd.org/ssh-keygen#m
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With