mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-28 05:06:18 +08:00
PKCS7中增加RecipientInfos
This commit is contained in:
parent
dca2b5a187
commit
d9fc9bd5c6
@ -22,33 +22,18 @@ import (
|
|||||||
|
|
||||||
// PKCS7 Represents a PKCS7 structure
|
// PKCS7 Represents a PKCS7 structure
|
||||||
type PKCS7 struct {
|
type PKCS7 struct {
|
||||||
Content []byte
|
Content []byte
|
||||||
Certificates []*smx509.Certificate
|
Certificates []*smx509.Certificate
|
||||||
CRLs []pkix.CertificateList
|
CRLs []pkix.CertificateList
|
||||||
Signers []signerInfo
|
Signers []signerInfo
|
||||||
raw any
|
RecipientInfos []recipientInfo
|
||||||
|
raw any
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p7 *PKCS7) Raw() any {
|
func (p7 *PKCS7) Raw() any {
|
||||||
return p7.raw
|
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 {
|
type contentInfo struct {
|
||||||
ContentType asn1.ObjectIdentifier
|
ContentType asn1.ObjectIdentifier
|
||||||
Content asn1.RawValue `asn1:"explicit,optional,tag:0"`
|
Content asn1.RawValue `asn1:"explicit,optional,tag:0"`
|
||||||
@ -254,7 +239,8 @@ func parseEnvelopedData(data []byte) (*PKCS7, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &PKCS7{
|
return &PKCS7{
|
||||||
raw: ed,
|
raw: ed,
|
||||||
|
RecipientInfos: ed.RecipientInfos,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user