Chromium Code Reviews| 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 } | |
|
Ryan Sleevi
2016/11/08 00:11:21
nit:
} // namespace der
(see line 26)
mattm
2016/11/08 23:06:25
Done.
| |
| 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 14 matching lines...) Expand all Loading... | |
| 67 #if defined(USE_NSS_CERTS) | 74 #if defined(USE_NSS_CERTS) |
| 68 typedef std::map<SHA1HashValue, std::vector<PolicyOID>, | 75 typedef std::map<SHA1HashValue, std::vector<PolicyOID>, |
| 69 SHA1HashValueLessThan> PolicyOIDMap; | 76 SHA1HashValueLessThan> PolicyOIDMap; |
| 70 | 77 |
| 71 // RegisterOID registers |policy|, a policy OID in dotted string form, and | 78 // RegisterOID registers |policy|, a policy OID in dotted string form, and |
| 72 // writes the memoized form to |*out|. It returns true on success. | 79 // writes the memoized form to |*out|. It returns true on success. |
| 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) |
|
Ryan Sleevi
2016/11/08 00:11:21
Why not just extend this to be
#elif defined(OS_WI
mattm
2016/11/08 23:06:25
Acknowledged.
| |
| 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::map<SHA1HashValue, std::string, SHA1HashValueLessThan> | |
| 92 ExtraEVCAMap; | |
| 93 | |
| 94 // extra_cas_ contains any EV CA metadata that was added at runtime. | |
| 95 ExtraEVCAMap extra_cas_; | |
| 83 #endif | 96 #endif |
| 84 | 97 |
| 85 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); | 98 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); |
| 86 }; | 99 }; |
| 87 | 100 |
| 88 } // namespace net | 101 } // namespace net |
| 89 | 102 |
| 90 #endif // NET_CERT_EV_ROOT_CA_METADATA_H_ | 103 #endif // NET_CERT_EV_ROOT_CA_METADATA_H_ |
| OLD | NEW |