SM3 是国密摘要算法

openssl 中使用方法如下

$echo "httpfsfgsfgfgsgsfs" > test.dat 
$openssl dgst -SM3 test.dat 
$SM3(test.dat)= ebf5e0f6e101a9320fab11365fb23f69a5c65968302635a7bdf2a0392f5463a5

gmssl 中使用方法如下

$ gmssl sm3 <yourfile>
SM3(yourfile)= 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0
#将sm3 保存成文件
$ gmssl sm3 -binary -out filesm3 <yourfile>

SM4 是分组对称加密算法

openssl 中使用方法如下

$openssl sm4 -in test.dat -out encrypt.txt
enter sm4-cbc encryption password:******
Verifying - enter sm4-cbc encryption password:*****

$openssl sm4 -d -in encrypt.txt -out plain.txt
enter sms4-cbc decryption password:********

gmssl 中使用方法如下

$ echo hello | gmssl enc -sms4-cbc > ciphertext.bin
enter sms4-cbc encryption password:********
Verifying - enter sms4-cbc encryption password:********

$ cat cipehrtext.bin | gmssl enc -sms4-cbc -d
enter sms4-cbc decryption password:********
hello
GitHub 加速计划 / ope / openssl
20
1
下载
传输层安全性/安全套接层及其加密库
最近提交(Master分支:3 个月前 )
b049ce0e Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26359) 7 天前
75416c09 Once lcov is updated to 2.2 version or later, it could be dropped. Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/26381) 7 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐