From dca2b5a1871274e216645180e108d9df99b35220 Mon Sep 17 00:00:00 2001 From: zhangyongding <59941594@qq.com> Date: Fri, 27 Sep 2024 13:11:30 +0800 Subject: [PATCH] =?UTF-8?q?PKCS7=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96Envelo?= =?UTF-8?q?pedData=E5=92=8CEncryptedData=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkcs7/pkcs7.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkcs7/pkcs7.go b/pkcs7/pkcs7.go index 3e820b9..c3037f4 100644 --- a/pkcs7/pkcs7.go +++ b/pkcs7/pkcs7.go @@ -29,6 +29,26 @@ type PKCS7 struct { 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"`