From d9fc9bd5c62981b384045311b729e18d9130e820 Mon Sep 17 00:00:00 2001 From: zhangyongding <59941594@qq.com> Date: Sun, 29 Sep 2024 09:54:05 +0800 Subject: [PATCH] =?UTF-8?q?PKCS7=E4=B8=AD=E5=A2=9E=E5=8A=A0RecipientInfos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkcs7/pkcs7.go | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/pkcs7/pkcs7.go b/pkcs7/pkcs7.go index c3037f4..3f21918 100644 --- a/pkcs7/pkcs7.go +++ b/pkcs7/pkcs7.go @@ -22,33 +22,18 @@ import ( // PKCS7 Represents a PKCS7 structure type PKCS7 struct { - Content []byte - Certificates []*smx509.Certificate - CRLs []pkix.CertificateList - Signers []signerInfo - raw any + Content []byte + Certificates []*smx509.Certificate + CRLs []pkix.CertificateList + Signers []signerInfo + RecipientInfos []recipientInfo + raw any } func (p7 *PKCS7) Raw() any { return p7.raw } -func (p7 *PKCS7) EnvelopedData() *envelopedData { - ed, ok := p7.raw.(envelopedData) - if ok { - return &ed - } - return nil -} - -func (p7 *PKCS7) EncryptedData() *encryptedData { - ed, ok := p7.raw.(encryptedData) - if ok { - return &ed - } - return nil -} - type contentInfo struct { ContentType asn1.ObjectIdentifier Content asn1.RawValue `asn1:"explicit,optional,tag:0"` @@ -254,7 +239,8 @@ func parseEnvelopedData(data []byte) (*PKCS7, error) { return nil, err } return &PKCS7{ - raw: ed, + raw: ed, + RecipientInfos: ed.RecipientInfos, }, nil }