openssl 命令行工具操作 EC

- 生成EC私钥:
openssl ecparam -genkey -name SM2 -outform pem -out ec_prikey.pem

- 从私钥提取公钥:
openssl ec -in ec_prikey.pem -pubout -out ec_pubkey.pem

- 签名:
openssl dgst -sha256 -sign ec_prikey.pem -out in.sign in
签名文件为in,使用sha256做摘要后使用SM2算法签名,输出文件为in.sign

- 验签:
openssl dgst -sha256 -verify ec_pubkey.pem -signature in.sign in
原始文件为in,签名为in.sign,使用sha256做摘要后使用SM2算法验签,输出验签结果

 

posted @ 2021-06-30 15:22  hunterDing  阅读(459)  评论(0编辑  收藏  举报