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

Side by Side Diff: net/cert/ev_root_ca_metadata.h

Issue 1882433002: Removing NSS files and USE_OPENSSL flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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
« no previous file with comments | « net/cert/ct_objects_extractor_nss.cc ('k') | net/cert/ev_root_ca_metadata.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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_VERIFIER) 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 // A singleton. This class stores the meta data of the root CAs that issue 30 // A singleton. This class stores the meta data of the root CAs that issue
31 // extended-validation (EV) certificates. 31 // extended-validation (EV) certificates.
32 class NET_EXPORT_PRIVATE EVRootCAMetadata { 32 class NET_EXPORT_PRIVATE EVRootCAMetadata {
33 public: 33 public:
34 #if defined(USE_NSS_VERIFIER) 34 #if defined(USE_NSS_CERTS)
35 typedef SECOidTag PolicyOID; 35 typedef SECOidTag PolicyOID;
36 #elif defined(OS_WIN) 36 #elif defined(OS_WIN)
37 typedef const char* PolicyOID; 37 typedef const char* PolicyOID;
38 #endif 38 #endif
39 39
40 static EVRootCAMetadata* GetInstance(); 40 static EVRootCAMetadata* GetInstance();
41 41
42 #if defined(USE_NSS_VERIFIER) || defined(OS_WIN) 42 #if defined(USE_NSS_CERTS) || defined(OS_WIN)
43 // Returns true if policy_oid is an EV policy OID of some root CA. 43 // Returns true if policy_oid is an EV policy OID of some root CA.
44 bool IsEVPolicyOID(PolicyOID policy_oid) const; 44 bool IsEVPolicyOID(PolicyOID policy_oid) const;
45 45
46 // Returns true if the root CA with the given certificate fingerprint has 46 // Returns true if the root CA with the given certificate fingerprint has
47 // the EV policy OID policy_oid. 47 // the EV policy OID policy_oid.
48 bool HasEVPolicyOID(const SHA1HashValue& fingerprint, 48 bool HasEVPolicyOID(const SHA1HashValue& fingerprint,
49 PolicyOID policy_oid) const; 49 PolicyOID policy_oid) const;
50 #endif 50 #endif
51 51
52 // AddEVCA adds an EV CA to the list of known EV CAs with the given policy. 52 // AddEVCA adds an EV CA to the list of known EV CAs with the given policy.
53 // |policy| is expressed as a string of dotted numbers. It returns true on 53 // |policy| is expressed as a string of dotted numbers. It returns true on
54 // success. 54 // success.
55 bool AddEVCA(const SHA1HashValue& fingerprint, const char* policy); 55 bool AddEVCA(const SHA1HashValue& fingerprint, const char* policy);
56 56
57 // RemoveEVCA removes an EV CA that was previously added by AddEVCA. It 57 // RemoveEVCA removes an EV CA that was previously added by AddEVCA. It
58 // returns true on success. 58 // returns true on success.
59 bool RemoveEVCA(const SHA1HashValue& fingerprint); 59 bool RemoveEVCA(const SHA1HashValue& fingerprint);
60 60
61 private: 61 private:
62 friend struct base::DefaultLazyInstanceTraits<EVRootCAMetadata>; 62 friend struct base::DefaultLazyInstanceTraits<EVRootCAMetadata>;
63 63
64 EVRootCAMetadata(); 64 EVRootCAMetadata();
65 ~EVRootCAMetadata(); 65 ~EVRootCAMetadata();
66 66
67 #if defined(USE_NSS_VERIFIER) 67 #if defined(USE_NSS_CERTS)
68 typedef std::map<SHA1HashValue, std::vector<PolicyOID>, 68 typedef std::map<SHA1HashValue, std::vector<PolicyOID>,
69 SHA1HashValueLessThan> PolicyOIDMap; 69 SHA1HashValueLessThan> PolicyOIDMap;
70 70
71 // RegisterOID registers |policy|, a policy OID in dotted string form, and 71 // RegisterOID registers |policy|, a policy OID in dotted string form, and
72 // writes the memoized form to |*out|. It returns true on success. 72 // writes the memoized form to |*out|. It returns true on success.
73 static bool RegisterOID(const char* policy, PolicyOID* out); 73 static bool RegisterOID(const char* policy, PolicyOID* out);
74 74
75 PolicyOIDMap ev_policy_; 75 PolicyOIDMap ev_policy_;
76 std::set<PolicyOID> policy_oids_; 76 std::set<PolicyOID> policy_oids_;
77 #elif defined(OS_WIN) 77 #elif defined(OS_WIN)
78 typedef std::map<SHA1HashValue, std::string, 78 typedef std::map<SHA1HashValue, std::string,
79 SHA1HashValueLessThan> ExtraEVCAMap; 79 SHA1HashValueLessThan> ExtraEVCAMap;
80 80
81 // extra_cas_ contains any EV CA metadata that was added at runtime. 81 // extra_cas_ contains any EV CA metadata that was added at runtime.
82 ExtraEVCAMap extra_cas_; 82 ExtraEVCAMap extra_cas_;
83 #endif 83 #endif
84 84
85 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); 85 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata);
86 }; 86 };
87 87
88 } // namespace net 88 } // namespace net
89 89
90 #endif // NET_CERT_EV_ROOT_CA_METADATA_H_ 90 #endif // NET_CERT_EV_ROOT_CA_METADATA_H_
OLDNEW
« no previous file with comments | « net/cert/ct_objects_extractor_nss.cc ('k') | net/cert/ev_root_ca_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698