OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_BASE_EV_ROOT_CA_METADATA_H_ | 5 #ifndef NET_BASE_EV_ROOT_CA_METADATA_H_ |
6 #define NET_BASE_EV_ROOT_CA_METADATA_H_ | 6 #define NET_BASE_EV_ROOT_CA_METADATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(USE_NSS) | 11 #if defined(USE_NSS) |
12 #include <secoidt.h> | 12 #include <secoidt.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "net/base/x509_certificate.h" | 18 #include "net/base/x509_certificate.h" |
19 | 19 |
| 20 namespace base { |
20 template <typename T> | 21 template <typename T> |
21 struct DefaultSingletonTraits; | 22 struct DefaultLazyInstanceTraits; |
| 23 } // namespace base |
22 | 24 |
23 namespace net { | 25 namespace net { |
24 | 26 |
25 // A singleton. This class stores the meta data of the root CAs that issue | 27 // A singleton. This class stores the meta data of the root CAs that issue |
26 // extended-validation (EV) certificates. | 28 // extended-validation (EV) certificates. |
27 class EVRootCAMetadata { | 29 class EVRootCAMetadata { |
28 public: | 30 public: |
29 #if defined(USE_NSS) | 31 #if defined(USE_NSS) |
30 typedef SECOidTag PolicyOID; | 32 typedef SECOidTag PolicyOID; |
31 #else | 33 #else |
(...skipping 16 matching lines...) Expand all Loading... |
48 | 50 |
49 // Returns true if policy_oid is an EV policy OID of some root CA. | 51 // Returns true if policy_oid is an EV policy OID of some root CA. |
50 bool IsEVPolicyOID(PolicyOID policy_oid) const; | 52 bool IsEVPolicyOID(PolicyOID policy_oid) const; |
51 | 53 |
52 // Returns true if the root CA with the given certificate fingerprint has | 54 // Returns true if the root CA with the given certificate fingerprint has |
53 // the EV policy OID policy_oid. | 55 // the EV policy OID policy_oid. |
54 bool HasEVPolicyOID(const SHA1Fingerprint& fingerprint, | 56 bool HasEVPolicyOID(const SHA1Fingerprint& fingerprint, |
55 PolicyOID policy_oid) const; | 57 PolicyOID policy_oid) const; |
56 | 58 |
57 private: | 59 private: |
58 friend struct DefaultSingletonTraits<EVRootCAMetadata>; | 60 friend struct base::DefaultLazyInstanceTraits<EVRootCAMetadata>; |
59 | 61 |
60 typedef std::map<SHA1Fingerprint, PolicyOID, | 62 typedef std::map<SHA1Fingerprint, PolicyOID, |
61 SHA1FingerprintLessThan> PolicyOidMap; | 63 SHA1FingerprintLessThan> PolicyOidMap; |
62 | 64 |
63 EVRootCAMetadata(); | 65 EVRootCAMetadata(); |
64 ~EVRootCAMetadata(); | 66 ~EVRootCAMetadata(); |
65 | 67 |
66 static bool PolicyOIDsAreEqual(PolicyOID a, PolicyOID b); | 68 static bool PolicyOIDsAreEqual(PolicyOID a, PolicyOID b); |
67 | 69 |
68 // Maps an EV root CA cert's SHA-1 fingerprint to its EV policy OID. | 70 // Maps an EV root CA cert's SHA-1 fingerprint to its EV policy OID. |
69 PolicyOidMap ev_policy_; | 71 PolicyOidMap ev_policy_; |
70 | 72 |
71 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
72 static const PolicyOID policy_oids_[]; | 74 static const PolicyOID policy_oids_[]; |
73 int num_policy_oids_; | 75 int num_policy_oids_; |
74 #else | 76 #else |
75 std::vector<PolicyOID> policy_oids_; | 77 std::vector<PolicyOID> policy_oids_; |
76 #endif | 78 #endif |
77 | 79 |
78 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); | 80 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace net | 83 } // namespace net |
82 | 84 |
83 #endif // NET_BASE_EV_ROOT_CA_METADATA_H_ | 85 #endif // NET_BASE_EV_ROOT_CA_METADATA_H_ |
OLD | NEW |