Openssh 私钥转 RSA 私钥
(我使用的是 MAC)
(I am using MAC)
我的 id_rsa 以
My id_rsa starts with
-----BEGIN OPENSSH PRIVATE KEY-----
但我希望它以
-----BEGIN RSA PRIVATE KEY-----
我已将我的 id_rsa.pub 发送给服务器管理员以获取对服务器的访问权限,因此我不想生成新密钥.
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.
有什么方法可以将我的 id_rsa(即 openssh 私钥)转移到 RSA 私钥?(请命令.)
Is there any way that I can transfer my id_rsa which is a openssh private key to a RSA private key? (command please.)
如果可以转让,是否还需要转让id_rsa.pub?(请命令.)似乎 id_rsa.pub 没有像 id_rsa 这样的标题,所以我不确定我是否也应该转移它.
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.
谢谢!
您有一个 OpenSSH 格式的密钥并且想要一个 PEM 格式的密钥.这对我来说并不直观,但建议的转换方法是更改密钥的密码并同时以不同的格式写入.
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.
命令如下所示:
ssh-keygen -p -N "" -m pem -f /path/to/key
它将就地更改文件,因此请备份您当前的密钥以防万一.-N ""
会将密码设置为无.我还没有用密码测试过这个.
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.
公钥应该没问题.
有关上述命令的完整说明,请参阅此处的 -m
选项:https://man.openbsd.org/ssh-keygen#m
For full explanation of the above command, see the -m
option here: https://man.openbsd.org/ssh-keygen#m