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

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

Issue 10836150: Revert 150375 - Implement SHA-256 fingerprint support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/base/cert_verify_result.cc ('k') | net/base/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_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 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(USE_NSS) 10 #if defined(USE_NSS)
11 #include <secoidt.h> 11 #include <secoidt.h>
12 #endif 12 #endif
13 13
14 #include <map> 14 #include <map>
15 #include <string>
16 #include <vector> 15 #include <vector>
17 16
18 #include "net/base/net_export.h" 17 #include "net/base/net_export.h"
19 #include "net/base/x509_certificate.h" 18 #include "net/base/x509_certificate.h"
20 19
21 namespace base { 20 namespace base {
22 template <typename T> 21 template <typename T>
23 struct DefaultLazyInstanceTraits; 22 struct DefaultLazyInstanceTraits;
24 } // namespace base 23 } // namespace base
25 24
26 namespace net { 25 namespace net {
27 26
28 // 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
29 // extended-validation (EV) certificates. 28 // extended-validation (EV) certificates.
30 class NET_EXPORT_PRIVATE EVRootCAMetadata { 29 class NET_EXPORT_PRIVATE EVRootCAMetadata {
31 public: 30 public:
32 #if defined(USE_NSS) 31 #if defined(USE_NSS)
33 typedef SECOidTag PolicyOID; 32 typedef SECOidTag PolicyOID;
34 #elif defined(OS_WIN) 33 #elif defined(OS_WIN)
35 typedef const char* PolicyOID; 34 typedef const char* PolicyOID;
36 #endif 35 #endif
37 36
38 static EVRootCAMetadata* GetInstance(); 37 static EVRootCAMetadata* GetInstance();
39 38
40 #if defined(USE_NSS) 39 #if defined(USE_NSS)
41 // If the root CA cert has an EV policy OID, returns true and appends the 40 // If the root CA cert has an EV policy OID, returns true and appends the
42 // policy OIDs to |*policy_oids|. Otherwise, returns false. 41 // policy OIDs to |*policy_oids|. Otherwise, returns false.
43 bool GetPolicyOIDsForCA(const SHA1HashValue& fingerprint, 42 bool GetPolicyOIDsForCA(const SHA1Fingerprint& fingerprint,
44 std::vector<PolicyOID>* policy_oids) const; 43 std::vector<PolicyOID>* policy_oids) const;
45 const PolicyOID* GetPolicyOIDs() const; 44 const PolicyOID* GetPolicyOIDs() const;
46 int NumPolicyOIDs() const; 45 int NumPolicyOIDs() const;
47 #elif defined(OS_WIN) 46 #elif defined(OS_WIN)
48 // Returns true if policy_oid is an EV policy OID of some root CA. 47 // Returns true if policy_oid is an EV policy OID of some root CA.
49 bool IsEVPolicyOID(PolicyOID policy_oid) const; 48 bool IsEVPolicyOID(PolicyOID policy_oid) const;
50 49
51 // Returns true if the root CA with the given certificate fingerprint has 50 // Returns true if the root CA with the given certificate fingerprint has
52 // the EV policy OID policy_oid. 51 // the EV policy OID policy_oid.
53 bool HasEVPolicyOID(const SHA1HashValue& fingerprint, 52 bool HasEVPolicyOID(const SHA1Fingerprint& fingerprint,
54 PolicyOID policy_oid) const; 53 PolicyOID policy_oid) const;
55 #endif 54 #endif
56 55
57 // AddEVCA adds an EV CA to the list of known EV CAs with the given policy. 56 // AddEVCA adds an EV CA to the list of known EV CAs with the given policy.
58 // |policy| is expressed as a string of dotted numbers. It returns true on 57 // |policy| is expressed as a string of dotted numbers. It returns true on
59 // success. 58 // success.
60 bool AddEVCA(const SHA1HashValue& fingerprint, const char* policy); 59 bool AddEVCA(const SHA1Fingerprint& fingerprint, const char* policy);
61 60
62 // RemoveEVCA removes an EV CA that was previously added by AddEVCA. It 61 // RemoveEVCA removes an EV CA that was previously added by AddEVCA. It
63 // returns true on success. 62 // returns true on success.
64 bool RemoveEVCA(const SHA1HashValue& fingerprint); 63 bool RemoveEVCA(const SHA1Fingerprint& fingerprint);
65 64
66 private: 65 private:
67 friend struct base::DefaultLazyInstanceTraits<EVRootCAMetadata>; 66 friend struct base::DefaultLazyInstanceTraits<EVRootCAMetadata>;
68 67
69 EVRootCAMetadata(); 68 EVRootCAMetadata();
70 ~EVRootCAMetadata(); 69 ~EVRootCAMetadata();
71 70
72 #if defined(USE_NSS) 71 #if defined(USE_NSS)
73 typedef std::map<SHA1HashValue, std::vector<PolicyOID>, 72 typedef std::map<SHA1Fingerprint, std::vector<PolicyOID>,
74 SHA1HashValueLessThan> PolicyOIDMap; 73 SHA1FingerprintLessThan> PolicyOIDMap;
75 74
76 // RegisterOID registers |policy|, a policy OID in dotted string form, and 75 // RegisterOID registers |policy|, a policy OID in dotted string form, and
77 // writes the memoized form to |*out|. It returns true on success. 76 // writes the memoized form to |*out|. It returns true on success.
78 static bool RegisterOID(const char* policy, PolicyOID* out); 77 static bool RegisterOID(const char* policy, PolicyOID* out);
79 78
80 PolicyOIDMap ev_policy_; 79 PolicyOIDMap ev_policy_;
81 std::vector<PolicyOID> policy_oids_; 80 std::vector<PolicyOID> policy_oids_;
82 #elif defined(OS_WIN) 81 #elif defined(OS_WIN)
83 typedef std::map<SHA1HashValue, std::string, 82 typedef std::map<SHA1Fingerprint, std::string,
84 SHA1HashValueLessThan> ExtraEVCAMap; 83 SHA1FingerprintLessThan> ExtraEVCAMap;
85 84
86 // extra_cas_ contains any EV CA metadata that was added at runtime. 85 // extra_cas_ contains any EV CA metadata that was added at runtime.
87 ExtraEVCAMap extra_cas_; 86 ExtraEVCAMap extra_cas_;
88 #endif 87 #endif
89 88
90 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); 89 DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata);
91 }; 90 };
92 91
93 } // namespace net 92 } // namespace net
94 93
95 #endif // NET_BASE_EV_ROOT_CA_METADATA_H_ 94 #endif // NET_BASE_EV_ROOT_CA_METADATA_H_
OLDNEW
« no previous file with comments | « net/base/cert_verify_result.cc ('k') | net/base/ev_root_ca_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698