1.生成RSA私钥:

  genrsa -out demo.txt 1024                                                                                                                                    生成1024位的私钥 如下图:                                                                                      使用openssl生成公钥与私钥

2.将私钥转换成PKCS8格式:                                                                                                                                      pkcs8 -topk8 -inform PEM -in demo.txt  -outform PEM –nocrypt                                                                           PKCS8格式的私钥如下图                                                                                                                                  

使用openssl生成公钥与私钥

3.生成RSA公钥:

rsa -in demo.txt  -pubout -out demo1.txt                                  生成成功如下图

使用openssl生成公钥与私钥

此时我们可以打开demo1.txt文件,可以看到-----BEGIN PUBLIC KEY-----开头,
-----END PUBLIC KEY-----结尾的没有换行的字符串,这就是公钥。

转载于:https://blog.51cto.com/12156221/1862649

相关文章:

  • 2021-04-22
  • 2022-12-23
  • 2022-01-11
  • 2021-11-23
  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2021-08-27
相关资源
相似解决方案