用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、查看证书内容:
<span style="color:#567482">pet\crt格式(begin..end格式base64):</span>
<span style="color:#567482">gmssl x509 -in user.crt -text -noout</span>
 
der\cer(hex)格式:

gmssl x509 -in user.cer -inform der -text -noout

<span style="background-color:#f4f4f4">参考:</span>
<span style="background-color:#f4f4f4">http://gmssl.org/docs/quickstart.html
</span>
<span style="background-color:#f4f4f4"><a data-cke-saved-href="http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=29199121&id=4424058" href="http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=29199121&id=4424058">http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=29199121&id=4424058</a>
</span>
<span style="background-color:#f4f4f4">http://www.cnblogs.com/StephenWu/p/6791714.html
</span>
<a data-cke-saved-href="http://www.cnblogs.com/guogangj/p/4118605.html" href="http://www.cnblogs.com/guogangj/p/4118605.html">http://www.cnblogs.com/guogangj/p/4118605.html</a>

<span style="background-color:#f4f4f4">
</span>

发现两篇好文:

1、sm2加解密demo,c语言实现;

https://www.cnblogs.com/bigben0123/p/12852501.html

2、sm2加解密注意事项,如公钥前添加0x04,sm2加密后密文顺序等,新版本是C1|C3|C2

https://blog.csdn.net/yinianjian2017/article/details/79896903

  • 5
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值