Docs/linux基础/openssl生成公私钥转换成ssh-keygen格式.txt
2022-10-18 16:59:37 +08:00

14 lines
514 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1、使用openssl genrsa工具产生公钥
首先产生私钥,使用如下命令(因为默认的是2048位因此这里没有传入key len)openssl genrsa -out private.pem
2、根据私钥产生对应的公钥。
使用如下命令openssl rsa -pubout -in private.pem -out tmp.pem
3、使用ssh-keygen将公钥转换成ssh格式。
使用如下命令ssh-keygen -f tmp.pem -i -mPKCS8 > public.pem
以上转换完成的priv.pem和pub.pem即为符合ssh-keygen格式的密钥对。