sm2证书生成(openssl生成公私钥对)
openssl
传输层安全性/安全套接层及其加密库
项目地址:https://gitcode.com/gh_mirrors/ope/openssl
·
1、经查询openssl只有1.1.1这个版本支持国密算法,所以需要编译安装一个。
补充:openssl3.0中也支持国密算法
2、下载地址:https://www.openssl.org/source/openssl-1.1.1s.tar.gz
3、编译
指定安装目录,不与系统自带openssl版本使用冲突
./config shared --prefix=/appserver/SM
make depend
make
make install
4、更新动态链接库数据
echo "/appserver/SM/lib" >> /etc/ld.so.conf
5、重新加载动态链接库
ldconfig -v
6、使用方法
cd到安装目录下的bin目录,使用./openssl调用
cd /appserver/SM/bin
安装完成后,使用下列命令查看该版本的openssl是否支持SM2参数:
./openssl ecparam -list_curves | grep SM2
7、公私钥串生成方式
(1)生成私钥
./openssl ecparam -genkey -name SM2 -out sm2PriKey.pem
(2)用私钥生成公钥
./openssl ec -in sm2PriKey.pem -pubout -out sm2PubKey.pem
(3)查看私钥
./openssl ec -in sm2PriKey.pem -text
(4)私钥pkcs#1转pkcs#8
./openssl pkcs8 -topk8 -inform PEM -in sm2PriKey.pem -outform pem -nocrypt -out sm2PriKeyPkcs8.pem
传输层安全性/安全套接层及其加密库
最近提交(Master分支:3 个月前 )
b049ce0e
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26359)
6 天前
75416c09
Once lcov is updated to 2.2 version or later, it could be dropped.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/26381)
7 天前
更多推荐



所有评论(0)