OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/base/ev_root_ca_metadata.h" | |
6 | |
7 #if defined(USE_NSS) || defined(OS_IOS) | |
8 #include <cert.h> | |
9 #include <pkcs11n.h> | |
10 #include <secerr.h> | |
11 #include <secoid.h> | |
12 #elif defined(OS_WIN) | |
13 #include <stdlib.h> | |
14 #endif | |
15 | |
16 #include "base/lazy_instance.h" | |
17 #include "base/logging.h" | |
18 #if defined(USE_NSS) || defined(OS_IOS) | |
19 #include "crypto/nss_util.h" | |
20 #endif | |
21 | |
22 namespace net { | |
23 | |
24 // Raw metadata. | |
25 struct EVMetadata { | |
26 // kMaxOIDsPerCA is the number of OIDs that we can support per root CA. At | |
27 // least one CA has different EV policies for businuss vs government | |
28 // entities and, in the case of cross-signing, we might need to list another | |
29 // CA's policy OID under the cross-signing root. | |
30 static const size_t kMaxOIDsPerCA = 2; | |
31 // This is the maximum length of an OID string (including the trailing NUL). | |
32 static const size_t kMaxOIDLength = 32; | |
33 | |
34 // The SHA-1 fingerprint of the root CA certificate, used as a unique | |
35 // identifier for a root CA certificate. | |
36 SHA1HashValue fingerprint; | |
37 | |
38 // The EV policy OIDs of the root CA. | |
39 const char policy_oids[kMaxOIDsPerCA][kMaxOIDLength]; | |
40 }; | |
41 | |
42 static const EVMetadata ev_root_ca_metadata[] = { | |
43 // AC Camerfirma S.A. Chambers of Commerce Root - 2008 | |
44 // https://www.camerfirma.com | |
45 { { { 0x78, 0x6a, 0x74, 0xac, 0x76, 0xab, 0x14, 0x7f, 0x9c, 0x6a, | |
46 0x30, 0x50, 0xba, 0x9e, 0xa8, 0x7e, 0xfe, 0x9a, 0xce, 0x3c } }, | |
47 { // AC Camerfirma uses the last two arcs to track how the private key is | |
48 // managed - the effective verification policy is the same. | |
49 "1.3.6.1.4.1.17326.10.14.2.1.2", | |
50 "1.3.6.1.4.1.17326.10.14.2.2.2", }, | |
51 }, | |
52 // AC Camerfirma S.A. Global Chambersign Root - 2008 | |
53 // https://server2.camerfirma.com:8082 | |
54 { { { 0x4a, 0xbd, 0xee, 0xec, 0x95, 0x0d, 0x35, 0x9c, 0x89, 0xae, | |
55 0xc7, 0x52, 0xa1, 0x2c, 0x5b, 0x29, 0xf6, 0xd6, 0xaa, 0x0c } }, | |
56 { // AC Camerfirma uses the last two arcs to track how the private key is | |
57 // managed - the effective verification policy is the same. | |
58 "1.3.6.1.4.1.17326.10.8.12.1.2", | |
59 "1.3.6.1.4.1.17326.10.8.12.2.2", }, | |
60 }, | |
61 // AddTrust External CA Root | |
62 // https://addtrustexternalcaroot-ev.comodoca.com | |
63 { { { 0x02, 0xfa, 0xf3, 0xe2, 0x91, 0x43, 0x54, 0x68, 0x60, 0x78, | |
64 0x57, 0x69, 0x4d, 0xf5, 0xe4, 0x5b, 0x68, 0x85, 0x18, 0x68 } }, | |
65 { | |
66 "1.3.6.1.4.1.6449.1.2.1.5.1", | |
67 // This is the Network Solutions EV OID. However, this root | |
68 // cross-certifies NetSol and so we need it here too. | |
69 "1.3.6.1.4.1.782.1.2.1.8.1", | |
70 }, | |
71 }, | |
72 // AffirmTrust Commercial | |
73 // https://commercial.affirmtrust.com/ | |
74 { { { 0xf9, 0xb5, 0xb6, 0x32, 0x45, 0x5f, 0x9c, 0xbe, 0xec, 0x57, | |
75 0x5f, 0x80, 0xdc, 0xe9, 0x6e, 0x2c, 0xc7, 0xb2, 0x78, 0xb7 } }, | |
76 {"1.3.6.1.4.1.34697.2.1", ""}, | |
77 }, | |
78 // AffirmTrust Networking | |
79 // https://networking.affirmtrust.com:4431 | |
80 { { { 0x29, 0x36, 0x21, 0x02, 0x8b, 0x20, 0xed, 0x02, 0xf5, 0x66, | |
81 0xc5, 0x32, 0xd1, 0xd6, 0xed, 0x90, 0x9f, 0x45, 0x00, 0x2f } }, | |
82 {"1.3.6.1.4.1.34697.2.2", ""}, | |
83 }, | |
84 // AffirmTrust Premium | |
85 // https://premium.affirmtrust.com:4432/ | |
86 { { { 0xd8, 0xa6, 0x33, 0x2c, 0xe0, 0x03, 0x6f, 0xb1, 0x85, 0xf6, | |
87 0x63, 0x4f, 0x7d, 0x6a, 0x06, 0x65, 0x26, 0x32, 0x28, 0x27 } }, | |
88 {"1.3.6.1.4.1.34697.2.3", ""}, | |
89 }, | |
90 // AffirmTrust Premium ECC | |
91 // https://premiumecc.affirmtrust.com:4433/ | |
92 { { { 0xb8, 0x23, 0x6b, 0x00, 0x2f, 0x1d, 0x16, 0x86, 0x53, 0x01, | |
93 0x55, 0x6c, 0x11, 0xa4, 0x37, 0xca, 0xeb, 0xff, 0xc3, 0xbb } }, | |
94 {"1.3.6.1.4.1.34697.2.4", ""}, | |
95 }, | |
96 // CertPlus Class 2 Primary CA (KEYNECTIS) | |
97 // https://www.keynectis.com/ | |
98 { { { 0x74, 0x20, 0x74, 0x41, 0x72, 0x9c, 0xdd, 0x92, 0xec, 0x79, | |
99 0x31, 0xd8, 0x23, 0x10, 0x8d, 0xc2, 0x81, 0x92, 0xe2, 0xbb } }, | |
100 {"1.3.6.1.4.1.22234.2.5.2.3.1", ""}, | |
101 }, | |
102 // Certum Trusted Network CA | |
103 // https://juice.certum.pl/ | |
104 { { { 0x07, 0xe0, 0x32, 0xe0, 0x20, 0xb7, 0x2c, 0x3f, 0x19, 0x2f, | |
105 0x06, 0x28, 0xa2, 0x59, 0x3a, 0x19, 0xa7, 0x0f, 0x06, 0x9e } }, | |
106 {"1.2.616.1.113527.2.5.1.1", ""}, | |
107 }, | |
108 // COMODO Certification Authority | |
109 // https://secure.comodo.com/ | |
110 { { { 0x66, 0x31, 0xbf, 0x9e, 0xf7, 0x4f, 0x9e, 0xb6, 0xc9, 0xd5, | |
111 0xa6, 0x0c, 0xba, 0x6a, 0xbe, 0xd1, 0xf7, 0xbd, 0xef, 0x7b } }, | |
112 {"1.3.6.1.4.1.6449.1.2.1.5.1", ""}, | |
113 }, | |
114 // COMODO Certification Authority (reissued certificate with NotBefore of Jan | |
115 // 1 00:00:00 2011 GMT) | |
116 // https://secure.comodo.com/ | |
117 { { { 0xee, 0x86, 0x93, 0x87, 0xff, 0xfd, 0x83, 0x49, 0xab, 0x5a, | |
118 0xd1, 0x43, 0x22, 0x58, 0x87, 0x89, 0xa4, 0x57, 0xb0, 0x12 } }, | |
119 {"1.3.6.1.4.1.6449.1.2.1.5.1", ""}, | |
120 }, | |
121 // COMODO ECC Certification Authority | |
122 // https://comodoecccertificationauthority-ev.comodoca.com/ | |
123 { { { 0x9f, 0x74, 0x4e, 0x9f, 0x2b, 0x4d, 0xba, 0xec, 0x0f, 0x31, | |
124 0x2c, 0x50, 0xb6, 0x56, 0x3b, 0x8e, 0x2d, 0x93, 0xc3, 0x11 } }, | |
125 {"1.3.6.1.4.1.6449.1.2.1.5.1", ""}, | |
126 }, | |
127 // Cybertrust Global Root | |
128 // https://evup.cybertrust.ne.jp/ctj-ev-upgrader/evseal.gif | |
129 { { { 0x5f, 0x43, 0xe5, 0xb1, 0xbf, 0xf8, 0x78, 0x8c, 0xac, 0x1c, | |
130 0xc7, 0xca, 0x4a, 0x9a, 0xc6, 0x22, 0x2b, 0xcc, 0x34, 0xc6 } }, | |
131 {"1.3.6.1.4.1.6334.1.100.1", ""}, | |
132 }, | |
133 // DigiCert High Assurance EV Root CA | |
134 // https://www.digicert.com | |
135 { { { 0x5f, 0xb7, 0xee, 0x06, 0x33, 0xe2, 0x59, 0xdb, 0xad, 0x0c, | |
136 0x4c, 0x9a, 0xe6, 0xd3, 0x8f, 0x1a, 0x61, 0xc7, 0xdc, 0x25 } }, | |
137 {"2.16.840.1.114412.2.1", ""}, | |
138 }, | |
139 // D-TRUST Root Class 3 CA 2 EV 2009 | |
140 // https://certdemo-ev-valid.ssl.d-trust.net/ | |
141 { { { 0x96, 0xc9, 0x1b, 0x0b, 0x95, 0xb4, 0x10, 0x98, 0x42, 0xfa, | |
142 0xd0, 0xd8, 0x22, 0x79, 0xfe, 0x60, 0xfa, 0xb9, 0x16, 0x83 } }, | |
143 {"1.3.6.1.4.1.4788.2.202.1", ""}, | |
144 }, | |
145 // Entrust.net Secure Server Certification Authority | |
146 // https://www.entrust.net/ | |
147 { { { 0x99, 0xa6, 0x9b, 0xe6, 0x1a, 0xfe, 0x88, 0x6b, 0x4d, 0x2b, | |
148 0x82, 0x00, 0x7c, 0xb8, 0x54, 0xfc, 0x31, 0x7e, 0x15, 0x39 } }, | |
149 {"2.16.840.1.114028.10.1.2", ""}, | |
150 }, | |
151 // Entrust Root Certification Authority | |
152 // https://www.entrust.net/ | |
153 { { { 0xb3, 0x1e, 0xb1, 0xb7, 0x40, 0xe3, 0x6c, 0x84, 0x02, 0xda, | |
154 0xdc, 0x37, 0xd4, 0x4d, 0xf5, 0xd4, 0x67, 0x49, 0x52, 0xf9 } }, | |
155 {"2.16.840.1.114028.10.1.2", ""}, | |
156 }, | |
157 // Equifax Secure Certificate Authority (GeoTrust) | |
158 // https://www.geotrust.com/ | |
159 { { { 0xd2, 0x32, 0x09, 0xad, 0x23, 0xd3, 0x14, 0x23, 0x21, 0x74, | |
160 0xe4, 0x0d, 0x7f, 0x9d, 0x62, 0x13, 0x97, 0x86, 0x63, 0x3a } }, | |
161 {"1.3.6.1.4.1.14370.1.6", ""}, | |
162 }, | |
163 // GeoTrust Primary Certification Authority | |
164 // https://www.geotrust.com/ | |
165 { { { 0x32, 0x3c, 0x11, 0x8e, 0x1b, 0xf7, 0xb8, 0xb6, 0x52, 0x54, | |
166 0xe2, 0xe2, 0x10, 0x0d, 0xd6, 0x02, 0x90, 0x37, 0xf0, 0x96 } }, | |
167 {"1.3.6.1.4.1.14370.1.6", ""}, | |
168 }, | |
169 // GeoTrust Primary Certification Authority - G2 | |
170 { { { 0x8d, 0x17, 0x84, 0xd5, 0x37, 0xf3, 0x03, 0x7d, 0xec, 0x70, | |
171 0xfe, 0x57, 0x8b, 0x51, 0x9a, 0x99, 0xe6, 0x10, 0xd7, 0xb0 } }, | |
172 {"1.3.6.1.4.1.14370.1.6", ""}, | |
173 }, | |
174 // GeoTrust Primary Certification Authority - G3 | |
175 { { { 0x03, 0x9e, 0xed, 0xb8, 0x0b, 0xe7, 0xa0, 0x3c, 0x69, 0x53, | |
176 0x89, 0x3b, 0x20, 0xd2, 0xd9, 0x32, 0x3a, 0x4c, 0x2a, 0xfd } }, | |
177 {"1.3.6.1.4.1.14370.1.6", ""}, | |
178 }, | |
179 // GlobalSign Root CA - R2 | |
180 // https://www.globalsign.com/ | |
181 { { { 0x75, 0xe0, 0xab, 0xb6, 0x13, 0x85, 0x12, 0x27, 0x1c, 0x04, | |
182 0xf8, 0x5f, 0xdd, 0xde, 0x38, 0xe4, 0xb7, 0x24, 0x2e, 0xfe } }, | |
183 {"1.3.6.1.4.1.4146.1.1", ""}, | |
184 }, | |
185 // GlobalSign Root CA | |
186 { { { 0xb1, 0xbc, 0x96, 0x8b, 0xd4, 0xf4, 0x9d, 0x62, 0x2a, 0xa8, | |
187 0x9a, 0x81, 0xf2, 0x15, 0x01, 0x52, 0xa4, 0x1d, 0x82, 0x9c } }, | |
188 {"1.3.6.1.4.1.4146.1.1", ""}, | |
189 }, | |
190 // GlobalSign Root CA - R3 | |
191 // https://2029.globalsign.com/ | |
192 { { { 0xd6, 0x9b, 0x56, 0x11, 0x48, 0xf0, 0x1c, 0x77, 0xc5, 0x45, | |
193 0x78, 0xc1, 0x09, 0x26, 0xdf, 0x5b, 0x85, 0x69, 0x76, 0xad } }, | |
194 {"1.3.6.1.4.1.4146.1.1", ""}, | |
195 }, | |
196 // Go Daddy Class 2 Certification Authority | |
197 // https://www.godaddy.com/ | |
198 { { { 0x27, 0x96, 0xba, 0xe6, 0x3f, 0x18, 0x01, 0xe2, 0x77, 0x26, | |
199 0x1b, 0xa0, 0xd7, 0x77, 0x70, 0x02, 0x8f, 0x20, 0xee, 0xe4 } }, | |
200 {"2.16.840.1.114413.1.7.23.3", ""}, | |
201 }, | |
202 // GTE CyberTrust Global Root | |
203 // https://www.cybertrust.ne.jp/ | |
204 { { { 0x97, 0x81, 0x79, 0x50, 0xd8, 0x1c, 0x96, 0x70, 0xcc, 0x34, | |
205 0xd8, 0x09, 0xcf, 0x79, 0x44, 0x31, 0x36, 0x7e, 0xf4, 0x74 } }, | |
206 {"1.3.6.1.4.1.6334.1.100.1", ""}, | |
207 }, | |
208 // Izenpe.com - SHA256 root | |
209 // The first OID is for businesses and the second for government entities. | |
210 // These are the test sites, respectively: | |
211 // https://servicios.izenpe.com | |
212 // https://servicios1.izenpe.com | |
213 { { { 0x2f, 0x78, 0x3d, 0x25, 0x52, 0x18, 0xa7, 0x4a, 0x65, 0x39, | |
214 0x71, 0xb5, 0x2c, 0xa2, 0x9c, 0x45, 0x15, 0x6f, 0xe9, 0x19} }, | |
215 {"1.3.6.1.4.1.14777.6.1.1", "1.3.6.1.4.1.14777.6.1.2"}, | |
216 }, | |
217 // Izenpe.com - SHA1 root | |
218 // Windows XP finds this, SHA1, root instead. The policy OIDs are the same as | |
219 // for the SHA256 root, above. | |
220 { { { 0x30, 0x77, 0x9e, 0x93, 0x15, 0x02, 0x2e, 0x94, 0x85, 0x6a, | |
221 0x3f, 0xf8, 0xbc, 0xf8, 0x15, 0xb0, 0x82, 0xf9, 0xae, 0xfd} }, | |
222 {"1.3.6.1.4.1.14777.6.1.1", "1.3.6.1.4.1.14777.6.1.2"}, | |
223 }, | |
224 // Network Solutions Certificate Authority | |
225 // https://www.networksolutions.com/website-packages/index.jsp | |
226 { { { 0x74, 0xf8, 0xa3, 0xc3, 0xef, 0xe7, 0xb3, 0x90, 0x06, 0x4b, | |
227 0x83, 0x90, 0x3c, 0x21, 0x64, 0x60, 0x20, 0xe5, 0xdf, 0xce } }, | |
228 {"1.3.6.1.4.1.782.1.2.1.8.1", ""}, | |
229 }, | |
230 // Network Solutions Certificate Authority (reissued certificate with | |
231 // NotBefore of Jan 1 00:00:00 2011 GMT). | |
232 // https://www.networksolutions.com/website-packages/index.jsp | |
233 { { { 0x71, 0x89, 0x9a, 0x67, 0xbf, 0x33, 0xaf, 0x31, 0xbe, 0xfd, | |
234 0xc0, 0x71, 0xf8, 0xf7, 0x33, 0xb1, 0x83, 0x85, 0x63, 0x32 } }, | |
235 {"1.3.6.1.4.1.782.1.2.1.8.1", ""}, | |
236 }, | |
237 // QuoVadis Root CA 2 | |
238 // https://www.quovadis.bm/ | |
239 { { { 0xca, 0x3a, 0xfb, 0xcf, 0x12, 0x40, 0x36, 0x4b, 0x44, 0xb2, | |
240 0x16, 0x20, 0x88, 0x80, 0x48, 0x39, 0x19, 0x93, 0x7c, 0xf7 } }, | |
241 {"1.3.6.1.4.1.8024.0.2.100.1.2", ""}, | |
242 }, | |
243 // SecureTrust CA, SecureTrust Corporation | |
244 // https://www.securetrust.com | |
245 // https://www.trustwave.com/ | |
246 { { { 0x87, 0x82, 0xc6, 0xc3, 0x04, 0x35, 0x3b, 0xcf, 0xd2, 0x96, | |
247 0x92, 0xd2, 0x59, 0x3e, 0x7d, 0x44, 0xd9, 0x34, 0xff, 0x11 } }, | |
248 {"2.16.840.1.114404.1.1.2.4.1", ""}, | |
249 }, | |
250 // Secure Global CA, SecureTrust Corporation | |
251 { { { 0x3a, 0x44, 0x73, 0x5a, 0xe5, 0x81, 0x90, 0x1f, 0x24, 0x86, | |
252 0x61, 0x46, 0x1e, 0x3b, 0x9c, 0xc4, 0x5f, 0xf5, 0x3a, 0x1b } }, | |
253 {"2.16.840.1.114404.1.1.2.4.1", ""}, | |
254 }, | |
255 // Security Communication RootCA1 | |
256 // https://www.secomtrust.net/contact/form.html | |
257 { { { 0x36, 0xb1, 0x2b, 0x49, 0xf9, 0x81, 0x9e, 0xd7, 0x4c, 0x9e, | |
258 0xbc, 0x38, 0x0f, 0xc6, 0x56, 0x8f, 0x5d, 0xac, 0xb2, 0xf7 } }, | |
259 {"1.2.392.200091.100.721.1", ""}, | |
260 }, | |
261 // Security Communication EV RootCA1 | |
262 // https://www.secomtrust.net/contact/form.html | |
263 { { { 0xfe, 0xb8, 0xc4, 0x32, 0xdc, 0xf9, 0x76, 0x9a, 0xce, 0xae, | |
264 0x3d, 0xd8, 0x90, 0x8f, 0xfd, 0x28, 0x86, 0x65, 0x64, 0x7d } }, | |
265 {"1.2.392.200091.100.721.1", ""}, | |
266 }, | |
267 // StartCom Certification Authority | |
268 // https://www.startssl.com/ | |
269 { { { 0x3e, 0x2b, 0xf7, 0xf2, 0x03, 0x1b, 0x96, 0xf3, 0x8c, 0xe6, | |
270 0xc4, 0xd8, 0xa8, 0x5d, 0x3e, 0x2d, 0x58, 0x47, 0x6a, 0x0f } }, | |
271 {"1.3.6.1.4.1.23223.1.1.1", ""}, | |
272 }, | |
273 // Starfield Class 2 Certification Authority | |
274 // https://www.starfieldtech.com/ | |
275 { { { 0xad, 0x7e, 0x1c, 0x28, 0xb0, 0x64, 0xef, 0x8f, 0x60, 0x03, | |
276 0x40, 0x20, 0x14, 0xc3, 0xd0, 0xe3, 0x37, 0x0e, 0xb5, 0x8a } }, | |
277 {"2.16.840.1.114414.1.7.23.3", ""}, | |
278 }, | |
279 // SwissSign Gold CA - G2 | |
280 // https://testevg2.swisssign.net/ | |
281 { { { 0xd8, 0xc5, 0x38, 0x8a, 0xb7, 0x30, 0x1b, 0x1b, 0x6e, 0xd4, | |
282 0x7a, 0xe6, 0x45, 0x25, 0x3a, 0x6f, 0x9f, 0x1a, 0x27, 0x61 } }, | |
283 {"2.16.756.1.89.1.2.1.1", ""}, | |
284 }, | |
285 // Thawte Premium Server CA | |
286 // https://www.thawte.com/ | |
287 { { { 0x62, 0x7f, 0x8d, 0x78, 0x27, 0x65, 0x63, 0x99, 0xd2, 0x7d, | |
288 0x7f, 0x90, 0x44, 0xc9, 0xfe, 0xb3, 0xf3, 0x3e, 0xfa, 0x9a } }, | |
289 {"2.16.840.1.113733.1.7.48.1", ""}, | |
290 }, | |
291 // thawte Primary Root CA | |
292 // https://www.thawte.com/ | |
293 { { { 0x91, 0xc6, 0xd6, 0xee, 0x3e, 0x8a, 0xc8, 0x63, 0x84, 0xe5, | |
294 0x48, 0xc2, 0x99, 0x29, 0x5c, 0x75, 0x6c, 0x81, 0x7b, 0x81 } }, | |
295 {"2.16.840.1.113733.1.7.48.1", ""}, | |
296 }, | |
297 // thawte Primary Root CA - G2 | |
298 { { { 0xaa, 0xdb, 0xbc, 0x22, 0x23, 0x8f, 0xc4, 0x01, 0xa1, 0x27, | |
299 0xbb, 0x38, 0xdd, 0xf4, 0x1d, 0xdb, 0x08, 0x9e, 0xf0, 0x12 } }, | |
300 {"2.16.840.1.113733.1.7.48.1", ""}, | |
301 }, | |
302 // thawte Primary Root CA - G3 | |
303 { { { 0xf1, 0x8b, 0x53, 0x8d, 0x1b, 0xe9, 0x03, 0xb6, 0xa6, 0xf0, | |
304 0x56, 0x43, 0x5b, 0x17, 0x15, 0x89, 0xca, 0xf3, 0x6b, 0xf2 } }, | |
305 {"2.16.840.1.113733.1.7.48.1", ""}, | |
306 }, | |
307 // TWCA Root Certification Authority | |
308 // https://evssldemo.twca.com.tw/index.html | |
309 { { { 0xcf, 0x9e, 0x87, 0x6d, 0xd3, 0xeb, 0xfc, 0x42, 0x26, 0x97, | |
310 0xa3, 0xb5, 0xa3, 0x7a, 0xa0, 0x76, 0xa9, 0x06, 0x23, 0x48 } }, | |
311 {"1.3.6.1.4.1.40869.1.1.22.3", ""}, | |
312 }, | |
313 // T-TeleSec GlobalRoot Class 3 | |
314 // http://www.telesec.de/ / https://root-class3.test.telesec.de/ | |
315 { { { 0x55, 0xa6, 0x72, 0x3e, 0xcb, 0xf2, 0xec, 0xcd, 0xc3, 0x23, | |
316 0x74, 0x70, 0x19, 0x9d, 0x2a, 0xbe, 0x11, 0xe3, 0x81, 0xd1 } }, | |
317 {"1.3.6.1.4.1.7879.13.24.1", "" }, | |
318 }, | |
319 // UTN - DATACorp SGC | |
320 { { { 0x58, 0x11, 0x9f, 0x0e, 0x12, 0x82, 0x87, 0xea, 0x50, 0xfd, | |
321 0xd9, 0x87, 0x45, 0x6f, 0x4f, 0x78, 0xdc, 0xfa, 0xd6, 0xd4 } }, | |
322 {"1.3.6.1.4.1.6449.1.2.1.5.1", ""}, | |
323 }, | |
324 // UTN-USERFirst-Hardware | |
325 { { { 0x04, 0x83, 0xed, 0x33, 0x99, 0xac, 0x36, 0x08, 0x05, 0x87, | |
326 0x22, 0xed, 0xbc, 0x5e, 0x46, 0x00, 0xe3, 0xbe, 0xf9, 0xd7 } }, | |
327 { | |
328 "1.3.6.1.4.1.6449.1.2.1.5.1", | |
329 // This is the Network Solutions EV OID. However, this root | |
330 // cross-certifies NetSol and so we need it here too. | |
331 "1.3.6.1.4.1.782.1.2.1.8.1", | |
332 }, | |
333 }, | |
334 // ValiCert Class 2 Policy Validation Authority | |
335 { { { 0x31, 0x7a, 0x2a, 0xd0, 0x7f, 0x2b, 0x33, 0x5e, 0xf5, 0xa1, | |
336 0xc3, 0x4e, 0x4b, 0x57, 0xe8, 0xb7, 0xd8, 0xf1, 0xfc, 0xa6 } }, | |
337 {"2.16.840.1.114413.1.7.23.3", "2.16.840.1.114414.1.7.23.3"}, | |
338 }, | |
339 // VeriSign Class 3 Public Primary Certification Authority | |
340 // https://www.verisign.com/ | |
341 { { { 0x74, 0x2c, 0x31, 0x92, 0xe6, 0x07, 0xe4, 0x24, 0xeb, 0x45, | |
342 0x49, 0x54, 0x2b, 0xe1, 0xbb, 0xc5, 0x3e, 0x61, 0x74, 0xe2 } }, | |
343 {"2.16.840.1.113733.1.7.23.6", ""}, | |
344 }, | |
345 // VeriSign Class 3 Public Primary Certification Authority - G4 | |
346 { { { 0x22, 0xD5, 0xD8, 0xDF, 0x8F, 0x02, 0x31, 0xD1, 0x8D, 0xF7, | |
347 0x9D, 0xB7, 0xCF, 0x8A, 0x2D, 0x64, 0xC9, 0x3F, 0x6C, 0x3A } }, | |
348 {"2.16.840.1.113733.1.7.23.6", ""}, | |
349 }, | |
350 // VeriSign Class 3 Public Primary Certification Authority - G5 | |
351 // https://www.verisign.com/ | |
352 { { { 0x4e, 0xb6, 0xd5, 0x78, 0x49, 0x9b, 0x1c, 0xcf, 0x5f, 0x58, | |
353 0x1e, 0xad, 0x56, 0xbe, 0x3d, 0x9b, 0x67, 0x44, 0xa5, 0xe5 } }, | |
354 {"2.16.840.1.113733.1.7.23.6", ""}, | |
355 }, | |
356 // VeriSign Universal Root Certification Authority | |
357 { { { 0x36, 0x79, 0xca, 0x35, 0x66, 0x87, 0x72, 0x30, 0x4d, 0x30, | |
358 0xa5, 0xfb, 0x87, 0x3b, 0x0f, 0xa7, 0x7b, 0xb7, 0x0d, 0x54 } }, | |
359 {"2.16.840.1.113733.1.7.23.6", ""}, | |
360 }, | |
361 // Wells Fargo WellsSecure Public Root Certificate Authority | |
362 // https://nerys.wellsfargo.com/test.html | |
363 { { { 0xe7, 0xb4, 0xf6, 0x9d, 0x61, 0xec, 0x90, 0x69, 0xdb, 0x7e, | |
364 0x90, 0xa7, 0x40, 0x1a, 0x3c, 0xf4, 0x7d, 0x4f, 0xe8, 0xee } }, | |
365 {"2.16.840.1.114171.500.9", ""}, | |
366 }, | |
367 // XRamp Global Certification Authority | |
368 { { { 0xb8, 0x01, 0x86, 0xd1, 0xeb, 0x9c, 0x86, 0xa5, 0x41, 0x04, | |
369 0xcf, 0x30, 0x54, 0xf3, 0x4c, 0x52, 0xb7, 0xe5, 0x58, 0xc6 } }, | |
370 {"2.16.840.1.114404.1.1.2.4.1", ""}, | |
371 } | |
372 }; | |
373 | |
374 static base::LazyInstance<EVRootCAMetadata>::Leaky | |
375 g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER; | |
376 | |
377 // static | |
378 EVRootCAMetadata* EVRootCAMetadata::GetInstance() { | |
379 return g_ev_root_ca_metadata.Pointer(); | |
380 } | |
381 | |
382 #if defined(USE_NSS) || defined(OS_IOS) | |
383 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { | |
384 return policy_oids_.find(policy_oid) != policy_oids_.end(); | |
385 } | |
386 | |
387 bool EVRootCAMetadata::HasEVPolicyOID( | |
388 const SHA1HashValue& fingerprint, | |
389 PolicyOID policy_oid) const { | |
390 PolicyOIDMap::const_iterator iter = ev_policy_.find(fingerprint); | |
391 if (iter == ev_policy_.end()) | |
392 return false; | |
393 for (std::vector<PolicyOID>::const_iterator | |
394 j = iter->second.begin(); j != iter->second.end(); ++j) { | |
395 if (*j == policy_oid) | |
396 return true; | |
397 } | |
398 return false; | |
399 } | |
400 | |
401 bool EVRootCAMetadata::AddEVCA(const SHA1HashValue& fingerprint, | |
402 const char* policy) { | |
403 if (ev_policy_.find(fingerprint) != ev_policy_.end()) | |
404 return false; | |
405 | |
406 PolicyOID oid; | |
407 if (!RegisterOID(policy, &oid)) | |
408 return false; | |
409 | |
410 ev_policy_[fingerprint].push_back(oid); | |
411 policy_oids_.insert(oid); | |
412 | |
413 return true; | |
414 } | |
415 | |
416 bool EVRootCAMetadata::RemoveEVCA(const SHA1HashValue& fingerprint) { | |
417 PolicyOIDMap::iterator it = ev_policy_.find(fingerprint); | |
418 if (it == ev_policy_.end()) | |
419 return false; | |
420 PolicyOID oid = it->second[0]; | |
421 ev_policy_.erase(it); | |
422 policy_oids_.erase(oid); | |
423 return true; | |
424 } | |
425 | |
426 // static | |
427 bool EVRootCAMetadata::RegisterOID(const char* policy, | |
428 PolicyOID* out) { | |
429 PRUint8 buf[64]; | |
430 SECItem oid_item; | |
431 oid_item.data = buf; | |
432 oid_item.len = sizeof(buf); | |
433 SECStatus status = SEC_StringToOID(NULL, &oid_item, policy, 0); | |
434 if (status != SECSuccess) | |
435 return false; | |
436 | |
437 // Register the OID. | |
438 SECOidData od; | |
439 od.oid.len = oid_item.len; | |
440 od.oid.data = oid_item.data; | |
441 od.offset = SEC_OID_UNKNOWN; | |
442 od.desc = policy; | |
443 od.mechanism = CKM_INVALID_MECHANISM; | |
444 od.supportedExtension = INVALID_CERT_EXTENSION; | |
445 *out = SECOID_AddEntry(&od); | |
446 return *out != SEC_OID_UNKNOWN; | |
447 } | |
448 | |
449 #elif defined(OS_WIN) | |
450 | |
451 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { | |
452 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { | |
453 for (size_t j = 0; j < arraysize(ev_root_ca_metadata[i].policy_oids); j++) { | |
454 if (ev_root_ca_metadata[i].policy_oids[j][0] == '\0') | |
455 break; | |
456 if (strcmp(policy_oid, ev_root_ca_metadata[i].policy_oids[j]) == 0) | |
457 return true; | |
458 } | |
459 } | |
460 | |
461 for (ExtraEVCAMap::const_iterator i = extra_cas_.begin(); | |
462 i != extra_cas_.end(); i++) { | |
463 if (i->second == policy_oid) | |
464 return true; | |
465 } | |
466 | |
467 return false; | |
468 } | |
469 | |
470 bool EVRootCAMetadata::HasEVPolicyOID(const SHA1HashValue& fingerprint, | |
471 PolicyOID policy_oid) const { | |
472 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { | |
473 if (!fingerprint.Equals(ev_root_ca_metadata[i].fingerprint)) | |
474 continue; | |
475 for (size_t j = 0; j < arraysize(ev_root_ca_metadata[i].policy_oids); j++) { | |
476 if (ev_root_ca_metadata[i].policy_oids[j][0] == '\0') | |
477 break; | |
478 if (strcmp(policy_oid, ev_root_ca_metadata[i].policy_oids[j]) == 0) | |
479 return true; | |
480 } | |
481 return false; | |
482 } | |
483 | |
484 ExtraEVCAMap::const_iterator it = extra_cas_.find(fingerprint); | |
485 return it != extra_cas_.end() && it->second == policy_oid; | |
486 } | |
487 | |
488 bool EVRootCAMetadata::AddEVCA(const SHA1HashValue& fingerprint, | |
489 const char* policy) { | |
490 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { | |
491 if (fingerprint.Equals(ev_root_ca_metadata[i].fingerprint)) | |
492 return false; | |
493 } | |
494 | |
495 if (extra_cas_.find(fingerprint) != extra_cas_.end()) | |
496 return false; | |
497 | |
498 extra_cas_[fingerprint] = policy; | |
499 return true; | |
500 } | |
501 | |
502 bool EVRootCAMetadata::RemoveEVCA(const SHA1HashValue& fingerprint) { | |
503 ExtraEVCAMap::iterator it = extra_cas_.find(fingerprint); | |
504 if (it == extra_cas_.end()) | |
505 return false; | |
506 extra_cas_.erase(it); | |
507 return true; | |
508 } | |
509 | |
510 #else | |
511 | |
512 // These are just stub functions for platforms where we don't use this EV | |
513 // metadata. | |
514 | |
515 bool EVRootCAMetadata::AddEVCA(const SHA1HashValue& fingerprint, | |
516 const char* policy) { | |
517 return true; | |
518 } | |
519 | |
520 bool EVRootCAMetadata::RemoveEVCA(const SHA1HashValue& fingerprint) { | |
521 return true; | |
522 } | |
523 | |
524 #endif | |
525 | |
526 EVRootCAMetadata::EVRootCAMetadata() { | |
527 // Constructs the object from the raw metadata in ev_root_ca_metadata. | |
528 #if defined(USE_NSS) || defined(OS_IOS) | |
529 crypto::EnsureNSSInit(); | |
530 | |
531 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { | |
532 const EVMetadata& metadata = ev_root_ca_metadata[i]; | |
533 for (size_t j = 0; j < arraysize(metadata.policy_oids); j++) { | |
534 if (metadata.policy_oids[j][0] == '\0') | |
535 break; | |
536 const char* policy_oid = metadata.policy_oids[j]; | |
537 | |
538 PolicyOID policy; | |
539 if (!RegisterOID(policy_oid, &policy)) { | |
540 LOG(ERROR) << "Failed to register OID: " << policy_oid; | |
541 continue; | |
542 } | |
543 | |
544 ev_policy_[metadata.fingerprint].push_back(policy); | |
545 policy_oids_.insert(policy); | |
546 } | |
547 } | |
548 #endif | |
549 } | |
550 | |
551 EVRootCAMetadata::~EVRootCAMetadata() { } | |
552 | |
553 } // namespace net | |
OLD | NEW |