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

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, 6 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
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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 1066
1067 connection_tester_.reset(new ConnectionTester( 1067 connection_tester_.reset(new ConnectionTester(
1068 this, io_thread_->globals()->proxy_script_fetcher_context.get())); 1068 this, io_thread_->globals()->proxy_script_fetcher_context.get()));
1069 connection_tester_->RunAllTests(url); 1069 connection_tester_->RunAllTests(url);
1070 } 1070 }
1071 1071
1072 void SPKIHashesToString(const net::FingerprintVector& hashes, 1072 void SPKIHashesToString(const net::FingerprintVector& hashes,
1073 std::string* string) { 1073 std::string* string) {
1074 for (net::FingerprintVector::const_iterator 1074 for (net::FingerprintVector::const_iterator
1075 i = hashes.begin(); i != hashes.end(); ++i) { 1075 i = hashes.begin(); i != hashes.end(); ++i) {
1076 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data), 1076 std::string label;
1077 arraysize(i->data)); 1077 switch (i->tag) {
1078 case net::FINGERPRINT_SHA1:
1079 label = "sha1/";
1080 break;
1081 case net::FINGERPRINT_SHA256:
1082 label = "sha256/";
1083 break;
1084 default:
1085 LOG(WARNING) << "Skipping invalid fingerprint of unknown type "
1086 << i->tag;
1087 continue;
mmenke 2012/06/14 15:47:29 I'd suggest a NOTREACHED() and outputting a label
palmer 2012/06/14 18:56:43 Done.
1088 }
1089
1090 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data()),
1091 i->size());
1078 std::string encoded; 1092 std::string encoded;
1079 base::Base64Encode(hash_str, &encoded); 1093 base::Base64Encode(hash_str, &encoded);
1080 1094
1081 if (i != hashes.begin()) 1095 if (i != hashes.begin())
1082 *string += ","; 1096 *string += ",";
1083 *string += "sha1/" + encoded; 1097 *string += label + encoded;
1084 } 1098 }
1085 } 1099 }
1086 1100
1087 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery( 1101 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery(
1088 const ListValue* list) { 1102 const ListValue* list) {
1089 // |list| should be: [<domain to query>]. 1103 // |list| should be: [<domain to query>].
1090 std::string domain; 1104 std::string domain;
1091 CHECK(list->GetString(0, &domain)); 1105 CHECK(list->GetString(0, &domain));
1092 DictionaryValue* result = new(DictionaryValue); 1106 DictionaryValue* result = new(DictionaryValue);
1093 1107
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 net::TransportSecurityState::DomainState state; 1163 net::TransportSecurityState::DomainState state;
1150 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000); 1164 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000);
1151 state.include_subdomains = include_subdomains; 1165 state.include_subdomains = include_subdomains;
1152 if (!hashes_str.empty()) { 1166 if (!hashes_str.empty()) {
1153 std::vector<std::string> type_and_b64s; 1167 std::vector<std::string> type_and_b64s;
1154 base::SplitString(hashes_str, ',', &type_and_b64s); 1168 base::SplitString(hashes_str, ',', &type_and_b64s);
1155 for (std::vector<std::string>::const_iterator 1169 for (std::vector<std::string>::const_iterator
1156 i = type_and_b64s.begin(); i != type_and_b64s.end(); i++) { 1170 i = type_and_b64s.begin(); i != type_and_b64s.end(); i++) {
1157 std::string type_and_b64; 1171 std::string type_and_b64;
1158 RemoveChars(*i, " \t\r\n", &type_and_b64); 1172 RemoveChars(*i, " \t\r\n", &type_and_b64);
1159 net::SHA1Fingerprint hash; 1173 net::Fingerprint hash;
1160 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash)) 1174 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash))
1161 continue; 1175 continue;
1162 1176
1163 state.dynamic_spki_hashes.push_back(hash); 1177 state.dynamic_spki_hashes.push_back(hash);
1164 } 1178 }
1165 } 1179 }
1166 1180
1167 transport_security_state->EnableHost(domain, state); 1181 transport_security_state->EnableHost(domain, state);
1168 } 1182 }
1169 1183
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 } 1741 }
1728 1742
1729 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1743 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1730 : WebUIController(web_ui) { 1744 : WebUIController(web_ui) {
1731 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1745 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1732 1746
1733 // Set up the chrome://net-internals/ source. 1747 // Set up the chrome://net-internals/ source.
1734 Profile* profile = Profile::FromWebUI(web_ui); 1748 Profile* profile = Profile::FromWebUI(web_ui);
1735 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); 1749 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource());
1736 } 1750 }
OLDNEW
« no previous file with comments | « chrome/browser/net/transport_security_persister_unittest.cc ('k') | net/base/cert_verify_proc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698