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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 148283002: Certificate Transparency: Enhance the CT log flag for multiple logs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Using const reference Created 6 years, 10 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 | « no previous file | chrome/common/chrome_switches.cc » ('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/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 // Add built-in logs 556 // Add built-in logs
557 ct_verifier->AddLog(net::ct::CreateGooglePilotLogVerifier().Pass()); 557 ct_verifier->AddLog(net::ct::CreateGooglePilotLogVerifier().Pass());
558 ct_verifier->AddLog(net::ct::CreateGoogleAviatorLogVerifier().Pass()); 558 ct_verifier->AddLog(net::ct::CreateGoogleAviatorLogVerifier().Pass());
559 ct_verifier->AddLog(net::ct::CreateGoogleRocketeerLogVerifier().Pass()); 559 ct_verifier->AddLog(net::ct::CreateGoogleRocketeerLogVerifier().Pass());
560 560
561 // Add logs from command line 561 // Add logs from command line
562 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 562 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
563 std::string switch_value = command_line.GetSwitchValueASCII( 563 std::string switch_value = command_line.GetSwitchValueASCII(
564 switches::kCertificateTransparencyLog); 564 switches::kCertificateTransparencyLog);
565 size_t delim_pos = switch_value.find(":"); 565 std::vector<std::string> logs;
566 CHECK(delim_pos != std::string::npos) 566 base::SplitString(switch_value, ',', &logs);
567 << "CT log description not provided (switch format" 567 for (std::vector<std::string>::iterator it = logs.begin(); it != logs.end();
568 " is 'description:base64_key')"; 568 ++it) {
569 std::string log_description(switch_value.substr(0, delim_pos)); 569 const std::string& curr_log = *it;
570 std::string ct_public_key_data; 570 size_t delim_pos = curr_log.find(":");
571 CHECK(base::Base64Decode( 571 CHECK(delim_pos != std::string::npos)
572 switch_value.substr(delim_pos + 1), 572 << "CT log description not provided (switch format"
573 &ct_public_key_data)) << "Unable to decode CT public key."; 573 " is 'description:base64_key')";
574 scoped_ptr<net::CTLogVerifier> external_log_verifier( 574 std::string log_description(curr_log.substr(0, delim_pos));
575 net::CTLogVerifier::Create(ct_public_key_data, log_description)); 575 std::string ct_public_key_data;
576 CHECK(external_log_verifier) << "Unable to parse CT public key."; 576 CHECK(base::Base64Decode(curr_log.substr(delim_pos + 1),
577 ct_verifier->AddLog(external_log_verifier.Pass()); 577 &ct_public_key_data))
578 << "Unable to decode CT public key.";
579 scoped_ptr<net::CTLogVerifier> external_log_verifier(
580 net::CTLogVerifier::Create(ct_public_key_data, log_description));
581 CHECK(external_log_verifier) << "Unable to parse CT public key.";
582 VLOG(1) << "Adding log with description " << log_description;
583 ct_verifier->AddLog(external_log_verifier.Pass());
584 }
578 } 585 }
579 #else 586 #else
580 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 587 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
581 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " 588 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome "
582 "builds using OpenSSL."; 589 "builds using OpenSSL.";
583 } 590 }
584 #endif 591 #endif
585 globals_->ssl_config_service = GetSSLConfigService(); 592 globals_->ssl_config_service = GetSSLConfigService();
586 #if defined(OS_ANDROID) || defined(OS_IOS) 593 #if defined(OS_ANDROID) || defined(OS_IOS)
587 if (DataReductionProxySettings::IsDataReductionProxyAllowed()) { 594 if (DataReductionProxySettings::IsDataReductionProxyAllowed()) {
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 std::string version_flag = 1191 std::string version_flag =
1185 command_line.GetSwitchValueASCII(switches::kQuicVersion); 1192 command_line.GetSwitchValueASCII(switches::kQuicVersion);
1186 for (size_t i = 0; i < supported_versions.size(); ++i) { 1193 for (size_t i = 0; i < supported_versions.size(); ++i) {
1187 net::QuicVersion version = supported_versions[i]; 1194 net::QuicVersion version = supported_versions[i];
1188 if (net::QuicVersionToString(version) == version_flag) { 1195 if (net::QuicVersionToString(version) == version_flag) {
1189 return version; 1196 return version;
1190 } 1197 }
1191 } 1198 }
1192 return net::QUIC_VERSION_UNSUPPORTED; 1199 return net::QUIC_VERSION_UNSUPPORTED;
1193 } 1200 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698