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.Sm4Cbc解密数据块长度不足的情况下,err和buf都为nil #173

Open
orca-zhang opened this issue Aug 31, 2022 · 1 comment
Open

Comments

@orca-zhang
Copy link

加密前数据是85860,加密后85872,解密时因为bug导致传递的数据大小为85860,但是返回err也为nil,buf也为空

@emmansun
Copy link

不建议你直接使用sm4.Sm4Cbc方法,这个方法

  • 没对输入数据进行长度校验
  • 吃掉了padding处理的error

你可以自己直接用Go语言的CBC模式,至于pkcs7 padding,你可以参考本库实现,也可以引用其它库。

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