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

Unified Diff: chrome/browser/transport_security_persister.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/transport_security_state.h » ('j') | net/base/transport_security_state.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/transport_security_persister.h
===================================================================
--- chrome/browser/transport_security_persister.h (revision 126245)
+++ chrome/browser/transport_security_persister.h (working copy)
@@ -61,6 +61,53 @@
private:
class Loader;
+ // Serializes transport security |state| into |*output|. Returns true if
+ // all DomainStates were serialized correctly.
+ //
+ // The serialization format is JSON; the JSON represents a dictionary of
+ // host:DomainState pairs (host is a string). The DomainState is
+ // represented as a dictionary containing the following keys and value
+ // types (not all keys will always be present):
+ //
+ // "include_subdomains": true|false
+ // "created": double
+ // "expiry": double
+ // "dynamic_spki_hashes_expiry": double
+ // "mode": "always"|"never"
+ // legacy value synonyms "strict"|"pinning-only"
+ // legacy value "spdy-only" is unused and ignored
+ // "static_spki_hashes": list of strings
+ // legacy key synonym "preloaded_spki_hashes"
+ // "bad_static_spki_hashes": list of strings
+ // legacy key synonym "bad_preloaded_spki_hashes"
+ // "dynamic_spki_hashes": list of strings
+ //
+ // The keys are
+ // SHA256(net::TransportSecurityState::CanonicalizeHost(domain)). The
+ // reason for hashing them is so that the stored state does not trivially
+ // reveal a user's browsing history to an attacker reading the serialized
+ // state on disk.
+ bool Serialize(const net::TransportSecurityState::Iterator& state,
+ std::string* output) const;
+
+ // Populates |state| from the JSON string |serialized|. Returns true if
+ // all entries were parsed and deserialized correctly.
+ //
+ // Sets |*dirty| to true if the new state differs from the persisted
+ // state; false otherwise.
+ static bool Deserialize(const std::string& serialized,
+ bool* dirty,
+ net::TransportSecurityState* state);
+
+ // Clears any existing non-static entries, and then re-populates |state|
+ // by invoking |Deserialize|.
+ //
+ // Sets |*dirty| to true if the new state differs from the persisted
+ // state; false otherwise.
+ bool LoadEntries(const std::string& serialized,
+ bool* dirty,
+ net::TransportSecurityState* state);
+
void CompleteLoad(const std::string& state);
net::TransportSecurityState* transport_security_state_;
« no previous file with comments | « no previous file | net/base/transport_security_state.h » ('j') | net/base/transport_security_state.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698