将Openssh私钥转换为RSA私钥 [英] Openssh Private Key to RSA Private Key

查看:2196
本文介绍了将Openssh私钥转换为RSA私钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我正在使用MAC)

我的id_rsa开头

-----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.

  1. 有什么方法可以将我的id_rsa(这是一个openssh私钥)转移到RSA私钥? (请命令.)

  1. 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. The command looks like this:

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 the full explanation of the above command, see the -m option here: https://man.openbsd.org/ssh-keygen#m

这篇关于将Openssh私钥转换为RSA私钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆