GmSSL icon indicating copy to clipboard operation
GmSSL copied to clipboard

关于SM2加密后结果验证的咨询

Open light-years-run opened this issue 9 years ago • 10 comments

今天上午我对SM2的加密和解密指令进行了使用,并且也进行了签名认证等。windows环境下都可正常运行。 我有个问题是,怎么验证SM2的结果呢。因为没有第三方生成的加密结果。 解密也是按照指令解密。 算法中有一个随机数,每次加密的结果都不一样。我拿到的国家保密管理局的文档,里面也是他们给定的随机数。 想通过赋值随机数来验证,看了下测试程序,不好修改。 请我你有比较好的验证方法吗?

light-years-run avatar Jan 13 '17 08:01 light-years-run

test/sm2test.c中包含了对标准中测试数据的加解密测试,请阅读这个源文件的代码。

guanzhi avatar Jan 13 '17 15:01 guanzhi

厉害了

andylau004 avatar Jan 14 '17 08:01 andylau004

windows能编译过?

andylau004 avatar Jan 14 '17 08:01 andylau004

可以,不过要修改很多....

在 2017-01-14 16:49:11,"andylau004" [email protected] 写道:

windows能编译过?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

light-years-run avatar Jan 16 '17 00:01 light-years-run

有一个在线的sm2加解密网址 可以验证 不过你用例子里的解密函数解密后打印输出就可以知道结果

chunheinanzi avatar Jan 16 '17 01:01 chunheinanzi

麻烦 网址能发下吗? 我没搜到啊,谢谢!!

在 2017-01-16 09:38:20,"chunheinanzi" [email protected] 写道:

有一个在线的sm2加解密网址 可以验证 不过你用例子里的解密函数解密后打印输出就可以知道结果

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

light-years-run avatar Jan 16 '17 02:01 light-years-run

加密之后把密文再进行解密,如果结果和预期结果一致不就可以得到验证了么

disillusion028 avatar Jan 17 '17 09:01 disillusion028

这样可能由于算法和数据编码上的细微差别导致相同算法的不同实现之间无法互通。因此如果多个实现都能通过相同一组测试向量,那么在互通时就会容易得多,用户也不会绑定在某一家的产品上。

guanzhi avatar Jan 17 '17 14:01 guanzhi

为什么按照标准对sm2的实现会出现不能对通的情况?网上下载了好多sm2的检测工具,a工具生成的密文,b工具就解密失败。没有一套统一的检测标准么?

hustms avatar Mar 03 '19 07:03 hustms

Marked as stale issue. Will be closed later if no activity for a while.

github-actions[bot] avatar Oct 18 '20 01:10 github-actions[bot]