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中增加RecipientInfos #252

Closed
zhangyongding opened this issue Sep 27, 2024 · 5 comments
Closed

PKCS7中增加RecipientInfos #252

zhangyongding opened this issue Sep 27, 2024 · 5 comments

Comments

@zhangyongding
Copy link

以便于访问私有变量和私有结构体

新增一个PR: #251

@emmansun
Copy link
Owner

emmansun commented Sep 27, 2024

请问,你这个使用场景是什么?raw本来就是私有,中间处理用的,不暴露给外部。

@zhangyongding
Copy link
Author

场景:
A:执行数字信封加密,需要携带RecipientInfos信息给B
B:收到数字信封,执行Parse(),从p7数字信封中读取RecipientInfos的信息,根据RecipientInfos获取证书,然后再解密

在这个场景中,B事先不知道A采用B的哪个证书进行加密,所有需要先读取RecipientInfos才能再解密

@emmansun
Copy link
Owner

正常场景下,A和B事先要约定(达成共识):

  1. B分享自己的公钥给A,要求A使用该证书生成数字信封;
  2. A使用该证书执行数字信封加密;

如果反过来,A要发数字信封给B,却没有事先和B达成共识,不清楚怎么会有这种场景。

如果真有需要,可能增加一个获取接收者(Issuer & SerialNumber)数组的API更合适。

@zhangyongding
Copy link
Author

B有可能分享了多个版本的公钥证书给A,比如在证书的更换过程中,这个时候B就可能不知道A使用的是哪个证书了

增加一个获取接收者(Issuer & SerialNumber)数组的API也是可以的

@zhangyongding zhangyongding changed the title PKCS7添加获取EnvelopedData和EncryptedData的方法 PKCS7中增加RecipientInfos Sep 29, 2024
@zhangyongding
Copy link
Author

重新修改了PR,看这样是否合理

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