生成非对称加密算法RSA公钥、私钥的方法:

1. 通过OpenSSL库生成,可参考  https://github.com/fengbingchun/OpenSSL_Test/blob/master/demo/OpenSSL_Test/funset.cpp  中的Generate_RSA_Key函数;

2. 在Linux下通过命令生成,执行: 

ssh-keygen -t rsa

3. 通过网页  http://web.chacuo.net/netrsakeypair 中的RSA密钥对按钮

通过已有的公钥和私钥提取模数和指数的方法:

1. Linux下可直接通过命令,公钥提取执行:

openssl rsa -pubin -inform PEM -text < pub.key

私钥提取执行:

openssl rsa -inform PEM -text < pri.key

结果如下图:注意:模数需要去除Modulus下的第一个字节即00,公钥和私钥提取的模数和指数都是相同的,只是私钥会有额外的信息输出。

2. 通过网页http://web.chacuo.net/netrsakeypair 中的Rsa公私钥解析按钮,结果如下图,与Linux结果一致:

GitHub: https://github.com/fengbingchun/OpenSSL_Test 

GitHub 加速计划 / li / linux-dash
6
1
下载
A beautiful web dashboard for Linux
最近提交(Master分支:4 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐