summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/transport_security_persister.cc
diff options
context:
space:
mode:
authorunsafe@trevp.net <unsafe@trevp.net@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 22:07:33 +0000
committerunsafe@trevp.net <unsafe@trevp.net@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 22:07:33 +0000
commit6ed72be9850bc59df02b0ec19ce44cfabc805656 (patch)
tree9e278061bdcd61bec8b9a591780dd201a8ce2f65 /chrome/browser/net/transport_security_persister.cc
parent0807387aeac97df0e1140e7de2c5cfa99c968175 (diff)
downloadchromium_src-6ed72be9850bc59df02b0ec19ce44cfabc805656.zip
chromium_src-6ed72be9850bc59df02b0ec19ce44cfabc805656.tar.gz
chromium_src-6ed72be9850bc59df02b0ec19ce44cfabc805656.tar.bz2
This is the first in an intended sequence of CLs to refactor
TransportSecurityState, fix some book-keeping bugs, and hopefully add TACK. This sequence of CLs will be derived from the original, overly-large CL #11191005. This CL does a few things: - Adds a high-level API for processing HSTS/HPKP - Move the code for handling HSTS/HPKP headers out of transport_security_state - Move HashValue out of x509_cert_types - Addresses several HSTS/HPKP parsing bugs identified during review of the cleanup - Ignore unknown HSTS/HPKP directives - Ignore unknown hash algorithms - Handle overly-large (> int64) expirations without parsing issues - Reject invalid pins entered by users Review URL: https://chromiumcodereview.appspot.com/11274032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/transport_security_persister.cc')
-rw-r--r--chrome/browser/net/transport_security_persister.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/chrome/browser/net/transport_security_persister.cc b/chrome/browser/net/transport_security_persister.cc
index 7e80742..b288e21 100644
--- a/chrome/browser/net/transport_security_persister.cc
+++ b/chrome/browser/net/transport_security_persister.cc
@@ -29,16 +29,8 @@ namespace {
ListValue* SPKIHashesToListValue(const HashValueVector& hashes) {
ListValue* pins = new ListValue;
-
- for (HashValueVector::const_iterator i = hashes.begin();
- i != hashes.end(); ++i) {
- std::string hash_str(reinterpret_cast<const char*>(i->data()), i->size());
- std::string b64;
- if (base::Base64Encode(hash_str, &b64))
- pins->Append(new StringValue(TransportSecurityState::HashValueLabel(*i) +
- b64));
- }
-
+ for (size_t i = 0; i != hashes.size(); i++)
+ pins->Append(new StringValue(hashes[i].ToString()));
return pins;
}
@@ -48,7 +40,7 @@ void SPKIHashesFromListValue(const ListValue& pins, HashValueVector* hashes) {
std::string type_and_base64;
HashValue fingerprint;
if (pins.GetString(i, &type_and_base64) &&
- TransportSecurityState::ParsePin(type_and_base64, &fingerprint)) {
+ fingerprint.FromString(type_and_base64)) {
hashes->push_back(fingerprint);
}
}