国密gmssl使用及问题解决
国密gmssl工具箱安装方法
gmssl工具箱的安装在另一篇博文里写过,这里不赘述啦~
gmssl工具安装使用及问题解决
国密gmssl使用
SM4加密
[root@centos7-1 test-gmssl]# touch sm4test //创建一个测试文件
[root@centos7-1 test-gmssl]# vim sm4test
this is a sm4 test
~
~
~
~
[root@centos7-1 test-gmssl]# gmssl sms4 -e -in sm4test -out sm4test.sms4 //sm4test为输入文件名,sm4test.sms4为输出文件名
enter sms4-cbc encryption password:
Verifying - enter sms4-cbc encryption password:
[root@centos7-1 test-gmssl]# ls
sm4test sm4test.sms4 //现在已经生成了加密后的文件
[root@centos7-1 test-gmssl]# vim sm4test.sms4 //加密后的文件
Salted__ëÇ<91>ùiìØ\^Ti|<93>akÓn»^X^Bd½Á<9c>^Mo^W<84>^_ð<8a>^RÇÌ<96><8e>*}ÃTZ
~
~
SM4解密
[root@centos7-1 test-gmssl]# gmssl sms4 -d -in sm4test.sms4
enter sms4-cbc decryption password:
this is a sm4 test //输入密码后可以看到已经解密还