Debian Codegraph @

pkcs7.go

raw symbols SCIP
1 // Package pkcs7 implements parsing and generation of some PKCS#7 structures.
2 package pkcs7scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/
3
4 import (
5 "bytesscip-go gomod github.com/golang/go/src go1.14 bytes/"
6 "cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/"
7 "crypto/dsascip-go gomod github.com/golang/go/src go1.14 `crypto/dsa`/"
8 "crypto/ecdsascip-go gomod github.com/golang/go/src go1.14 `crypto/ecdsa`/"
9 "crypto/rsascip-go gomod github.com/golang/go/src go1.14 `crypto/rsa`/"
10 "crypto/x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/"
11 "crypto/x509/pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/"
12 "encoding/asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/"
13 "errorsscip-go gomod github.com/golang/go/src go1.14 errors/"
14 "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/"
15 "ioscip-go gomod github.com/golang/go/src go1.14 io/"
16 "sortscip-go gomod github.com/golang/go/src go1.14 sort/"
17 "syncscip-go gomod github.com/golang/go/src go1.14 sync/"
18
19 _ "crypto/sha1scip-go gomod github.com/golang/go/src go1.14 `crypto/sha1`/" // for crypto.SHA1
20
21 legacyx509scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ "github.com/smallstep/pkcs7/internal/legacy/x509scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/"
22 )
23
24 // PKCS7 Represents a PKCS7 structure
25 type PKCS7scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7# struct {
26 Contentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#Content. []byte
27 Certificatesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#Certificates. []*x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.Certificatescip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/Certificate#
28 CRLsscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#CRLs. []pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/.CertificateListscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/CertificateList#
29 Signersscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#Signers. []signerInfoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/signerInfo#
30 Hasherscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#Hasher. Hasherscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/Hasher#
31 rawscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#raw. interface{}
32 }
33
34 // Hasher is an interface defining a custom hash calculator.
35 type Hasherscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/Hasher# interface {
36 Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/Hasher#Hash.(cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.Hashscip-go gomod github.com/golang/go/src go1.14 crypto/Hash#, ioscip-go gomod github.com/golang/go/src go1.14 io/.Readerscip-go gomod github.com/golang/go/src go1.14 io/Reader#) ([]byte, error)
37 }
38
39 type contentInfoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo# struct {
40 ContentTypescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#ContentType. asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#
41 Contentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#Content. asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.RawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue# `asn1:"explicit,optional,tag:0"`
42 }
43
44 // ErrUnsupportedContentType is returned when a PKCS7 content type is not supported.
45 // Currently only Data (1.2.840.113549.1.7.1), Signed Data (1.2.840.113549.1.7.2),
46 // and Enveloped Data are supported (1.2.840.113549.1.7.3)
47 var ErrUnsupportedContentTypescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/ErrUnsupportedContentType. = errorsscip-go gomod github.com/golang/go/src go1.14 errors/.Newscip-go gomod github.com/golang/go/src go1.14 errors/New().("pkcs7: cannot parse data: unimplemented content type")
48
49 type unsignedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/unsignedData# []byte
50
51 var (
52 // Signed Data OIDs
53 OIDDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDData. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 7, 1}
54 OIDSignedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDSignedData. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 7, 2}
55 OIDEnvelopedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEnvelopedData. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 7, 3}
56 OIDEncryptedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptedData. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 7, 6}
57 OIDAttributeContentTypescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDAttributeContentType. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 9, 3}
58 OIDAttributeMessageDigestscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDAttributeMessageDigest. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 9, 4}
59 OIDAttributeSigningTimescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDAttributeSigningTime. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 9, 5}
60
61 // Digest Algorithms
62 OIDDigestAlgorithmSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA1. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 3, 14, 3, 2, 26}
63 OIDDigestAlgorithmSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA256. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 2, 1}
64 OIDDigestAlgorithmSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA384. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 2, 2}
65 OIDDigestAlgorithmSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA512. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 2, 3}
66 OIDDigestAlgorithmSHA224scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA224. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 2, 4}
67
68 OIDDigestAlgorithmDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmDSA. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 10040, 4, 1}
69 OIDDigestAlgorithmDSASHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmDSASHA1. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 10040, 4, 3}
70
71 OIDDigestAlgorithmECDSASHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA1. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 10045, 4, 1}
72 OIDDigestAlgorithmECDSASHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA256. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 10045, 4, 3, 2}
73 OIDDigestAlgorithmECDSASHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA384. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 10045, 4, 3, 3}
74 OIDDigestAlgorithmECDSASHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA512. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 10045, 4, 3, 4}
75
76 // Signature Algorithms
77 OIDEncryptionAlgorithmRSAMD5scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSAMD5. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 4} // see https://www.rfc-editor.org/rfc/rfc8017#appendix-A.2.4
78 OIDEncryptionAlgorithmRSASHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA1. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 5} // ditto
79 OIDEncryptionAlgorithmRSASHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA256. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 11} // ditto
80 OIDEncryptionAlgorithmRSASHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA384. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 12} // ditto
81 OIDEncryptionAlgorithmRSASHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA512. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 13} // ditto
82 OIDEncryptionAlgorithmRSASHA224scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA224. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 14} // ditto
83
84 OIDEncryptionAlgorithmECDSAP256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmECDSAP256. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 10045, 3, 1, 7}
85 OIDEncryptionAlgorithmECDSAP384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmECDSAP384. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 3, 132, 0, 34}
86 OIDEncryptionAlgorithmECDSAP521scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmECDSAP521. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 3, 132, 0, 35}
87
88 // Asymmetric Encryption Algorithms
89 OIDEncryptionAlgorithmRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSA. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 1} // see https://www.rfc-editor.org/rfc/rfc8017#appendix-A.2.2
90 OIDEncryptionAlgorithmRSAESOAEPscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSAESOAEP. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 1, 1, 7} // see https://www.rfc-editor.org/rfc/rfc8017#appendix-A.2.1
91
92 // Symmetric Encryption Algorithms
93 OIDEncryptionAlgorithmDESCBCscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmDESCBC. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 3, 14, 3, 2, 7} // see https://www.rfc-editor.org/rfc/rfc8018.html#appendix-B.2.1
94 OIDEncryptionAlgorithmDESEDE3CBCscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmDESEDE3CBC. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{1, 2, 840, 113549, 3, 7} // see https://www.rfc-editor.org/rfc/rfc8018.html#appendix-B.2.2
95 OIDEncryptionAlgorithmAES256CBCscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmAES256CBC. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 1, 42} // see https://www.rfc-editor.org/rfc/rfc3565.html#section-4.1
96 OIDEncryptionAlgorithmAES128GCMscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmAES128GCM. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 1, 6} // see https://www.rfc-editor.org/rfc/rfc5084.html#section-3.2
97 OIDEncryptionAlgorithmAES128CBCscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmAES128CBC. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 1, 2} // see https://www.rfc-editor.org/rfc/rfc8018.html#appendix-B.2.5
98 OIDEncryptionAlgorithmAES256GCMscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmAES256GCM. = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#{2, 16, 840, 1, 101, 3, 4, 1, 46} // see https://www.rfc-editor.org/rfc/rfc5084.html#section-3.2
99 )
100
101 func getHashForOIDscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/getHashForOID().(oid asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#) (cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.Hashscip-go gomod github.com/golang/go/src go1.14 crypto/Hash#, error) {
102 switch {
103 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA1.), oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmECDSASHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA1.),
104 oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmDSA.), oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmDSASHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmDSASHA1.),
105 oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDEncryptionAlgorithmRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSA.):
106 return cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA1scip-go gomod github.com/golang/go/src go1.14 crypto/SHA1., nil
107 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA256.), oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmECDSASHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA256.):
108 return cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA256scip-go gomod github.com/golang/go/src go1.14 crypto/SHA256., nil
109 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA384.), oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmECDSASHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA384.):
110 return cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA384scip-go gomod github.com/golang/go/src go1.14 crypto/SHA384., nil
111 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA512.), oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmECDSASHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA512.):
112 return cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA512scip-go gomod github.com/golang/go/src go1.14 crypto/SHA512., nil
113 }
114 return cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.Hashscip-go gomod github.com/golang/go/src go1.14 crypto/Hash#(0), ErrUnsupportedAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/ErrUnsupportedAlgorithm.
115 }
116
117 // getDigestOIDForSignatureAlgorithm takes an x509.SignatureAlgorithm
118 // and returns the corresponding OID digest algorithm
119 func getDigestOIDForSignatureAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/getDigestOIDForSignatureAlgorithm().(digestAlg x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SignatureAlgorithm#) (asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#, error) {
120 switch digestAlg {
121 case x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SHA1WithRSAscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SHA1WithRSA., x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.ECDSAWithSHA1scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/ECDSAWithSHA1.:
122 return OIDDigestAlgorithmSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA1., nil
123 case x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SHA256WithRSAscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SHA256WithRSA., x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.ECDSAWithSHA256scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/ECDSAWithSHA256.:
124 return OIDDigestAlgorithmSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA256., nil
125 case x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SHA384WithRSAscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SHA384WithRSA., x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.ECDSAWithSHA384scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/ECDSAWithSHA384.:
126 return OIDDigestAlgorithmSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA384., nil
127 case x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SHA512WithRSAscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SHA512WithRSA., x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.ECDSAWithSHA512scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/ECDSAWithSHA512.:
128 return OIDDigestAlgorithmSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA512., nil
129 }
130 return nil, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pkcs7: cannot convert hash to oid, unknown hash algorithm")
131 }
132
133 // getOIDForEncryptionAlgorithm takes the public or private key type of the signer and
134 // the OID of a digest algorithm to return the appropriate signerInfo.DigestEncryptionAlgorithm
135 func getOIDForEncryptionAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/getOIDForEncryptionAlgorithm().(pkey interface{}, OIDDigestAlg asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#) (asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#, error) {
136 switch k := pkey.(type) {
137 case *rsascip-go gomod github.com/golang/go/src go1.14 `crypto/rsa`/.PrivateKeyscip-go gomod github.com/golang/go/src go1.14 `crypto/rsa`/PrivateKey#, *rsascip-go gomod github.com/golang/go/src go1.14 `crypto/rsa`/.PublicKeyscip-go gomod github.com/golang/go/src go1.14 `crypto/rsa`/PublicKey#:
138 switch {
139 default:
140 return OIDEncryptionAlgorithmRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSA., nil
141 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDEncryptionAlgorithmRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSA.):
142 return OIDEncryptionAlgorithmRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSA., nil
143 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA1.):
144 return OIDEncryptionAlgorithmRSASHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA1., nil
145 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA256.):
146 return OIDEncryptionAlgorithmRSASHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA256., nil
147 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA384.):
148 return OIDEncryptionAlgorithmRSASHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA384., nil
149 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA512.):
150 return OIDEncryptionAlgorithmRSASHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptionAlgorithmRSASHA512., nil
151 }
152 case *ecdsascip-go gomod github.com/golang/go/src go1.14 `crypto/ecdsa`/.PrivateKeyscip-go gomod github.com/golang/go/src go1.14 `crypto/ecdsa`/PrivateKey#, *ecdsascip-go gomod github.com/golang/go/src go1.14 `crypto/ecdsa`/.PublicKeyscip-go gomod github.com/golang/go/src go1.14 `crypto/ecdsa`/PublicKey#:
153 switch {
154 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA1.):
155 return OIDDigestAlgorithmECDSASHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA1., nil
156 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA256.):
157 return OIDDigestAlgorithmECDSASHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA256., nil
158 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA384.):
159 return OIDDigestAlgorithmECDSASHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA384., nil
160 case OIDDigestAlg.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDDigestAlgorithmSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmSHA512.):
161 return OIDDigestAlgorithmECDSASHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmECDSASHA512., nil
162 }
163 case *dsascip-go gomod github.com/golang/go/src go1.14 `crypto/dsa`/.PrivateKeyscip-go gomod github.com/golang/go/src go1.14 `crypto/dsa`/PrivateKey#, *dsascip-go gomod github.com/golang/go/src go1.14 `crypto/dsa`/.PublicKeyscip-go gomod github.com/golang/go/src go1.14 `crypto/dsa`/PublicKey#:
164 return OIDDigestAlgorithmDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDDigestAlgorithmDSA., nil
165 case cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.Signerscip-go gomod github.com/golang/go/src go1.14 crypto/Signer#:
166 // This generic case is here to cover types from other packages. It
167 // was specifically added to handle the private keyRSA type in the
168 // github.com/go-piv/piv-go/piv package.
169 return getOIDForEncryptionAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/getOIDForEncryptionAlgorithm().(k.Publicscip-go gomod github.com/golang/go/src go1.14 crypto/Signer#Public().(), OIDDigestAlg)
170 }
171 return nil, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pkcs7: cannot convert encryption algorithm to oid, unknown private key type %T", pkey)
172
173 }
174
175 // Parse decodes a DER encoded PKCS7 package
176 func Parsescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/Parse().(data []byte) (p7 *PKCS7scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#, err error) {
177 if len(data) == 0 {
178 return nil, errorsscip-go gomod github.com/golang/go/src go1.14 errors/.Newscip-go gomod github.com/golang/go/src go1.14 errors/New().("pkcs7: input data is empty")
179 }
180 var info contentInfoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#
181 der, err := ber2derscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/ber2der().(data)
182 if err != nil {
183 return nil, err
184 }
185 rest, err := asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/Unmarshal().(der, &info)
186 if len(rest) > 0 {
187 err = asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.SyntaxErrorscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/SyntaxError#{Msgscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/SyntaxError#Msg.: "trailing data"}
188 return
189 }
190 if err != nil {
191 return
192 }
193
194 // fmt.Printf("--> Content Type: %s", info.ContentType)
195 switch {
196 case info.ContentTypescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#ContentType..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDSignedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDSignedData.):
197 return parseSignedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/parseSignedData().(info.Contentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#Content..Bytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#Bytes.)
198 case info.ContentTypescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#ContentType..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDEnvelopedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEnvelopedData.):
199 return parseEnvelopedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/parseEnvelopedData().(info.Contentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#Content..Bytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#Bytes.)
200 case info.ContentTypescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#ContentType..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(OIDEncryptedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/OIDEncryptedData.):
201 return parseEncryptedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/parseEncryptedData().(info.Contentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/contentInfo#Content..Bytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#Bytes.)
202 }
203 return nil, ErrUnsupportedContentTypescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/ErrUnsupportedContentType.
204 }
205
206 func parseEnvelopedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/parseEnvelopedData().(data []byte) (*PKCS7scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#, error) {
207 var ed envelopedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/envelopedData#
208 if _, err := asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/Unmarshal().(data, &ed); err != nil {
209 return nil, err
210 }
211 return &PKCS7scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#{
212 rawscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#raw.: ed,
213 }, nil
214 }
215
216 func parseEncryptedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/parseEncryptedData().(data []byte) (*PKCS7scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#, error) {
217 var ed encryptedDatascip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/encryptedData#
218 if _, err := asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/Unmarshal().(data, &ed); err != nil {
219 return nil, err
220 }
221 return &PKCS7scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#{
222 rawscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/PKCS7#raw.: ed,
223 }, nil
224 }
225
226 // SetFallbackLegacyX509CertificateParserEnabled enables parsing certificates
227 // embedded in a PKCS7 message using the logic from crypto/x509 from before
228 // Go 1.23. Go 1.23 introduced a breaking change in case a certificate contains
229 // a critical authority key identifier, which is the correct thing to do based
230 // on RFC 5280, but it breaks Windows devices performing the Simple Certificate
231 // Enrolment Protocol (SCEP), as the certificates embedded in those requests
232 // apparently have authority key identifier extensions marked critical.
233 //
234 // See https://go-review.googlesource.com/c/go/+/562341 for the change in the
235 // Go source.
236 //
237 // When [SetFallbackLegacyX509CertificateParserEnabled] is called with true, it
238 // enables parsing using the legacy crypto/x509 certificate parser. It'll first
239 // try to parse the certificates using the regular Go crypto/x509 package, but
240 // if it fails on the above case, it'll retry parsing the certificates using a
241 // copy of the crypto/x509 package based on Go 1.23, but skips checking the
242 // authority key identifier extension being critical or not.
243 func SetFallbackLegacyX509CertificateParserEnabledscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/SetFallbackLegacyX509CertificateParserEnabled().(v bool) {
244 legacyX509CertificateParserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
245 legacyX509CertificateParserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser..enabledscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser:enabled. = v
246 legacyX509CertificateParserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
247 }
248
249 var legacyX509CertificateParserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser. struct {
250 syncscip-go gomod github.com/golang/go/src go1.14 sync/.RWMutexscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#
251 enabledscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser:enabled. bool
252 }
253
254 func isLegacyX509ParserEnabledscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/isLegacyX509ParserEnabled().() bool {
255 legacyX509CertificateParserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser..RLockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RLock().()
256 defer legacyX509CertificateParserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser..RUnlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RUnlock().()
257 return legacyX509CertificateParserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser..enabledscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/legacyX509CertificateParser:enabled.
258 }
259
260 func (raw rawCertificatesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/rawCertificates#) Parsescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/rawCertificates#Parse().() ([]*x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.Certificatescip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/Certificate#, error) {
261 if len(raw.Rawscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/rawCertificates#Raw.) == 0 {
262 return nil, nil
263 }
264
265 var val asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.RawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#
266 if _, err := asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/Unmarshal().(raw.Rawscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/rawCertificates#Raw., &val); err != nil {
267 return nil, err
268 }
269
270 certificates, err := x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.ParseCertificatesscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/ParseCertificates().(val.Bytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#Bytes.)
271 if err != nil && err.Error() == "x509: authority key identifier incorrectly marked critical" {
272 if isLegacyX509ParserEnabledscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/isLegacyX509ParserEnabled().() {
273 certificates, err = legacyx509scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/.ParseCertificatesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ParseCertificates().(val.Bytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#Bytes.)
274 }
275 }
276
277 return certificates, err
278 }
279
280 func isCertMatchForIssuerAndSerialscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/isCertMatchForIssuerAndSerial().(cert *x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.Certificatescip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/Certificate#, ias issuerAndSerialscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/issuerAndSerial#) bool {
281 return cert.SerialNumberscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/Certificate#SerialNumber..Cmpscip-go gomod github.com/golang/go/src go1.14 `math/big`/Int#Cmp().(ias.SerialNumberscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/issuerAndSerial#SerialNumber.) == 0 && bytesscip-go gomod github.com/golang/go/src go1.14 bytes/.Equalscip-go gomod github.com/golang/go/src go1.14 bytes/Equal().(cert.RawIssuerscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/Certificate#RawIssuer., ias.IssuerNamescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/issuerAndSerial#IssuerName..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes.)
282 }
283
284 // Attribute represents a key value pair attribute. Value must be marshalable byte
285 // `encoding/asn1`
286 type Attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/Attribute# struct {
287 Typescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/Attribute#Type. asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#
288 Valuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/Attribute#Value. interface{}
289 }
290
291 type attributesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes# struct {
292 typesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#types. []asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#
293 valuesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#values. []interface{}
294 }
295
296 // Add adds the attribute, maintaining insertion order
297 func (attrs *attributesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#) Addscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#Add().(attrType asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.ObjectIdentifierscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#, value interface{}) {
298 attrs.typesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#types. = append(attrs.typesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#types., attrType)
299 attrs.valuesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#values. = append(attrs.valuesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#values., value)
300 }
301
302 type sortableAttributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute# struct {
303 SortKeyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#SortKey. []byte
304 Attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#Attribute. attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attribute#
305 }
306
307 type attributeSetscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet# []sortableAttributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#
308
309 func (sa attributeSetscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#) Lenscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#Len().() int {
310 return len(sa)
311 }
312
313 func (sa attributeSetscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#) Lessscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#Less().(i, j int) bool {
314 return bytesscip-go gomod github.com/golang/go/src go1.14 bytes/.Comparescip-go gomod github.com/golang/go/src go1.14 bytes/Compare().(sa[i].SortKeyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#SortKey., sa[j].SortKeyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#SortKey.) < 0
315 }
316
317 func (sa attributeSetscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#) Swapscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#Swap().(i, j int) {
318 sa[i], sa[j] = sa[j], sa[i]
319 }
320
321 func (sa attributeSetscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#) Attributesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#Attributes().() []attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attribute# {
322 attrs := make([]attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attribute#, len(sa))
323 for i, attr := range sa {
324 attrs[i] = attr.Attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#Attribute.
325 }
326 return attrs
327 }
328
329 func (attrs *attributesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#) ForMarshallingscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#ForMarshalling().() ([]attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attribute#, error) {
330 sortables := make(attributeSetscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#, len(attrs.typesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#types.))
331 for i := range sortables {
332 attrType := attrs.typesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#types.[i]
333 attrValue := attrs.valuesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributes#values.[i]
334 asn1Value, err := asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.Marshalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/Marshal().(attrValue)
335 if err != nil {
336 return nil, err
337 }
338 attr := attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attribute#{
339 Typescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attribute#Type.: attrType,
340 Valuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attribute#Value.: asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.RawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#{Tagscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#Tag.: 17, IsCompoundscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#IsCompound.: true, Bytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#Bytes.: asn1Value}, // 17 == SET tag
341 }
342 encoded, err := asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.Marshalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/Marshal().(attr)
343 if err != nil {
344 return nil, err
345 }
346 sortables[i] = sortableAttributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#{
347 SortKeyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#SortKey.: encoded,
348 Attributescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/sortableAttribute#Attribute.: attr,
349 }
350 }
351 sortscip-go gomod github.com/golang/go/src go1.14 sort/.Sortscip-go gomod github.com/golang/go/src go1.14 sort/Sort().(sortables)
352 return sortables.Attributesscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7`/attributeSet#Attributes().(), nil
353 }