Debian Codegraph @

internal/legacy/x509/x509.go

raw symbols SCIP
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package x509 implements a subset of the X.509 standard.
6 //
7 // It allows parsing and generating certificates, certificate signing
8 // requests, certificate revocation lists, and encoded public and private keys.
9 // It provides a certificate verifier, complete with a chain builder.
10 //
11 // The package targets the X.509 technical profile defined by the IETF (RFC
12 // 2459/3280/5280), and as further restricted by the CA/Browser Forum Baseline
13 // Requirements. There is minimal support for features outside of these
14 // profiles, as the primary goal of the package is to provide compatibility
15 // with the publicly trusted TLS certificate ecosystem and its policies and
16 // constraints.
17 //
18 // On macOS and Windows, certificate verification is handled by system APIs, but
19 // the package aims to apply consistent validation rules across operating
20 // systems.
21 package legacyx509scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/
22
23 import (
24 "bytesscip-go gomod github.com/golang/go/src go1.14 bytes/"
25 "cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/"
26 "crypto/ellipticscip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/"
27 stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/ "crypto/x509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/"
28 "crypto/x509/pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/"
29 "encoding/asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/"
30 "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/"
31 "strconvscip-go gomod github.com/golang/go/src go1.14 strconv/"
32 "unicodescip-go gomod github.com/golang/go/src go1.14 unicode/"
33
34 // Explicitly import these for their crypto.RegisterHash init side-effects.
35 // Keep these as blank imports, even if they're imported above.
36 _ "crypto/sha1scip-go gomod github.com/golang/go/src go1.14 `crypto/sha1`/"
37 _ "crypto/sha256scip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/"
38 _ "crypto/sha512scip-go gomod github.com/golang/go/src go1.14 `crypto/sha512`/"
39 )
40
41 type publicKeyInfoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/publicKeyInfo# struct {
42 Rawscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/publicKeyInfo#Raw. asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.RawContentscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawContent#
43 Algorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/publicKeyInfo#Algorithm. pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/.AlgorithmIdentifierscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#
44 PublicKeyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/publicKeyInfo#PublicKey. asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.BitStringscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/BitString#
45 }
46
47 type SignatureAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SignatureAlgorithm# int
48
49 const (
50 UnknownSignatureAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/UnknownSignatureAlgorithm. SignatureAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SignatureAlgorithm# = iota
51
52 MD2WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/MD2WithRSA. // Unsupported.
53 MD5WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/MD5WithRSA. // Only supported for signing, not verification.
54 SHA1WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA1WithRSA. // Only supported for signing, and verification of CRLs, CSRs, and OCSP responses.
55 SHA256WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA256WithRSA.
56 SHA384WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA384WithRSA.
57 SHA512WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA512WithRSA.
58 DSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSAWithSHA1. // Unsupported.
59 DSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSAWithSHA256. // Unsupported.
60 ECDSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA1. // Only supported for signing, and verification of CRLs, CSRs, and OCSP responses.
61 ECDSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA256.
62 ECDSAWithSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA384.
63 ECDSAWithSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA512.
64 SHA256WithRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA256WithRSAPSS.
65 SHA384WithRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA384WithRSAPSS.
66 SHA512WithRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA512WithRSAPSS.
67 PureEd25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/PureEd25519.
68 )
69
70 func (algo SignatureAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SignatureAlgorithm#) Stringscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SignatureAlgorithm#String().() string {
71 for _, details := range signatureAlgorithmDetailsscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails. {
72 if details.algoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:algo. == algo {
73 return details.namescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:name.
74 }
75 }
76 return strconvscip-go gomod github.com/golang/go/src go1.14 strconv/.Itoascip-go gomod github.com/golang/go/src go1.14 strconv/Itoa().(int(algo))
77 }
78
79 type PublicKeyAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/PublicKeyAlgorithm# int
80
81 const (
82 UnknownPublicKeyAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/UnknownPublicKeyAlgorithm. PublicKeyAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/PublicKeyAlgorithm# = iota
83 RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA.
84 DSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSA. // Only supported for parsing.
85 ECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSA.
86 Ed25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/Ed25519.
87 )
88
89 var publicKeyAlgoNamescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/publicKeyAlgoName. = [...]string{
90 RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA.: "RSA",
91 DSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSA.: "DSA",
92 ECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSA.: "ECDSA",
93 Ed25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/Ed25519.: "Ed25519",
94 }
95
96 func (algo PublicKeyAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/PublicKeyAlgorithm#) Stringscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/PublicKeyAlgorithm#String().() string {
97 if 0 < algo && int(algo) < len(publicKeyAlgoNamescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/publicKeyAlgoName.) {
98 return publicKeyAlgoNamescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/publicKeyAlgoName.[algo]
99 }
100 return strconvscip-go gomod github.com/golang/go/src go1.14 strconv/.Itoascip-go gomod github.com/golang/go/src go1.14 strconv/Itoa().(int(algo))
101 }
102
103 // OIDs for signature algorithms
104 //
105 // pkcs-1 OBJECT IDENTIFIER ::= {
106 // iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 }
107 //
108 // RFC 3279 2.2.1 RSA Signature Algorithms
109 //
110 // md5WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 4 }
111 //
112 // sha-1WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 5 }
113 //
114 // dsaWithSha1 OBJECT IDENTIFIER ::= {
115 // iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 3 }
116 //
117 // RFC 3279 2.2.3 ECDSA Signature Algorithm
118 //
119 // ecdsa-with-SHA1 OBJECT IDENTIFIER ::= {
120 // iso(1) member-body(2) us(840) ansi-x962(10045)
121 // signatures(4) ecdsa-with-SHA1(1)}
122 //
123 // RFC 4055 5 PKCS #1 Version 1.5
124 //
125 // sha256WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 11 }
126 //
127 // sha384WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 12 }
128 //
129 // sha512WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 13 }
130 //
131 // RFC 5758 3.1 DSA Signature Algorithms
132 //
133 // dsaWithSha256 OBJECT IDENTIFIER ::= {
134 // joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101)
135 // csor(3) algorithms(4) id-dsa-with-sha2(3) 2}
136 //
137 // RFC 5758 3.2 ECDSA Signature Algorithm
138 //
139 // ecdsa-with-SHA256 OBJECT IDENTIFIER ::= { iso(1) member-body(2)
140 // us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 2 }
141 //
142 // ecdsa-with-SHA384 OBJECT IDENTIFIER ::= { iso(1) member-body(2)
143 // us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 3 }
144 //
145 // ecdsa-with-SHA512 OBJECT IDENTIFIER ::= { iso(1) member-body(2)
146 // us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 4 }
147 //
148 // RFC 8410 3 Curve25519 and Curve448 Algorithm Identifiers
149 //
150 // id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 }
151 var (
152 oidSignatureMD5WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureMD5WithRSA. = 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}
153 oidSignatureSHA1WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA1WithRSA. = 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}
154 oidSignatureSHA256WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA256WithRSA. = 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}
155 oidSignatureSHA384WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA384WithRSA. = 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}
156 oidSignatureSHA512WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA512WithRSA. = 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}
157 oidSignatureRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureRSAPSS. = 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, 10}
158 oidSignatureDSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureDSAWithSHA1. = 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}
159 oidSignatureDSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureDSAWithSHA256. = 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, 3, 2}
160 oidSignatureECDSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA1. = 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}
161 oidSignatureECDSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA256. = 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}
162 oidSignatureECDSAWithSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA384. = 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}
163 oidSignatureECDSAWithSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA512. = 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}
164 oidSignatureEd25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureEd25519. = 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, 101, 112}
165
166 oidSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSHA256. = 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}
167 oidSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSHA384. = 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}
168 oidSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSHA512. = 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}
169
170 oidMGF1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidMGF1. = 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, 8}
171
172 // oidISOSignatureSHA1WithRSA means the same as oidSignatureSHA1WithRSA
173 // but it's specified by ISO. Microsoft's makecert.exe has been known
174 // to produce certificates with this OID.
175 oidISOSignatureSHA1WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidISOSignatureSHA1WithRSA. = 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, 29}
176 )
177
178 var signatureAlgorithmDetailsscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails. = []struct {
179 algoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:algo. SignatureAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SignatureAlgorithm#
180 namescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:name. string
181 oidscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails: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#
182 paramsscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:params. 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#
183 pubKeyAlgoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:pubKeyAlgo. PublicKeyAlgorithmscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/PublicKeyAlgorithm#
184 hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:hash. cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.Hashscip-go gomod github.com/golang/go/src go1.14 crypto/Hash#
185 isRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:isRSAPSS. bool
186 }{
187 {MD5WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/MD5WithRSA., "MD5-RSA", oidSignatureMD5WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureMD5WithRSA., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullRawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullRawValue., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.MD5scip-go gomod github.com/golang/go/src go1.14 crypto/MD5., false},
188 {SHA1WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA1WithRSA., "SHA1-RSA", oidSignatureSHA1WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA1WithRSA., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullRawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullRawValue., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA1scip-go gomod github.com/golang/go/src go1.14 crypto/SHA1., false},
189 {SHA1WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA1WithRSA., "SHA1-RSA", oidISOSignatureSHA1WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidISOSignatureSHA1WithRSA., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullRawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullRawValue., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA1scip-go gomod github.com/golang/go/src go1.14 crypto/SHA1., false},
190 {SHA256WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA256WithRSA., "SHA256-RSA", oidSignatureSHA256WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA256WithRSA., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullRawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullRawValue., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA256scip-go gomod github.com/golang/go/src go1.14 crypto/SHA256., false},
191 {SHA384WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA384WithRSA., "SHA384-RSA", oidSignatureSHA384WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA384WithRSA., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullRawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullRawValue., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA384scip-go gomod github.com/golang/go/src go1.14 crypto/SHA384., false},
192 {SHA512WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA512WithRSA., "SHA512-RSA", oidSignatureSHA512WithRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureSHA512WithRSA., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullRawValuescip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullRawValue., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA512scip-go gomod github.com/golang/go/src go1.14 crypto/SHA512., false},
193 {SHA256WithRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA256WithRSAPSS., "SHA256-RSAPSS", oidSignatureRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureRSAPSS., pssParametersSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParametersSHA256., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA256scip-go gomod github.com/golang/go/src go1.14 crypto/SHA256., true},
194 {SHA384WithRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA384WithRSAPSS., "SHA384-RSAPSS", oidSignatureRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureRSAPSS., pssParametersSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParametersSHA384., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA384scip-go gomod github.com/golang/go/src go1.14 crypto/SHA384., true},
195 {SHA512WithRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/SHA512WithRSAPSS., "SHA512-RSAPSS", oidSignatureRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureRSAPSS., pssParametersSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParametersSHA512., RSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/RSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA512scip-go gomod github.com/golang/go/src go1.14 crypto/SHA512., true},
196 {DSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSAWithSHA1., "DSA-SHA1", oidSignatureDSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureDSAWithSHA1., emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue., DSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA1scip-go gomod github.com/golang/go/src go1.14 crypto/SHA1., false},
197 {DSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSAWithSHA256., "DSA-SHA256", oidSignatureDSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureDSAWithSHA256., emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue., DSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/DSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA256scip-go gomod github.com/golang/go/src go1.14 crypto/SHA256., false},
198 {ECDSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA1., "ECDSA-SHA1", oidSignatureECDSAWithSHA1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA1., emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue., ECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA1scip-go gomod github.com/golang/go/src go1.14 crypto/SHA1., false},
199 {ECDSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA256., "ECDSA-SHA256", oidSignatureECDSAWithSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA256., emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue., ECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA256scip-go gomod github.com/golang/go/src go1.14 crypto/SHA256., false},
200 {ECDSAWithSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA384., "ECDSA-SHA384", oidSignatureECDSAWithSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA384., emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue., ECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA384scip-go gomod github.com/golang/go/src go1.14 crypto/SHA384., false},
201 {ECDSAWithSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSAWithSHA512., "ECDSA-SHA512", oidSignatureECDSAWithSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureECDSAWithSHA512., emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue., ECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ECDSA., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.SHA512scip-go gomod github.com/golang/go/src go1.14 crypto/SHA512., false},
202 {PureEd25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/PureEd25519., "Ed25519", oidSignatureEd25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureEd25519., emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue., Ed25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/Ed25519., cryptoscip-go gomod github.com/golang/go/src go1.14 crypto/.Hashscip-go gomod github.com/golang/go/src go1.14 crypto/Hash#(0) /* no pre-hashing */, false},
203 }
204
205 var emptyRawValuescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/emptyRawValue. = 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#{}
206
207 // DER encoded RSA PSS parameters for the
208 // SHA256, SHA384, and SHA512 hashes as defined in RFC 3447, Appendix A.2.3.
209 // The parameters contain the following values:
210 // - hashAlgorithm contains the associated hash identifier with NULL parameters
211 // - maskGenAlgorithm always contains the default mgf1SHA1 identifier
212 // - saltLength contains the length of the associated hash
213 // - trailerField always contains the default trailerFieldBC value
214 var (
215 pssParametersSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParametersSHA256. = 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#{FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes.: []byte{48, 52, 160, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 1, 5, 0, 161, 28, 48, 26, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 8, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 1, 5, 0, 162, 3, 2, 1, 32}}
216 pssParametersSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParametersSHA384. = 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#{FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes.: []byte{48, 52, 160, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 2, 5, 0, 161, 28, 48, 26, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 8, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 2, 5, 0, 162, 3, 2, 1, 48}}
217 pssParametersSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParametersSHA512. = 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#{FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes.: []byte{48, 52, 160, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 3, 5, 0, 161, 28, 48, 26, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 8, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 3, 5, 0, 162, 3, 2, 1, 64}}
218 )
219
220 // pssParameters reflects the parameters in an AlgorithmIdentifier that
221 // specifies RSA PSS. See RFC 3447, Appendix A.2.3.
222 type pssParametersscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters# struct {
223 // The following three fields are not marked as
224 // optional because the default values specify SHA-1,
225 // which is no longer suitable for use in signatures.
226 Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#Hash. pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/.AlgorithmIdentifierscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier# `asn1:"explicit,tag:0"`
227 MGFscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#MGF. pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/.AlgorithmIdentifierscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier# `asn1:"explicit,tag:1"`
228 SaltLengthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#SaltLength. int `asn1:"explicit,tag:2"`
229 TrailerFieldscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#TrailerField. int `asn1:"optional,explicit,tag:3,default:1"`
230 }
231
232 func getSignatureAlgorithmFromAIscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/getSignatureAlgorithmFromAI().(ai pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/.AlgorithmIdentifierscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#) stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SignatureAlgorithm# {
233 if ai.Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidSignatureEd25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureEd25519.) {
234 // RFC 8410, Section 3
235 // > For all of the OIDs, the parameters MUST be absent.
236 if len(ai.Parametersscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Parameters..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes.) != 0 {
237 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.UnknownSignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/UnknownSignatureAlgorithm.
238 }
239 }
240
241 if !ai.Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidSignatureRSAPSSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSignatureRSAPSS.) {
242 for _, details := range signatureAlgorithmDetailsscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails. {
243 if ai.Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(details.oidscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:oid.) {
244 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SignatureAlgorithm#(details.algoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/signatureAlgorithmDetails:algo.)
245 }
246 }
247 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.UnknownSignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/UnknownSignatureAlgorithm.
248 }
249
250 // RSA PSS is special because it encodes important parameters
251 // in the Parameters.
252
253 var params pssParametersscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#
254 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().(ai.Parametersscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Parameters..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes., &params); err != nil {
255 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.UnknownSignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/UnknownSignatureAlgorithm.
256 }
257
258 var mgf1HashFunc pkixscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/.AlgorithmIdentifierscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#
259 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().(params.MGFscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#MGF..Parametersscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Parameters..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes., &mgf1HashFunc); err != nil {
260 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.UnknownSignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/UnknownSignatureAlgorithm.
261 }
262
263 // PSS is greatly overburdened with options. This code forces them into
264 // three buckets by requiring that the MGF1 hash function always match the
265 // message hash function (as recommended in RFC 3447, Section 8.1), that the
266 // salt length matches the hash length, and that the trailer field has the
267 // default value.
268 if (len(params.Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#Hash..Parametersscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Parameters..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes.) != 0 && !bytesscip-go gomod github.com/golang/go/src go1.14 bytes/.Equalscip-go gomod github.com/golang/go/src go1.14 bytes/Equal().(params.Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#Hash..Parametersscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Parameters..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullBytes.)) ||
269 !params.MGFscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#MGF..Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidMGF1scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidMGF1.) ||
270 !mgf1HashFunc.Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(params.Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#Hash..Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm.) ||
271 (len(mgf1HashFunc.Parametersscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Parameters..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes.) != 0 && !bytesscip-go gomod github.com/golang/go/src go1.14 bytes/.Equalscip-go gomod github.com/golang/go/src go1.14 bytes/Equal().(mgf1HashFunc.Parametersscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Parameters..FullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/RawValue#FullBytes., asn1scip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/.NullBytesscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/NullBytes.)) ||
272 params.TrailerFieldscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#TrailerField. != 1 {
273 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.UnknownSignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/UnknownSignatureAlgorithm.
274 }
275
276 switch {
277 case params.Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#Hash..Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidSHA256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSHA256.) && params.SaltLengthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#SaltLength. == 32:
278 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SHA256WithRSAPSSscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SHA256WithRSAPSS.
279 case params.Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#Hash..Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidSHA384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSHA384.) && params.SaltLengthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#SaltLength. == 48:
280 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SHA384WithRSAPSSscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SHA384WithRSAPSS.
281 case params.Hashscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#Hash..Algorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509/pkix`/AlgorithmIdentifier#Algorithm..Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidSHA512scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidSHA512.) && params.SaltLengthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/pssParameters#SaltLength. == 64:
282 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.SHA512WithRSAPSSscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/SHA512WithRSAPSS.
283 }
284
285 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.UnknownSignatureAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/UnknownSignatureAlgorithm.
286 }
287
288 var (
289 // RFC 3279, 2.3 Public Key Algorithms
290 //
291 // pkcs-1 OBJECT IDENTIFIER ::== { iso(1) member-body(2) us(840)
292 // rsadsi(113549) pkcs(1) 1 }
293 //
294 // rsaEncryption OBJECT IDENTIFIER ::== { pkcs1-1 1 }
295 //
296 // id-dsa OBJECT IDENTIFIER ::== { iso(1) member-body(2) us(840)
297 // x9-57(10040) x9cm(4) 1 }
298 oidPublicKeyRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyRSA. = 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}
299 oidPublicKeyDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyDSA. = 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}
300 // RFC 5480, 2.1.1 Unrestricted Algorithm Identifier and Parameters
301 //
302 // id-ecPublicKey OBJECT IDENTIFIER ::= {
303 // iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 }
304 oidPublicKeyECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyECDSA. = 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, 2, 1}
305 // RFC 8410, Section 3
306 //
307 // id-X25519 OBJECT IDENTIFIER ::= { 1 3 101 110 }
308 // id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 }
309 oidPublicKeyX25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyX25519. = 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, 101, 110}
310 oidPublicKeyEd25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyEd25519. = 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, 101, 112}
311 )
312
313 // getPublicKeyAlgorithmFromOID returns the exposed PublicKeyAlgorithm
314 // identifier for public key types supported in certificates and CSRs. Marshal
315 // and Parse functions may support a different set of public key types.
316 func getPublicKeyAlgorithmFromOIDscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/getPublicKeyAlgorithmFromOID().(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#) stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.PublicKeyAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/PublicKeyAlgorithm# {
317 switch {
318 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidPublicKeyRSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyRSA.):
319 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.RSAscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/RSA.
320 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidPublicKeyDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyDSA.):
321 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.DSAscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/DSA.
322 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidPublicKeyECDSAscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyECDSA.):
323 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.ECDSAscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/ECDSA.
324 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidPublicKeyEd25519scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidPublicKeyEd25519.):
325 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.Ed25519scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/Ed25519.
326 }
327 return stdx509scip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/.UnknownPublicKeyAlgorithmscip-go gomod github.com/golang/go/src go1.14 `crypto/x509`/UnknownPublicKeyAlgorithm.
328 }
329
330 // RFC 5480, 2.1.1.1. Named Curve
331 //
332 // secp224r1 OBJECT IDENTIFIER ::= {
333 // iso(1) identified-organization(3) certicom(132) curve(0) 33 }
334 //
335 // secp256r1 OBJECT IDENTIFIER ::= {
336 // iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3)
337 // prime(1) 7 }
338 //
339 // secp384r1 OBJECT IDENTIFIER ::= {
340 // iso(1) identified-organization(3) certicom(132) curve(0) 34 }
341 //
342 // secp521r1 OBJECT IDENTIFIER ::= {
343 // iso(1) identified-organization(3) certicom(132) curve(0) 35 }
344 //
345 // NB: secp256r1 is equivalent to prime256v1
346 var (
347 oidNamedCurveP224scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP224. = 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, 33}
348 oidNamedCurveP256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP256. = 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}
349 oidNamedCurveP384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP384. = 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}
350 oidNamedCurveP521scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP521. = 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}
351 )
352
353 func namedCurveFromOIDscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/namedCurveFromOID().(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#) ellipticscip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/.Curvescip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/Curve# {
354 switch {
355 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidNamedCurveP224scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP224.):
356 return ellipticscip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/.P224scip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/P224().()
357 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidNamedCurveP256scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP256.):
358 return ellipticscip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/.P256scip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/P256().()
359 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidNamedCurveP384scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP384.):
360 return ellipticscip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/.P384scip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/P384().()
361 case oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(oidNamedCurveP521scip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidNamedCurveP521.):
362 return ellipticscip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/.P521scip-go gomod github.com/golang/go/src go1.14 `crypto/elliptic`/P521().()
363 }
364 return nil
365 }
366
367 // KeyUsage represents the set of actions that are valid for a given key. It's
368 // a bitmap of the KeyUsage* constants.
369 type KeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsage# int
370
371 const (
372 KeyUsageDigitalSignaturescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageDigitalSignature. KeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsage# = 1 << iota
373 KeyUsageContentCommitmentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageContentCommitment.
374 KeyUsageKeyEnciphermentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageKeyEncipherment.
375 KeyUsageDataEnciphermentscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageDataEncipherment.
376 KeyUsageKeyAgreementscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageKeyAgreement.
377 KeyUsageCertSignscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageCertSign.
378 KeyUsageCRLSignscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageCRLSign.
379 KeyUsageEncipherOnlyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageEncipherOnly.
380 KeyUsageDecipherOnlyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/KeyUsageDecipherOnly.
381 )
382
383 // RFC 5280, 4.2.1.12 Extended Key Usage
384 //
385 // anyExtendedKeyUsage OBJECT IDENTIFIER ::= { id-ce-extKeyUsage 0 }
386 //
387 // id-kp OBJECT IDENTIFIER ::= { id-pkix 3 }
388 //
389 // id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 }
390 // id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 }
391 // id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 }
392 // id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 }
393 // id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 }
394 // id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 }
395 var (
396 oidExtKeyUsageAnyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageAny. = 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, 5, 29, 37, 0}
397 oidExtKeyUsageServerAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageServerAuth. = 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, 6, 1, 5, 5, 7, 3, 1}
398 oidExtKeyUsageClientAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageClientAuth. = 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, 6, 1, 5, 5, 7, 3, 2}
399 oidExtKeyUsageCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageCodeSigning. = 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, 6, 1, 5, 5, 7, 3, 3}
400 oidExtKeyUsageEmailProtectionscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageEmailProtection. = 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, 6, 1, 5, 5, 7, 3, 4}
401 oidExtKeyUsageIPSECEndSystemscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageIPSECEndSystem. = 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, 6, 1, 5, 5, 7, 3, 5}
402 oidExtKeyUsageIPSECTunnelscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageIPSECTunnel. = 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, 6, 1, 5, 5, 7, 3, 6}
403 oidExtKeyUsageIPSECUserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageIPSECUser. = 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, 6, 1, 5, 5, 7, 3, 7}
404 oidExtKeyUsageTimeStampingscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageTimeStamping. = 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, 6, 1, 5, 5, 7, 3, 8}
405 oidExtKeyUsageOCSPSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageOCSPSigning. = 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, 6, 1, 5, 5, 7, 3, 9}
406 oidExtKeyUsageMicrosoftServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageMicrosoftServerGatedCrypto. = 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, 6, 1, 4, 1, 311, 10, 3, 3}
407 oidExtKeyUsageNetscapeServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageNetscapeServerGatedCrypto. = 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, 113730, 4, 1}
408 oidExtKeyUsageMicrosoftCommercialCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageMicrosoftCommercialCodeSigning. = 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, 6, 1, 4, 1, 311, 2, 1, 22}
409 oidExtKeyUsageMicrosoftKernelCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageMicrosoftKernelCodeSigning. = 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, 6, 1, 4, 1, 311, 61, 1, 1}
410 )
411
412 // ExtKeyUsage represents an extended set of actions that are valid for a given key.
413 // Each of the ExtKeyUsage* constants define a unique action.
414 type ExtKeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsage# int
415
416 const (
417 ExtKeyUsageAnyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageAny. ExtKeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsage# = iota
418 ExtKeyUsageServerAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageServerAuth.
419 ExtKeyUsageClientAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageClientAuth.
420 ExtKeyUsageCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageCodeSigning.
421 ExtKeyUsageEmailProtectionscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageEmailProtection.
422 ExtKeyUsageIPSECEndSystemscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageIPSECEndSystem.
423 ExtKeyUsageIPSECTunnelscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageIPSECTunnel.
424 ExtKeyUsageIPSECUserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageIPSECUser.
425 ExtKeyUsageTimeStampingscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageTimeStamping.
426 ExtKeyUsageOCSPSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageOCSPSigning.
427 ExtKeyUsageMicrosoftServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageMicrosoftServerGatedCrypto.
428 ExtKeyUsageNetscapeServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageNetscapeServerGatedCrypto.
429 ExtKeyUsageMicrosoftCommercialCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageMicrosoftCommercialCodeSigning.
430 ExtKeyUsageMicrosoftKernelCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageMicrosoftKernelCodeSigning.
431 )
432
433 // extKeyUsageOIDs contains the mapping between an ExtKeyUsage and its OID.
434 var extKeyUsageOIDsscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/extKeyUsageOIDs. = []struct {
435 extKeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/extKeyUsageOIDs:extKeyUsage. ExtKeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsage#
436 oidscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/extKeyUsageOIDs: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#
437 }{
438 {ExtKeyUsageAnyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageAny., oidExtKeyUsageAnyscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageAny.},
439 {ExtKeyUsageServerAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageServerAuth., oidExtKeyUsageServerAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageServerAuth.},
440 {ExtKeyUsageClientAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageClientAuth., oidExtKeyUsageClientAuthscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageClientAuth.},
441 {ExtKeyUsageCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageCodeSigning., oidExtKeyUsageCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageCodeSigning.},
442 {ExtKeyUsageEmailProtectionscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageEmailProtection., oidExtKeyUsageEmailProtectionscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageEmailProtection.},
443 {ExtKeyUsageIPSECEndSystemscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageIPSECEndSystem., oidExtKeyUsageIPSECEndSystemscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageIPSECEndSystem.},
444 {ExtKeyUsageIPSECTunnelscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageIPSECTunnel., oidExtKeyUsageIPSECTunnelscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageIPSECTunnel.},
445 {ExtKeyUsageIPSECUserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageIPSECUser., oidExtKeyUsageIPSECUserscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageIPSECUser.},
446 {ExtKeyUsageTimeStampingscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageTimeStamping., oidExtKeyUsageTimeStampingscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageTimeStamping.},
447 {ExtKeyUsageOCSPSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageOCSPSigning., oidExtKeyUsageOCSPSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageOCSPSigning.},
448 {ExtKeyUsageMicrosoftServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageMicrosoftServerGatedCrypto., oidExtKeyUsageMicrosoftServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageMicrosoftServerGatedCrypto.},
449 {ExtKeyUsageNetscapeServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageNetscapeServerGatedCrypto., oidExtKeyUsageNetscapeServerGatedCryptoscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageNetscapeServerGatedCrypto.},
450 {ExtKeyUsageMicrosoftCommercialCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageMicrosoftCommercialCodeSigning., oidExtKeyUsageMicrosoftCommercialCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageMicrosoftCommercialCodeSigning.},
451 {ExtKeyUsageMicrosoftKernelCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsageMicrosoftKernelCodeSigning., oidExtKeyUsageMicrosoftKernelCodeSigningscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtKeyUsageMicrosoftKernelCodeSigning.},
452 }
453
454 func extKeyUsageFromOIDscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/extKeyUsageFromOID().(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#) (eku ExtKeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/ExtKeyUsage#, ok bool) {
455 for _, pair := range extKeyUsageOIDsscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/extKeyUsageOIDs. {
456 if oid.Equalscip-go gomod github.com/golang/go/src go1.14 `encoding/asn1`/ObjectIdentifier#Equal().(pair.oidscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/extKeyUsageOIDs:oid.) {
457 return pair.extKeyUsagescip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/extKeyUsageOIDs:extKeyUsage., true
458 }
459 }
460 return
461 }
462
463 const (
464 nameTypeEmailscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/nameTypeEmail. = 1
465 nameTypeDNSscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/nameTypeDNS. = 2
466 nameTypeURIscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/nameTypeURI. = 6
467 nameTypeIPscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/nameTypeIP. = 7
468 )
469
470 var (
471 oidExtensionAuthorityInfoAccessscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidExtensionAuthorityInfoAccess. = []int{1, 3, 6, 1, 5, 5, 7, 1, 1}
472 )
473
474 var (
475 oidAuthorityInfoAccessOcspscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidAuthorityInfoAccessOcsp. = 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, 6, 1, 5, 5, 7, 48, 1}
476 oidAuthorityInfoAccessIssuersscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/oidAuthorityInfoAccessIssuers. = 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, 6, 1, 5, 5, 7, 48, 2}
477 )
478
479 func isIA5Stringscip-go gomod github.com/smallstep/pkcs7 . `github.com/smallstep/pkcs7/internal/legacy/x509`/isIA5String().(s string) error {
480 for _, r := range s {
481 // Per RFC5280 "IA5String is limited to the set of ASCII characters"
482 if r > unicodescip-go gomod github.com/golang/go/src go1.14 unicode/.MaxASCIIscip-go gomod github.com/golang/go/src go1.14 unicode/MaxASCII. {
483 return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("x509: %q cannot be encoded as an IA5String", s)
484 }
485 }
486
487 return nil
488 }