Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SM4 获取到的 key 为 33 位,该如何处理后使用? #78

Closed
a77uu opened this issue Nov 10, 2022 · 2 comments
Closed

SM4 获取到的 key 为 33 位,该如何处理后使用? #78

a77uu opened this issue Nov 10, 2022 · 2 comments

Comments

@a77uu
Copy link

a77uu commented Nov 10, 2022

密文、key 以及 iv 于在线工具中可正常解密。在线工具设置如下:

image

该如何在这个库中实现?因为 key 标准来讲是 32 位;

@a77uu
Copy link
Author

a77uu commented Nov 10, 2022

密文:
2ZFJ12Ju+3AKiZnyZJLS175M4Mnv2tVTptDPdkf5LaP1MwriSP5pnlD81jt+d86fXOfigq2HPMeNnDERX8V7iIX6tVRSaD0MqS0aTaMNo3UNy08xY0kiSXqeuckwAgg+GOzG0QdBWHZLaEvk5gWR5iIuVXc9aK1b6QhQGP+4WMrjKhApY1gSBKsMg9UPlU/EQ7izyY7m9UANwUb0PHDDTXK357ujnuZrhA17MUSXhwg=

Key:
111101525715018487214501319884958

IV:
1111015219884958

Result:
{"code":1, "message":"成功", "data":{ "srvrt": { "timeStamp": "1668066248909", "resultCode": "0300", "resultMessage": "文件ID(fileId)不能为空" } }}

@JuneAndGreen
Copy link
Owner

https://github.com/JuneAndGreen/sm-crypto/blob/master/docs/SM4%E5%88%86%E7%BB%84%E5%AF%86%E7%A0%81%E7%AE%97%E6%B3%95.pdf

此库只按标准文档实现,要求输入密钥为 128 比特,但是密钥本身不是由此库生成,你按自己业务的需求将其调整到 128 比特即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants