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

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 10545166: Support SHA-256 in public key pins for HTTPS. (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 | « chrome/browser/net/transport_security_persister_unittest.cc ('k') | net/base/cert_test_util.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 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 // For example, turn "www.google.com" into "http://www.google.com". 1080 // For example, turn "www.google.com" into "http://www.google.com".
1081 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string())); 1081 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string()));
1082 1082
1083 connection_tester_.reset(new ConnectionTester( 1083 connection_tester_.reset(new ConnectionTester(
1084 this, 1084 this,
1085 io_thread_->globals()->proxy_script_fetcher_context.get(), 1085 io_thread_->globals()->proxy_script_fetcher_context.get(),
1086 net_log())); 1086 net_log()));
1087 connection_tester_->RunAllTests(url); 1087 connection_tester_->RunAllTests(url);
1088 } 1088 }
1089 1089
1090 void SPKIHashesToString(const net::FingerprintVector& hashes, 1090 void SPKIHashesToString(const net::HashValueVector& hashes,
1091 std::string* string) { 1091 std::string* string) {
1092 for (net::FingerprintVector::const_iterator 1092 for (net::HashValueVector::const_iterator
1093 i = hashes.begin(); i != hashes.end(); ++i) { 1093 i = hashes.begin(); i != hashes.end(); ++i) {
1094 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data), 1094 std::string label;
1095 arraysize(i->data)); 1095 switch (i->tag) {
1096 case net::HASH_VALUE_SHA1:
1097 label = "sha1/";
1098 break;
1099 case net::HASH_VALUE_SHA256:
1100 label = "sha256/";
1101 break;
1102 default:
1103 NOTREACHED();
1104 LOG(WARNING) << "Invalid fingerprint of unknown type " << i->tag;
1105 label = "unknown/";
1106 }
1107
1108 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data()),
1109 i->size());
1096 std::string encoded; 1110 std::string encoded;
1097 base::Base64Encode(hash_str, &encoded); 1111 base::Base64Encode(hash_str, &encoded);
1098 1112
1099 if (i != hashes.begin()) 1113 if (i != hashes.begin())
1100 *string += ","; 1114 *string += ",";
1101 *string += "sha1/" + encoded; 1115 *string += label + encoded;
1102 } 1116 }
1103 } 1117 }
1104 1118
1105 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery( 1119 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery(
1106 const ListValue* list) { 1120 const ListValue* list) {
1107 // |list| should be: [<domain to query>]. 1121 // |list| should be: [<domain to query>].
1108 std::string domain; 1122 std::string domain;
1109 CHECK(list->GetString(0, &domain)); 1123 CHECK(list->GetString(0, &domain));
1110 DictionaryValue* result = new(DictionaryValue); 1124 DictionaryValue* result = new(DictionaryValue);
1111 1125
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 net::TransportSecurityState::DomainState state; 1181 net::TransportSecurityState::DomainState state;
1168 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000); 1182 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000);
1169 state.include_subdomains = include_subdomains; 1183 state.include_subdomains = include_subdomains;
1170 if (!hashes_str.empty()) { 1184 if (!hashes_str.empty()) {
1171 std::vector<std::string> type_and_b64s; 1185 std::vector<std::string> type_and_b64s;
1172 base::SplitString(hashes_str, ',', &type_and_b64s); 1186 base::SplitString(hashes_str, ',', &type_and_b64s);
1173 for (std::vector<std::string>::const_iterator 1187 for (std::vector<std::string>::const_iterator
1174 i = type_and_b64s.begin(); i != type_and_b64s.end(); i++) { 1188 i = type_and_b64s.begin(); i != type_and_b64s.end(); i++) {
1175 std::string type_and_b64; 1189 std::string type_and_b64;
1176 RemoveChars(*i, " \t\r\n", &type_and_b64); 1190 RemoveChars(*i, " \t\r\n", &type_and_b64);
1177 net::SHA1Fingerprint hash; 1191 net::HashValue hash;
1178 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash)) 1192 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash))
1179 continue; 1193 continue;
1180 1194
1181 state.dynamic_spki_hashes.push_back(hash); 1195 state.dynamic_spki_hashes.push_back(hash);
1182 } 1196 }
1183 } 1197 }
1184 1198
1185 transport_security_state->EnableHost(domain, state); 1199 transport_security_state->EnableHost(domain, state);
1186 } 1200 }
1187 1201
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 } 1759 }
1746 1760
1747 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1761 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1748 : WebUIController(web_ui) { 1762 : WebUIController(web_ui) {
1749 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1763 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1750 1764
1751 // Set up the chrome://net-internals/ source. 1765 // Set up the chrome://net-internals/ source.
1752 Profile* profile = Profile::FromWebUI(web_ui); 1766 Profile* profile = Profile::FromWebUI(web_ui);
1753 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); 1767 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource());
1754 } 1768 }
OLDNEW
« no previous file with comments | « chrome/browser/net/transport_security_persister_unittest.cc ('k') | net/base/cert_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698