OLD | NEW |
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/cert/ev_root_ca_metadata.h" | 5 #include "net/cert/ev_root_ca_metadata.h" |
6 | 6 |
7 #if defined(USE_NSS) || defined(OS_IOS) | 7 #if defined(USE_NSS) || defined(OS_IOS) |
8 #include <cert.h> | 8 #include <cert.h> |
9 #include <pkcs11n.h> | 9 #include <pkcs11n.h> |
10 #include <secerr.h> | 10 #include <secerr.h> |
11 #include <secoid.h> | 11 #include <secoid.h> |
12 #elif defined(OS_WIN) | 12 #elif defined(OS_WIN) |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #endif | 14 #endif |
15 | 15 |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #if defined(USE_NSS) || defined(OS_IOS) | 18 #if defined(USE_NSS) || defined(OS_IOS) |
19 #include "crypto/nss_util.h" | 19 #include "crypto/nss_util.h" |
20 #endif | 20 #endif |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 | 23 |
| 24 #if defined(USE_NSS) || defined(OS_IOS) || defined(OS_WIN) |
24 // Raw metadata. | 25 // Raw metadata. |
25 struct EVMetadata { | 26 struct EVMetadata { |
26 // kMaxOIDsPerCA is the number of OIDs that we can support per root CA. At | 27 // 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 // 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 // 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 // CA's policy OID under the cross-signing root. |
30 static const size_t kMaxOIDsPerCA = 2; | 31 static const size_t kMaxOIDsPerCA = 2; |
31 // This is the maximum length of an OID string (including the trailing NUL). | 32 // This is the maximum length of an OID string (including the trailing NUL). |
32 static const size_t kMaxOIDLength = 32; | 33 static const size_t kMaxOIDLength = 32; |
33 | 34 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 0x90, 0xa7, 0x40, 0x1a, 0x3c, 0xf4, 0x7d, 0x4f, 0xe8, 0xee } }, | 383 0x90, 0xa7, 0x40, 0x1a, 0x3c, 0xf4, 0x7d, 0x4f, 0xe8, 0xee } }, |
383 {"2.16.840.1.114171.500.9", ""}, | 384 {"2.16.840.1.114171.500.9", ""}, |
384 }, | 385 }, |
385 // XRamp Global Certification Authority | 386 // XRamp Global Certification Authority |
386 { { { 0xb8, 0x01, 0x86, 0xd1, 0xeb, 0x9c, 0x86, 0xa5, 0x41, 0x04, | 387 { { { 0xb8, 0x01, 0x86, 0xd1, 0xeb, 0x9c, 0x86, 0xa5, 0x41, 0x04, |
387 0xcf, 0x30, 0x54, 0xf3, 0x4c, 0x52, 0xb7, 0xe5, 0x58, 0xc6 } }, | 388 0xcf, 0x30, 0x54, 0xf3, 0x4c, 0x52, 0xb7, 0xe5, 0x58, 0xc6 } }, |
388 {"2.16.840.1.114404.1.1.2.4.1", ""}, | 389 {"2.16.840.1.114404.1.1.2.4.1", ""}, |
389 } | 390 } |
390 }; | 391 }; |
391 | 392 |
| 393 #endif // defined(USE_NSS) || defined(OS_IOS) || defined(OS_WIN) |
| 394 |
392 static base::LazyInstance<EVRootCAMetadata>::Leaky | 395 static base::LazyInstance<EVRootCAMetadata>::Leaky |
393 g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER; | 396 g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER; |
394 | 397 |
395 // static | 398 // static |
396 EVRootCAMetadata* EVRootCAMetadata::GetInstance() { | 399 EVRootCAMetadata* EVRootCAMetadata::GetInstance() { |
397 return g_ev_root_ca_metadata.Pointer(); | 400 return g_ev_root_ca_metadata.Pointer(); |
398 } | 401 } |
399 | 402 |
400 #if defined(USE_NSS) || defined(OS_IOS) | 403 #if defined(USE_NSS) || defined(OS_IOS) |
401 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { | 404 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 ev_policy_[metadata.fingerprint].push_back(policy); | 565 ev_policy_[metadata.fingerprint].push_back(policy); |
563 policy_oids_.insert(policy); | 566 policy_oids_.insert(policy); |
564 } | 567 } |
565 } | 568 } |
566 #endif | 569 #endif |
567 } | 570 } |
568 | 571 |
569 EVRootCAMetadata::~EVRootCAMetadata() { } | 572 EVRootCAMetadata::~EVRootCAMetadata() { } |
570 | 573 |
571 } // namespace net | 574 } // namespace net |
OLD | NEW |