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

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

Issue 10826257: Implement SHA-256 fingerprint support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 <list> 7 #include <list>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 // For example, turn "www.google.com" into "http://www.google.com". 1075 // For example, turn "www.google.com" into "http://www.google.com".
1076 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string())); 1076 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string()));
1077 1077
1078 connection_tester_.reset(new ConnectionTester( 1078 connection_tester_.reset(new ConnectionTester(
1079 this, 1079 this,
1080 io_thread_->globals()->proxy_script_fetcher_context.get(), 1080 io_thread_->globals()->proxy_script_fetcher_context.get(),
1081 net_log())); 1081 net_log()));
1082 connection_tester_->RunAllTests(url); 1082 connection_tester_->RunAllTests(url);
1083 } 1083 }
1084 1084
1085 void SPKIHashesToString(const net::FingerprintVector& hashes, 1085 void SPKIHashesToString(const net::HashValueVector& hashes,
1086 std::string* string) { 1086 std::string* string) {
1087 for (net::FingerprintVector::const_iterator 1087 for (net::HashValueVector::const_iterator
1088 i = hashes.begin(); i != hashes.end(); ++i) { 1088 i = hashes.begin(); i != hashes.end(); ++i) {
1089 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data), 1089 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data()),
1090 arraysize(i->data)); 1090 i->size());
1091 std::string encoded; 1091 std::string encoded;
1092 base::Base64Encode(hash_str, &encoded); 1092 base::Base64Encode(hash_str, &encoded);
1093 1093
1094 if (i != hashes.begin()) 1094 if (i != hashes.begin())
1095 *string += ","; 1095 *string += ",";
1096 *string += "sha1/" + encoded; 1096 *string += net::TransportSecurityState::HashValueLabel(*i) + encoded;
1097 } 1097 }
1098 } 1098 }
1099 1099
1100 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery( 1100 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery(
1101 const ListValue* list) { 1101 const ListValue* list) {
1102 // |list| should be: [<domain to query>]. 1102 // |list| should be: [<domain to query>].
1103 std::string domain; 1103 std::string domain;
1104 CHECK(list->GetString(0, &domain)); 1104 CHECK(list->GetString(0, &domain));
1105 DictionaryValue* result = new DictionaryValue(); 1105 DictionaryValue* result = new DictionaryValue();
1106 1106
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 net::TransportSecurityState::DomainState state; 1162 net::TransportSecurityState::DomainState state;
1163 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000); 1163 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000);
1164 state.include_subdomains = include_subdomains; 1164 state.include_subdomains = include_subdomains;
1165 if (!hashes_str.empty()) { 1165 if (!hashes_str.empty()) {
1166 std::vector<std::string> type_and_b64s; 1166 std::vector<std::string> type_and_b64s;
1167 base::SplitString(hashes_str, ',', &type_and_b64s); 1167 base::SplitString(hashes_str, ',', &type_and_b64s);
1168 for (std::vector<std::string>::const_iterator 1168 for (std::vector<std::string>::const_iterator
1169 i = type_and_b64s.begin(); i != type_and_b64s.end(); ++i) { 1169 i = type_and_b64s.begin(); i != type_and_b64s.end(); ++i) {
1170 std::string type_and_b64; 1170 std::string type_and_b64;
1171 RemoveChars(*i, " \t\r\n", &type_and_b64); 1171 RemoveChars(*i, " \t\r\n", &type_and_b64);
1172 net::SHA1Fingerprint hash; 1172 net::HashValue hash;
1173 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash)) 1173 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash))
1174 continue; 1174 continue;
1175 1175
1176 state.dynamic_spki_hashes.push_back(hash); 1176 state.dynamic_spki_hashes.push_back(hash);
1177 } 1177 }
1178 } 1178 }
1179 1179
1180 transport_security_state->EnableHost(domain, state); 1180 transport_security_state->EnableHost(domain, state);
1181 } 1181 }
1182 1182
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 } 1741 }
1742 1742
1743 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1743 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1744 : WebUIController(web_ui) { 1744 : WebUIController(web_ui) {
1745 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1745 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1746 1746
1747 // Set up the chrome://net-internals/ source. 1747 // Set up the chrome://net-internals/ source.
1748 Profile* profile = Profile::FromWebUI(web_ui); 1748 Profile* profile = Profile::FromWebUI(web_ui);
1749 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); 1749 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource());
1750 } 1750 }
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