Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: net/base/ev_root_ca_metadata.cc

Issue 9663017: net: add OCSP tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/ev_root_ca_metadata.h" 5 #include "net/base/ev_root_ca_metadata.h"
6 6
7 #if defined(USE_NSS) 7 #if defined(USE_NSS)
8 #include <cert.h> 8 #include <cert.h>
9 #include <pkcs11n.h> 9 #include <pkcs11n.h>
10 #include <secerr.h> 10 #include <secerr.h>
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // Wells Fargo WellsSecure Public Root Certificate Authority 279 // Wells Fargo WellsSecure Public Root Certificate Authority
280 // https://nerys.wellsfargo.com/test.html 280 // https://nerys.wellsfargo.com/test.html
281 { { { 0xe7, 0xb4, 0xf6, 0x9d, 0x61, 0xec, 0x90, 0x69, 0xdb, 0x7e, 281 { { { 0xe7, 0xb4, 0xf6, 0x9d, 0x61, 0xec, 0x90, 0x69, 0xdb, 0x7e,
282 0x90, 0xa7, 0x40, 0x1a, 0x3c, 0xf4, 0x7d, 0x4f, 0xe8, 0xee } }, 282 0x90, 0xa7, 0x40, 0x1a, 0x3c, 0xf4, 0x7d, 0x4f, 0xe8, 0xee } },
283 {"2.16.840.1.114171.500.9", NULL}, 283 {"2.16.840.1.114171.500.9", NULL},
284 }, 284 },
285 // XRamp Global Certification Authority 285 // XRamp Global Certification Authority
286 { { { 0xb8, 0x01, 0x86, 0xd1, 0xeb, 0x9c, 0x86, 0xa5, 0x41, 0x04, 286 { { { 0xb8, 0x01, 0x86, 0xd1, 0xeb, 0x9c, 0x86, 0xa5, 0x41, 0x04,
287 0xcf, 0x30, 0x54, 0xf3, 0x4c, 0x52, 0xb7, 0xe5, 0x58, 0xc6 } }, 287 0xcf, 0x30, 0x54, 0xf3, 0x4c, 0x52, 0xb7, 0xe5, 0x58, 0xc6 } },
288 {"2.16.840.1.114404.1.1.2.4.1", NULL}, 288 {"2.16.840.1.114404.1.1.2.4.1", NULL},
289 } 289 },
290
291 // Testing CA - for unittesting only. Not a real CA.
292 { { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24,
293 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } },
294 {"1.3.6.1.4.1.11129.2.4.1"},
295 },
Ryan Sleevi 2012/03/09 22:07:54 Can we not do something like we do for TestRootCer
290 }; 296 };
291 297
292 #if defined(OS_WIN) 298 #if defined(OS_WIN)
293 // static 299 // static
294 const EVRootCAMetadata::PolicyOID EVRootCAMetadata::policy_oids_[] = { 300 const EVRootCAMetadata::PolicyOID EVRootCAMetadata::policy_oids_[] = {
295 // The OIDs must be sorted in ascending order. 301 // The OIDs must be sorted in ascending order.
296 "1.2.392.200091.100.721.1", 302 "1.2.392.200091.100.721.1",
297 "1.2.616.1.113527.2.5.1.1", 303 "1.2.616.1.113527.2.5.1.1",
304 "1.3.6.1.4.1.11129.2.4.1", // for unittests only. Not a real CA.
298 "1.3.6.1.4.1.14370.1.6", 305 "1.3.6.1.4.1.14370.1.6",
299 "1.3.6.1.4.1.14777.6.1.1", 306 "1.3.6.1.4.1.14777.6.1.1",
300 "1.3.6.1.4.1.14777.6.1.2", 307 "1.3.6.1.4.1.14777.6.1.2",
301 "1.3.6.1.4.1.22234.2.5.2.3.1", 308 "1.3.6.1.4.1.22234.2.5.2.3.1",
302 "1.3.6.1.4.1.23223.1.1.1", 309 "1.3.6.1.4.1.23223.1.1.1",
303 "1.3.6.1.4.1.34697.2.1", 310 "1.3.6.1.4.1.34697.2.1",
304 "1.3.6.1.4.1.34697.2.2", 311 "1.3.6.1.4.1.34697.2.2",
305 "1.3.6.1.4.1.34697.2.3", 312 "1.3.6.1.4.1.34697.2.3",
306 "1.3.6.1.4.1.34697.2.4", 313 "1.3.6.1.4.1.34697.2.4",
307 "1.3.6.1.4.1.4146.1.1", 314 "1.3.6.1.4.1.4146.1.1",
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 362 }
356 #else 363 #else
357 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { 364 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const {
358 for (size_t i = 0; i < policy_oids_.size(); ++i) { 365 for (size_t i = 0; i < policy_oids_.size(); ++i) {
359 if (PolicyOIDsAreEqual(policy_oid, policy_oids_[i])) 366 if (PolicyOIDsAreEqual(policy_oid, policy_oids_[i]))
360 return true; 367 return true;
361 } 368 }
362 return false; 369 return false;
363 } 370 }
364 #endif 371 #endif
365 372
Ryan Sleevi 2012/03/09 22:07:54 eg: bool EVRootCAMetadata::IsEVPolicyOID(PolicyOI
366 bool EVRootCAMetadata::HasEVPolicyOID(const SHA1Fingerprint& fingerprint, 373 bool EVRootCAMetadata::HasEVPolicyOID(const SHA1Fingerprint& fingerprint,
367 PolicyOID policy_oid) const { 374 PolicyOID policy_oid) const {
Ryan Sleevi 2012/03/09 22:07:54 eg: if (TestRootCerts::HasInstance() && TestRootC
368 std::vector<PolicyOID> ev_policy_oids; 375 std::vector<PolicyOID> ev_policy_oids;
369 if (!GetPolicyOIDsForCA(fingerprint, &ev_policy_oids)) 376 if (!GetPolicyOIDsForCA(fingerprint, &ev_policy_oids))
370 return false; 377 return false;
371 for (std::vector<PolicyOID>::const_iterator 378 for (std::vector<PolicyOID>::const_iterator
372 i = ev_policy_oids.begin(); i != ev_policy_oids.end(); ++i) { 379 i = ev_policy_oids.begin(); i != ev_policy_oids.end(); ++i) {
373 if (PolicyOIDsAreEqual(*i, policy_oid)) 380 if (PolicyOIDsAreEqual(*i, policy_oid))
374 return true; 381 return true;
375 } 382 }
376 return false; 383 return false;
377 } 384 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // static 449 // static
443 bool EVRootCAMetadata::PolicyOIDsAreEqual(PolicyOID a, PolicyOID b) { 450 bool EVRootCAMetadata::PolicyOIDsAreEqual(PolicyOID a, PolicyOID b) {
444 #if defined(USE_NSS) 451 #if defined(USE_NSS)
445 return a == b; 452 return a == b;
446 #else 453 #else
447 return !strcmp(a, b); 454 return !strcmp(a, b);
448 #endif 455 #endif
449 } 456 }
450 457
451 } // namespace net 458 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698