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

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

Issue 9415040: Refactor TransportSecurityState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « no previous file | net/base/x509_certificate.h » ('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_TRANSPORT_SECURITY_STATE_H_ 5 #ifndef NET_BASE_TRANSPORT_SECURITY_STATE_H_
6 #define NET_BASE_TRANSPORT_SECURITY_STATE_H_ 6 #define NET_BASE_TRANSPORT_SECURITY_STATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "net/base/net_export.h" 17 #include "net/base/net_export.h"
18 #include "net/base/x509_certificate.h" 18 #include "net/base/x509_certificate.h"
19 #include "net/base/x509_cert_types.h" 19 #include "net/base/x509_cert_types.h"
20 20
21 namespace net { 21 namespace net {
22 22
23 class SSLInfo; 23 class SSLInfo;
24 24
25 typedef std::vector<SHA1Fingerprint> FingerprintVector; 25 // In the future there will be a generic Fingerprint type, with at least two
26 // implementations: SHA1 and SHA256.
27 //
28 // TODO(palmer): Specify and implement that in net/base/x509_cert_types.h.
Ryan Sleevi 2012/03/07 06:02:46 File a bug, assign to you. Easier to track TODOs w
palmer 2012/03/13 20:13:39 Done.
29 //
30 // Until that work is done (in a separate patch) this typedef bridges the
31 // gap.
32 typedef SHA1Fingerprint Fingerprint;
26 33
27 // TransportSecurityState 34 typedef std::vector<Fingerprint> FingerprintVector;
35
36 // Tracks which hosts have enabled strict transport security and/or public
37 // key pins.
28 // 38 //
29 // Tracks which hosts have enabled *-Transport-Security. This object manages 39 // This object manages the in-memory store. Register a Delegate
30 // the in-memory store. A separate object must register itself with this object 40 // with |SetDelegate| to persist the state to disk.
31 // in order to persist the state to disk. 41 //
42 // HTTP strict transport security (HSTS) is defined in
43 // http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-04, and
44 // HTTP-based dynamic public key pinning (HPKP) is defined in
45 // http://tools.ietf.org/html/draft-ietf-websec-key-pinning-01.
32 class NET_EXPORT TransportSecurityState 46 class NET_EXPORT TransportSecurityState
33 : NON_EXPORTED_BASE(public base::NonThreadSafe) { 47 : NON_EXPORTED_BASE(public base::NonThreadSafe) {
34 public: 48 public:
35 // If non-empty, |hsts_hosts| is a JSON-formatted string to treat as if it 49 TransportSecurityState();
36 // were a built-in entry (same format as persisted metadata in the 50
37 // TransportSecurityState file).
38 explicit TransportSecurityState(const std::string& hsts_hosts);
39 ~TransportSecurityState(); 51 ~TransportSecurityState();
40 52
41 // A DomainState is the information that we persist about a given domain. 53 // A DomainState describes the transport security state (required upgrade
54 // to HTTPS, and/or any public key pins).
42 struct NET_EXPORT DomainState { 55 struct NET_EXPORT DomainState {
Ryan Sleevi 2012/03/07 06:02:46 I think you've reached the point where this should
palmer 2012/03/13 20:13:39 Done.
43 enum Mode { 56 enum UpgradeMode {
44 // Strict mode implies: 57 MODE_DEFAULT,
45 // * We generate internal redirects from HTTP -> HTTPS. 58 MODE_FORCE_HTTPS,
46 // * Certificate issues are fatal.
47 MODE_STRICT = 0,
48 // This used to be opportunistic HTTPS, but we removed support.
49 MODE_OPPORTUNISTIC_REMOVED = 1,
50 // SPDY_ONLY (aka X-Bodge-Transport-Security) is a hopefully temporary
51 // measure. It implies:
52 // * We'll request HTTP URLs over HTTPS iff we have SPDY support.
53 // * Certificate issues are fatal.
54 MODE_SPDY_ONLY = 2,
55 // Pinning means there are no HTTP -> HTTPS redirects, however certificate
56 // issues are still fatal and there may be public key pins.
57 MODE_PINNING_ONLY = 3,
58 }; 59 };
59 60
60 DomainState(); 61 DomainState();
61 ~DomainState(); 62 ~DomainState();
62 63
64 // Parses |value| as a Public-Key-Pins header. If successful, returns true
65 // and updates the |dynamic_spki_hashes| and |dynamic_spki_hashes_expiry|
66 // fields; otherwise, returns false without updating any fields.
67 bool ParsePinsHeader(const std::string& value, const SSLInfo& ssl_info);
68
69 // Parses |value| as a Strict-Transport-Security header. If successful,
70 // returns true and updates the |upgrade_mode|, |upgrade_expiry| and
71 // |include_subdomains| fields; otherwise, returns false without updating
72 // any fields.
73 bool ParseSTSHeader(const std::string& value);
74
63 // Takes a set of SubjectPublicKeyInfo |hashes| and returns true if: 75 // Takes a set of SubjectPublicKeyInfo |hashes| and returns true if:
64 // 1) |bad_preloaded_spki_hashes| does not intersect |hashes|; AND 76 // 1) |bad_static_spki_hashes| does not intersect |hashes|; AND
65 // 2) Both |preloaded_spki_hashes| and |dynamic_spki_hashes| are empty 77 // 2) Both |static_spki_hashes| and |dynamic_spki_hashes| are empty
66 // or at least one of them intersects |hashes|. 78 // or at least one of them intersects |hashes|.
67 // 79 //
68 // |{dynamic,preloaded}_spki_hashes| contain trustworthy public key 80 // |{dynamic,static}_spki_hashes| contain trustworthy public key hashes,
69 // hashes, any one of which is sufficient to validate the certificate 81 // any one of which is sufficient to validate the certificate chain in
70 // chain in question. The public keys could be of a root CA, intermediate 82 // question. The public keys could be of a root CA, intermediate CA, or
71 // CA, or leaf certificate, depending on the security vs. disaster 83 // leaf certificate, depending on the security vs. disaster recovery
72 // recovery tradeoff selected. (Pinning only to leaf certifiates increases 84 // tradeoff selected. (Pinning only to leaf certifiates increases
73 // security because you no longer trust any CAs, but it hampers disaster 85 // security because you no longer trust any CAs, but it hampers disaster
74 // recovery because you can't just get a new certificate signed by the 86 // recovery because you can't just get a new certificate signed by the
75 // CA.) 87 // CA.)
76 // 88 //
77 // |bad_preloaded_spki_hashes| contains public keys that we don't want to 89 // |bad_static_spki_hashes| contains public keys that we don't want to
78 // trust. 90 // trust.
79 bool IsChainOfPublicKeysPermitted(const FingerprintVector& hashes); 91 bool IsChainOfPublicKeysPermitted(const FingerprintVector& hashes) const;
80 92
81 // Returns true if |this| describes a more strict policy than |other|. 93 // Returns true if any of the FingerprintVectors |static_spki_hashes|,
82 // Used to see if a dynamic DomainState should override a preloaded one. 94 // |bad_static_spki_hashes|, or |dynamic_spki_hashes| contains any
83 bool IsMoreStrict(const DomainState& other); 95 // items.
96 bool HasPins() const;
84 97
85 // ShouldRedirectHTTPToHTTPS returns true iff, given the |mode| of this 98 // ShouldRedirectHTTPToHTTPS returns true iff, given the |mode| of this
86 // DomainState, HTTP requests should be internally redirected to HTTPS. 99 // DomainState, HTTP requests should be internally redirected to HTTPS.
87 bool ShouldRedirectHTTPToHTTPS() const; 100 bool ShouldRedirectHTTPToHTTPS() const;
88 101
89 Mode mode; 102 UpgradeMode upgrade_mode;
90 base::Time created; // when this host entry was first created
91 base::Time expiry; // the absolute time (UTC) when this record expires
92 bool include_subdomains; // subdomains included?
93 103
94 // Optional; hashes of preloaded "pinned" SubjectPublicKeyInfos. Unless 104 // The absolute time (UTC) when this DomainState was first created.
95 // both are empty, at least one of |preloaded_spki_hashes| and 105 //
106 // Static entries do not have a created time.
107 base::Time created;
108
109 // The absolute time (UTC) when the |upgrade_mode|, if set to
110 // UPGRADE_ALWAYS, downgrades to UPGRADE_NEVER.
111 base::Time upgrade_expiry;
112
113 // Are subdomains subject to this DomainState?
114 //
115 // TODO(palmer): Decide if we should have separate |pin_subdomains| and
116 // |upgrade_subdomains|. Alternately, and perhaps better, is to separate
117 // DomainState into UpgradeState and PinState (requiring also changing the
118 // serialization format?).
119 bool include_subdomains;
120
121 // Optional; hashes of static pinned SubjectPublicKeyInfos. Unless both
122 // are empty, at least one of |static_spki_hashes| and
96 // |dynamic_spki_hashes| MUST intersect with the set of SPKIs in the TLS 123 // |dynamic_spki_hashes| MUST intersect with the set of SPKIs in the TLS
97 // server's certificate chain. 124 // server's certificate chain.
98 // 125 //
99 // |dynamic_spki_hashes| take precedence over |preloaded_spki_hashes|. 126 // |dynamic_spki_hashes| take precedence over |static_spki_hashes|.
100 // That is, when performing pin validation, first check dynamic and then 127 // That is, |IsChainOfPublicKeysPermitted| first checks dynamic pins and
101 // check preloaded. 128 // then checks static pins.
102 FingerprintVector preloaded_spki_hashes; 129 FingerprintVector static_spki_hashes;
103 130
104 // Optional; hashes of dynamically pinned SubjectPublicKeyInfos. (They 131 // Optional; hashes of dynamically pinned SubjectPublicKeyInfos.
105 // could be set e.g. by an HTTP header or by a superfluous certificate.)
106 FingerprintVector dynamic_spki_hashes; 132 FingerprintVector dynamic_spki_hashes;
107 133
108 // The absolute time (UTC) when the |dynamic_spki_hashes| expire. 134 // The absolute time (UTC) when the |dynamic_spki_hashes| expire.
109 base::Time dynamic_spki_hashes_expiry; 135 base::Time dynamic_spki_hashes_expiry;
110 136
111 // The max-age directive of the Public-Key-Pins header as parsed. Do not 137 // Optional; hashes of static known-bad SubjectPublicKeyInfos which
112 // persist this; it is only for testing. TODO(palmer): Therefore, get rid
113 // of it and find a better way to test.
114 int max_age;
115
116 // Optional; hashes of preloaded known-bad SubjectPublicKeyInfos which
117 // MUST NOT intersect with the set of SPKIs in the TLS server's 138 // MUST NOT intersect with the set of SPKIs in the TLS server's
118 // certificate chain. 139 // certificate chain.
119 FingerprintVector bad_preloaded_spki_hashes; 140 FingerprintVector bad_static_spki_hashes;
120 141
121 // The following members are not valid when stored in |enabled_hosts_|. 142 // The following members are not valid when stored in |enabled_hosts_|:
122 bool preloaded; // is this a preloaded entry? 143
123 std::string domain; // the domain which matched 144 // The domain which matched during a search for this DomainState entry.
145 // Updated by |GetDomainState| and |GetStaticDomainState|.
146 std::string domain;
124 }; 147 };
125 148
126 class Delegate { 149 class Delegate {
127 public: 150 public:
128 // This function may not block and may be called with internal locks held. 151 // This function may not block and may be called with internal locks held.
129 // Thus it must not reenter the TransportSecurityState object. 152 // Thus it must not reenter the TransportSecurityState object.
130 virtual void StateIsDirty(TransportSecurityState* state) = 0; 153 virtual void StateIsDirty(TransportSecurityState* state) = 0;
131 154
132 protected: 155 protected:
133 virtual ~Delegate() {} 156 virtual ~Delegate() {}
134 }; 157 };
135 158
136 void SetDelegate(Delegate* delegate); 159 void SetDelegate(Delegate* delegate);
137 160
138 // Enable TransportSecurity for |host|. 161 // Enable TransportSecurity for |host|. |state| supercedes any previous
162 // state for the |host|, including static entries.
163 //
164 // The new state for |host| is persisted using the Delegate
Ryan Sleevi 2012/03/07 06:02:46 nit: Line wrapping
palmer 2012/03/13 20:13:39 Done.
165 // (if any).
139 void EnableHost(const std::string& host, const DomainState& state); 166 void EnableHost(const std::string& host, const DomainState& state);
140 167
141 // Delete any entry for |host|. If |host| doesn't have an exact entry then no 168 // Delete any entry for |host|. If |host| doesn't have an exact entry then
142 // action is taken. Returns true iff an entry was deleted. 169 // no action is taken. Does not delete static entries. Returns true iff an
170 // entry was deleted.
171 //
172 // The new state for |host| is persisted using the Delegate
Ryan Sleevi 2012/03/07 06:02:46 nit: Line wrapping
palmer 2012/03/13 20:13:39 Done.
173 // (if any).
143 bool DeleteHost(const std::string& host); 174 bool DeleteHost(const std::string& host);
144 175
145 // Returns true if |host| has TransportSecurity enabled. Before operating
146 // on this result, consult |result->mode|, as the expected behavior of
147 // TransportSecurity can significantly differ based on mode.
148 //
149 // If |sni_available| is true, searches the preloads defined for SNI-using
150 // hosts as well as the usual preload list.
151 //
152 // Note that |*result| is always overwritten on every call.
153 // TODO(palmer): Only update |*result| on success.
154 bool GetDomainState(DomainState* result,
155 const std::string& host,
156 bool sni_available);
157
158 // Returns true if there are any certificates pinned for |host|.
159 // If so, updates the |preloaded_spki_hashes|, |dynamic_spki_hashes|, and
160 // |bad_preloaded_spki_hashes| fields of |*result| with the pins.
161 //
162 // Note that |*result| is always overwritten on every call, regardless of
163 // whether or not pins are enabled.
164 //
165 // If |sni_available| is true, searches the preloads defined for SNI-using
166 // hosts as well as the usual preload list.
167 //
168 // TODO(palmer): Only update |*result| if pins exist.
169 bool HasPinsForHost(DomainState* result,
170 const std::string& host,
171 bool sni_available);
172
173 // Returns true and updates |*result| if there is any |DomainState|
174 // metadata for |host| in the local TransportSecurityState database;
175 // returns false otherwise. TODO(palmer): Unlike the other
176 // TransportSecurityState lookup functions in this class (e.g
177 // |HasPinsForHost|, |GetDomainState|), |*result| is updated iff metadata
178 // is found. The other functions are buggy and will be fixed to behave
179 // like this one.
180 //
181 // If |sni_available| is true, searches the preloads defined for SNI-using
182 // hosts as well as the usual preload list.
183 bool HasMetadata(DomainState* result,
184 const std::string& host,
185 bool sni_available);
186
187 // Returns true if we have a preloaded certificate pin for the |host| and if
188 // its set of required certificates is the set we expect for Google
189 // properties.
190 //
191 // If |sni_available| is true, searches the preloads defined for SNI-using
192 // hosts as well as the usual preload list.
193 //
194 // Note that like HasMetadata, if |host| matches both an exact entry and is a
195 // subdomain of another entry, the exact match determines the return value.
196 static bool IsGooglePinnedProperty(const std::string& host,
197 bool sni_available);
198
199 // Reports UMA statistics upon public key pin failure. Reports only down to
200 // the second-level domain of |host| (e.g. google.com if |host| is
201 // mail.google.com), and only if |host| is a preloaded STS host.
202 static void ReportUMAOnPinFailure(const std::string& host);
203
204 // Parses |cert|'s Subject Public Key Info structure, hashes it, and writes
205 // the hash into |spki_hash|. Returns true on parse success, false on
206 // failure.
207 static bool GetPublicKeyHash(const X509Certificate& cert,
208 SHA1Fingerprint* spki_hash);
209
210 // Decodes a pin string |value| (e.g. "sha1/hvfkN/qlp/zhXR3cuerq6jd2Z7g=")
211 // and populates |out|.
212 static bool ParsePin(const std::string& value, SHA1Fingerprint* out);
213
214 // Deletes all records created since a given time. 176 // Deletes all records created since a given time.
215 void DeleteSince(const base::Time& time); 177 void DeleteSince(const base::Time& time);
216 178
217 // Parses |value| as a Public-Key-Pins header. If successful, returns |true| 179 // Returns true and updates |*result| iff there is a DomainState for
218 // and updates the |dynamic_spki_hashes| and |dynamic_spki_hashes_expiry| 180 // |host|.
219 // fields of |*state|; otherwise, returns |false| without updating |*state|. 181 //
220 static bool ParsePinsHeader(const std::string& value, 182 // If |sni_enabled| is true, searches the static pins defined for
221 const SSLInfo& ssl_info, 183 // SNI-using hosts as well as the rest of the pins.
222 DomainState* state); 184 //
185 // If |host| matches both an exact entry and is a subdomain of another
186 // entry, the exact match determines the return value.
187 bool GetDomainState(DomainState* result,
Ryan Sleevi 2012/03/07 06:02:46 Per http://google-styleguide.googlecode.com/svn/tr
palmer 2012/03/13 20:13:39 Done.
188 const std::string& host,
189 bool sni_enabled) const;
223 190
224 // Returns |true| if |value| parses as a valid *-Transport-Security 191 // Returns true and updates |*result| iff there is a static DomainState for
225 // header value. The values of max-age and and includeSubDomains are 192 // |host|.
226 // returned in |max_age| and |include_subdomains|, respectively. The out 193 //
227 // parameters are not modified if the function returns |false|. 194 // |GetStaticDomainState| is identical to |GetDomainState| except that it
228 static bool ParseHeader(const std::string& value, 195 // searches only the statically-defined transport security state, ignoring
229 int* max_age, 196 // all dynamically-added DomainStates.
230 bool* include_subdomains); 197 //
198 // If |sni_enabled| is true, searches the static pins defined for
199 // SNI-using hosts as well as the rest of the pins.
200 //
201 // If |host| matches both an exact entry and is a subdomain of another
202 // entry, the exact match determines the return value.
203 bool GetStaticDomainState(DomainState* result,
204 const std::string& host,
205 bool sni_enabled) const;
231 206
232 // ParseSidePin attempts to parse a side pin from |side_info| which signs the 207 // Serializes the transport security state (the set of DomainStates
233 // SubjectPublicKeyInfo in |leaf_spki|. A side pin is a way for a site to 208 // for all hosts) into |*output|. Returns true if all DomainStates were
234 // sign their public key with a key that is offline but still controlled by 209 // serialized correctly.
235 // them. If successful, the hash of the public key used to sign |leaf_spki| 210 //
236 // is put into |out_pub_key_hash|. 211 // The serialization format is JSON; the JSON represents a dictionary of
212 // host:DomainState pairs (host is a string). The DomainState is
213 // represented as a dictionary containing the following keys and value
214 // types (not all keys will always be present):
215 //
216 // "include_subdomains": true|false
217 // "created": double
218 // "expiry": double
219 // "dynamic_spki_hashes_expiry": double
220 // "mode": "always"|"never"
221 // legacy value synonyms "strict"|"pinning-only"
222 // legacy value "spdy-only" is unused and ignored
223 // "static_spki_hashes": list of strings
224 // legacy key synonym "preloaded_spki_hashes"
225 // "bad_static_spki_hashes": list of strings
226 // legacy key synonym "bad_preloaded_spki_hashes"
227 // "dynamic_spki_hashes": list of strings
228 //
229 // The keys are SHA256(CanonicalizeHost(domain)). The reason for hashing
230 // them is so that the stored state does not trivially reveal a user's
231 // browing history to an attacker reading the serialized state on disk.
232 bool Serialize(std::string* output) const;
233
234 // Clears any existing non-static entries, and then re-populates the
235 // transport security state from the JSON string |state|. Returns true if
236 // all entries were parsed and deserialized correctly.
237 //
238 // Sets |*dirty| to true if the new state differs from the persisted
239 // state; false otherwise.
240 bool LoadEntries(const std::string& state, bool* dirty);
241
242 // Returns true iff we have any static public key pins for the |host| and
243 // iff its set of required pins is the set we expect for Google
244 // properties.
245 //
246 // If |sni_enabled| is true, searches the static pins defined for
247 // SNI-using hosts as well as the rest of the pins.
248 //
249 // If |host| matches both an exact entry and is a subdomain of another
250 // entry, the exact match determines the return value.
251 static bool IsGooglePinnedProperty(const std::string& host,
252 bool sni_enabled);
253
254 // Decodes a pin string |value| (e.g. "sha1/hvfkN/qlp/zhXR3cuerq6jd2Z7g=").
255 // If parsing succeeded, updates |*out| and returns true; otherwise returns
256 // false without updating |*out|.
257 static bool ParsePin(const std::string& value, Fingerprint* out);
258
259 // The maximum number of seconds for which we'll cache an HSTS request.
260 static const long int kMaxHSTSAgeSecs;
261
262 // Parses |side_info| as a side pin. If
263 // successful, returns true and appends the hash of the public key that signed
Ryan Sleevi 2012/03/07 06:02:46 nit: Line wrapping.
palmer 2012/03/13 20:13:39 Done.
264 // |leaf_spki| to |*out_pub_key_hash|.
265 //
266 // A side pin is a way for a site to sign their public key with a key that is
267 // offline but still controlled by them.
268 //
269 // TODO(agl): Document the format of a side pin.
237 static bool ParseSidePin(const base::StringPiece& leaf_spki, 270 static bool ParseSidePin(const base::StringPiece& leaf_spki,
238 const base::StringPiece& side_info, 271 const base::StringPiece& side_info,
239 FingerprintVector* out_pub_key_hash); 272 FingerprintVector* out_pub_key_hash);
240 273
241 bool Serialise(std::string* output); 274 private:
242 // Existing non-preloaded entries are cleared and repopulated from the 275 // Converts |hostname| from dotted form ("www.google.com") to the form
243 // passed JSON string. 276 // used in DNS: "\x03www\x06google\x03com", lowercases that, and returns
244 bool LoadEntries(const std::string& state, bool* dirty); 277 // the result.
278 static std::string CanonicalizeHost(const std::string& hostname);
245 279
246 // The maximum number of seconds for which we'll cache an HSTS request. 280 // If we have a Delegate, call its |StateIsDirty| function.
247 static const long int kMaxHSTSAgeSecs; 281 void DirtyNotify();
248 282
249 private: 283 static bool Deserialize(const std::string& state,
250 FRIEND_TEST_ALL_PREFIXES(TransportSecurityStateTest, IsPreloaded);
251
252 // If we have a callback configured, call it to let our serialiser know that
253 // our state is dirty.
254 void DirtyNotify();
255 bool IsPreloadedSTS(const std::string& canonicalized_host,
256 bool sni_available,
257 DomainState* out);
258
259 static std::string CanonicalizeHost(const std::string& host);
260 static bool Deserialise(const std::string& state,
261 bool* dirty, 284 bool* dirty,
262 std::map<std::string, DomainState>* out); 285 std::map<std::string, DomainState>* out);
263 286
264 // The set of hosts that have enabled TransportSecurity. The keys here 287 // The set of hosts that have enabled TransportSecurity.
265 // are SHA256(DNSForm(domain)) where DNSForm converts from dotted form
266 // ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com"
267 std::map<std::string, DomainState> enabled_hosts_; 288 std::map<std::string, DomainState> enabled_hosts_;
268 289
269 // These hosts are extra rules to treat as built-in, passed in the 290 // Extra entries, provided by the user at run-time, to treat as if they
270 // constructor (typically originating from the command line). 291 // were static.
271 std::map<std::string, DomainState> forced_hosts_; 292 std::map<std::string, DomainState> forced_hosts_;
272 293
273 // Our delegate who gets notified when we are dirtied, or NULL.
274 Delegate* delegate_; 294 Delegate* delegate_;
275 295
276 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); 296 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState);
277 }; 297 };
278 298
299 // Parse |json| (in the format documented in
300 // |TransportSecurityState::Serialize|) and update |state| with the state
301 // entries. Returns true if all records in |json| were correctly parsed.
302 bool ParseJSONSecurityState(const std::string& json,
303 TransportSecurityState* state);
304
279 } // namespace net 305 } // namespace net
280 306
281 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ 307 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/x509_certificate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698