
openssl命令行生成SM2证书
openssl
传输层安全性/安全套接层及其加密库
项目地址:https://gitcode.com/gh_mirrors/ope/openssl
·
根证
#获取曲线参数
openssl ecparam -list_curves
#生成SM2的密钥
openssl ecparam -genkey -name SM2 -text -out Root.key
#生成证书请求文件
openssl req -config /etc/pki/tls/openssl.cnf -key Root.key -new -out Root.req
#生成证书
openssl x509 -req -days 3650 -sm3 -in Root.req -signkey Root.key -out RootCA.crt
#查看DER证书
openssl x509 -in RootCA.crt -text -noout
openssl x509 -in /home/admin/user_data/cert/strongbox/ca.cer -inform DER -text
用户证书
#生成私钥
openssl ecparam -genkey -name SM2 -text -out Server.key
#证书请求
openssl req -new -key Server.key -subj /C=CN/CN=cmq1 -out Server.req
#签发证书
openssl x509 -req -sm3 -days 3650 -CA RootCA.crt -CAkey Root.key -CAcreateserial -in Server.req -out ServerCA.crt
#证书验证
openssl verify -CAfile RootCA.crt ServerCA.crt
#查看证书
openssl x509 -in ServerCA.crt -text -noout
通信验证
#服务端
openssl s_server -accept 443 -key Server.key -cert ServerCA.crt -dkey Server.key -dcert ServerCA.crt -CAfile RootCA.crt -msg -debug
#客户端
openssl s_client -connect 127.0.0.1:443 -key Client.key -cert ClientCA.crt -CAfile RootCA.crt -msg -debug
传输层安全性/安全套接层及其加密库
最近提交(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)