且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用RSA私钥生成公钥?

更新时间:2022-03-25 23:13:07

openssl genrsa -out mykey.pem 1024

实际上将产生一个公钥-私钥对.该对存储在生成的mykey.pem文件中.

will actually produce a public - private key pair. The pair is stored in the generated mykey.pem file.

openssl rsa -in mykey.pem -pubout > mykey.pub

将提取公共密钥并打印出来. 此处是指向页面的链接,该链接对此进行了更好的描述.

will extract the public key and print that out. Here is a link to a page that describes this better.

此处中查看示例部分.要仅输出私钥的公共部分:

Check the examples section here. To just output the public part of a private key:

openssl rsa -in key.pem -pubout -out pubkey.pem

要获取用于SSH的可用公共密钥,请使用 ssh-keygen :

To get a usable public key for SSH purposes, use ssh-keygen:

ssh-keygen -y -f key.pem > key.pub