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

pkcs7: pkcs7签名是否可以支持外部计算hash #294

Closed
zhangyongding opened this issue Jan 13, 2025 · 7 comments
Closed

pkcs7: pkcs7签名是否可以支持外部计算hash #294

zhangyongding opened this issue Jan 13, 2025 · 7 comments
Labels
enhancement New feature or request

Comments

@zhangyongding
Copy link

No description provided.

@emmansun
Copy link
Owner

请提供更多信息:

  • 应用场景是什么?要解决什么问题?
  • 是否只针对国密SM2签名?
  • 是否只针对SignWithoutAttr?如果是Sign With Attributes,那么涉及到两次hash。

@zhangyongding
Copy link
Author

  • 应用场景是什么?要解决什么问题?
    在做pdf或ofd文件分散式签名时,前端已经完成了hash运算
  • 是否只针对国密SM2签名?
    国际和国密都涉及
  • 是否只针对SignWithoutAttr?如果是Sign With Attributes,那么涉及到两次hash
    SignWithoutAttr和SignWithAttributes都涉及,Sign With Attributes需要后端保留第二次hash运算

@zhangyongding
Copy link
Author

提交了一个PR:#295
看是否可行?

@emmansun
Copy link
Owner

  • 应用场景是什么?要解决什么问题?
    在做pdf或ofd文件分散式签名时,前端已经完成了hash运算
  • 是否只针对国密SM2签名?
    国际和国密都涉及
  • 是否只针对SignWithoutAttr?如果是Sign With Attributes,那么涉及到两次hash
    SignWithoutAttr和SignWithAttributes都涉及,Sign With Attributes需要后端保留第二次hash运算

这个使用起来可能还是比较底层的,特别是使用国密的SignWithoutAttr,前端需要知道如何使用公钥计算SM2WithSM3哈希值。

@zhangyongding
Copy link
Author

在《GMT 0131-2023 电子签章应用接口规范》文档中,定义的接口就是需要外部计算hash

@emmansun
Copy link
Owner

为了避免误解,所有直接传入哈希值的签名操作都是Detached,验证时需要自己传入哈希值。

@emmansun emmansun added the enhancement New feature or request label Jan 14, 2025
emmansun added a commit that referenced this issue Jan 15, 2025
@emmansun
Copy link
Owner

v0.29.7

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

No branches or pull requests

2 participants