问题描述
我将为此作序:我对证书/密钥非常缺乏经验,并且我使用的是Mac.
I will preface this that I am extremely inexperienced with certs/keys and I am using a Mac.
我的问题是使用RSA和OPENSSH证书/密钥.我目前有一个有效的RSA证书/密钥,但是我需要将它们转换为OpenSSH.根据我的理解,我想做与此线程相反的事情: Openssh私钥来RSA私钥
My problem is with RSA and OPENSSH certs/keys. I currently have a valid RSA cert/key, but I need to convert them to OpenSSH. From my understanding, I want to do the opposite of this thread: Openssh Private Key to RSA Private Key
我有一个以以下文件开头的文件:
I have a file that starts with:
-----BEGIN RSA PRIVATE KEY-----
但是我需要将其转换为此:
But I need to convert it to this:
-----BEGIN OPENSSH PRIVATE KEY-----
我已经尝试过 ssh-keygen -p -N"-m pem -f/path/to/key
和 ssh-keygen -f/path/to/key -m pem
,但不会与 OPENSSH 一起输出
我期望的标题.
I have tried ssh-keygen -p -N "" -m pem -f /path/to/key
and ssh-keygen -f /path/to/key -m pem
but it does not output with the OPENSSH
header I expected.
- 这可能吗?
- 如果可能的话,我可以用什么来执行这种转换?可能的命令是什么?
- 如果我转换了密钥,我是否需要做任何事情来转换证书?
- 如果我确实需要转换证书,那么命令是什么?
- 如果对从RSA转换为OPENSSH有什么进一步的解释,我将不胜感激.
推荐答案
只要在命令中使用 -m PEM
,结果就不会是OPENSSH格式.
As long as you are using -m PEM
in your command, the result won't be an OPENSSH format.
这会将RSA/PEM认证密钥转换为OPENSSH密钥:
This will convert an RSA/PEM provate key into an OPENSSH one:
ssh-keygen -p -N "" -f /path/to/key
然后您可以提取其公钥并确认它与以前的公钥相同:
You can then extract its public key and confirm it is identical to the one you have before:
ssh-keygen -y -f /path/to/key
这篇关于将RSA转换为OPENSSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!