参考链接:https://zhuanlan.zhihu.com/p/618494579
SM3计算摘要:echo -n hello | gmssl dgst -sm3 SM3计算HMAC:echo -n hello | gmssl dgst -sm3 -hmac 11223344556677881122334455667788SM4对输入字符加密:echo hello | gmssl enc -sms4-cbc > ciphertext.bin SM4对加密文件解密:cat cipehrtext.bin | gmssl enc -sms4-cbc -d SM4对文件加解密(cbc):Gmssl sms4-cbc -K 11223344556677881122334455667788 -iv 11223344556677881122334455667788 -in test.txt -out testcbc.txt -eSM2生成私钥:gmssl sm2 -genkey -sms4 -out sm2.pem 导出SM2公钥:gmssl sm2 -in sm2.pem -pubout -out sm2Pub.pemSM2签名:gmssl sm2utl -sign -in msg.txt -inkey sm2.pem -id zongpengxin -out sig.der SM2验签:gmssl sm2utl -verify -in msg.txt -sigfile sig.der -pubin -in sm2Pub.pem -id AliceSM2加密:gmssl sm2utl -encrypt -in msg.txt -pubin -inkey sm2Pub.pem -out enced.der SM2解密:gmssl sm2utl -decrypt -in enced.der -inkey sm2.pem