Skip to content

Instantly share code, notes, and snippets.

@bfgits
Created February 26, 2020 07:12
Show Gist options
  • Save bfgits/6adb776dd3f0260ccadbc607d9ee0b23 to your computer and use it in GitHub Desktop.
Save bfgits/6adb776dd3f0260ccadbc607d9ee0b23 to your computer and use it in GitHub Desktop.
openssh private key to rsa private key
#https://stackoverflow.com/questions/54994641/openssh-private-key-to-rsa-private-key
#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 the full explanation of the above command, see the -m option here: https://man.openbsd.org/ssh-keygen
解密aws windows ec2密码的时候会报以下错误。
#Private key must begin with "-----BEGIN RSA PRIVATE KEY-----" and end with "-----END RSA PRIVATE KEY-----"
只需要将"OPENSSH 格式的PRIVATE KEY用命令转换成RSA格式
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment