| 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 #ifndef NET_CERT_EV_ROOT_CA_METADATA_H_ | 5 #ifndef NET_CERT_EV_ROOT_CA_METADATA_H_ |
| 6 #define NET_CERT_EV_ROOT_CA_METADATA_H_ | 6 #define NET_CERT_EV_ROOT_CA_METADATA_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(USE_NSS_CERTS) | 10 #if defined(USE_NSS_CERTS) |
| 11 #include <secoidt.h> | 11 #include <secoidt.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <set> | 15 #include <set> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 21 #include "net/cert/x509_certificate.h" | 21 #include "net/cert/x509_certificate.h" |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 template <typename T> | 24 template <typename T> |
| 25 struct DefaultLazyInstanceTraits; | 25 struct DefaultLazyInstanceTraits; |
| 26 } // namespace base | 26 } // namespace base |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 | 29 |
| 30 namespace der { |
| 31 class Input; |
| 32 } // namespace der |
| 33 |
| 30 // A singleton. This class stores the meta data of the root CAs that issue | 34 // A singleton. This class stores the meta data of the root CAs that issue |
| 31 // extended-validation (EV) certificates. | 35 // extended-validation (EV) certificates. |
| 32 class NET_EXPORT_PRIVATE EVRootCAMetadata { | 36 class NET_EXPORT_PRIVATE EVRootCAMetadata { |
| 33 public: | 37 public: |
| 34 #if defined(USE_NSS_CERTS) | 38 #if defined(USE_NSS_CERTS) |
| 35 typedef SECOidTag PolicyOID; | 39 typedef SECOidTag PolicyOID; |
| 36 #elif defined(OS_WIN) | 40 #elif defined(OS_WIN) |
| 37 typedef const char* PolicyOID; | 41 typedef const char* PolicyOID; |
| 42 #elif defined(OS_MACOSX) |
| 43 // DER-encoded OID value (no tag or length). |
| 44 typedef der::Input PolicyOID; |
| 38 #endif | 45 #endif |
| 39 | 46 |
| 40 static EVRootCAMetadata* GetInstance(); | 47 static EVRootCAMetadata* GetInstance(); |
| 41 | 48 |
| 42 #if defined(USE_NSS_CERTS) || defined(OS_WIN) | 49 #if defined(USE_NSS_CERTS) || defined(OS_WIN) || defined(OS_MACOSX) |
| 43 // Returns true if policy_oid is an EV policy OID of some root CA. | 50 // Returns true if policy_oid is an EV policy OID of some root CA. |
| 44 bool IsEVPolicyOID(PolicyOID policy_oid) const; | 51 bool IsEVPolicyOID(PolicyOID policy_oid) const; |
| 45 | 52 |
| 46 // Returns true if the root CA with the given certificate fingerprint has | 53 // Returns true if the root CA with the given certificate fingerprint has |
| 47 // the EV policy OID policy_oid. | 54 // the EV policy OID policy_oid. |
| 48 bool HasEVPolicyOID(const SHA1HashValue& fingerprint, | 55 bool HasEVPolicyOID(const SHA1HashValue& fingerprint, |
| 49 PolicyOID policy_oid) const; | 56 PolicyOID policy_oid) const; |
| 50 #endif | 57 #endif |
| 51 | 58 |
| 52 // AddEVCA adds an EV CA to the list of known EV CAs with the given policy. | 59 // AddEVCA adds an EV CA to the list of known EV CAs with the given policy. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 73 static bool RegisterOID(const char* policy, PolicyOID* out); | 80 static bool RegisterOID(const char* policy, PolicyOID* out); |
| 74 | 81 |
| 75 PolicyOIDMap ev_policy_; | 82 PolicyOIDMap ev_policy_; |
| 76 std::set<PolicyOID> policy_oids_; | 83 std::set<PolicyOID> policy_oids_; |
| 77 #elif defined(OS_WIN) | 84 #elif defined(OS_WIN) |
| 78 typedef std::map<SHA1HashValue, std::string, | 85 typedef std::map<SHA1HashValue, std::string, |
| 79 SHA1HashValueLessThan> ExtraEVCAMap; | 86 SHA1HashValueLessThan> ExtraEVCAMap; |
| 80 | 87 |
| 81 // extra_cas_ contains any EV CA metadata that was added at runtime. | 88 // extra_cas_ contains any EV CA metadata that was added at runtime. |
| 82 ExtraEVCAMap extra_cas_; | 89 ExtraEVCAMap extra_cas_; |
| 90 #elif defined(OS_MACOSX) |
| 91 typedef std:: |
| 92 map<SHA1HashValue, std::vector<std::string>, SHA1HashValueLessThan> |
| 93 PolicyOIDMap; |
| 94 |
| 95 PolicyOIDMap ev_policy_; |
| 96 std::set<std::string> policy_oids_; |
| 83 #endif | 97 #endif |
| 84 | 98 |
| 85 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); | 99 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); |
| 86 }; | 100 }; |
| 87 | 101 |
| 88 } // namespace net | 102 } // namespace net |
| 89 | 103 |
| 90 #endif // NET_CERT_EV_ROOT_CA_METADATA_H_ | 104 #endif // NET_CERT_EV_ROOT_CA_METADATA_H_ |
| OLD | NEW |