用gmssl命令生成sm2证书

1、生成SM2私钥及证书请求
gmssl ecparam -genkey -name sm2p256v1 -text -out user.key
gmssl req -new -key user.key -out user.req
2、用私钥对csr进行自签名
gmssl x509 -req -days 3650 -sm3 -in user.req -signkey user.key -out user.crt
3、把crt转cer
gmssl x509 -inform pem -in user.crt -outform der -out user.cer
4、查看证书内容:
pet\crt格式(begin..end格式base64):
gmssl x509 -in user.crt -text -noout
der\cer(hex)格式:
gmssl x509 -in user.cer -inform der -text -noout
参考:
http://gmssl.org/docs/quickstart.html
http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=29199121&id=4424058
http://www.cnblogs.com/StephenWu/p/6791714.html
http://www.cnblogs.com/guogangj/p/4118605.html


猜你喜欢

转载自blog.csdn.net/hxl5955/article/details/78003506
sm2