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

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: Amending comment Created 6 years, 11 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') | chrome/common/chrome_switches.cc » ('J')
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 size_t log_delim_pos = switch_value.find(";");
Lei Zhang 2014/01/27 19:46:06 Would it be slightly easier / readable to do this
Eran M. (Google) 2014/01/28 09:13:02 Done.
566 CHECK(delim_pos != std::string::npos) 566 while (!switch_value.empty()) {
567 std::string curr_log = switch_value.substr(0, log_delim_pos);
568 size_t delim_pos = curr_log.find(":");
569 CHECK(delim_pos != std::string::npos)
567 << "CT log description not provided (switch format" 570 << "CT log description not provided (switch format"
568 " is 'description:base64_key')"; 571 " is 'description:base64_key')";
569 std::string log_description(switch_value.substr(0, delim_pos)); 572 std::string log_description(curr_log.substr(0, delim_pos));
570 std::string ct_public_key_data; 573 std::string ct_public_key_data;
571 CHECK(base::Base64Decode( 574 CHECK(base::Base64Decode(
572 switch_value.substr(delim_pos + 1), 575 curr_log.substr(delim_pos + 1),
573 &ct_public_key_data)) << "Unable to decode CT public key."; 576 &ct_public_key_data)) << "Unable to decode CT public key.";
574 scoped_ptr<net::CTLogVerifier> external_log_verifier( 577 scoped_ptr<net::CTLogVerifier> external_log_verifier(
575 net::CTLogVerifier::Create(ct_public_key_data, log_description)); 578 net::CTLogVerifier::Create(ct_public_key_data, log_description));
576 CHECK(external_log_verifier) << "Unable to parse CT public key."; 579 CHECK(external_log_verifier) << "Unable to parse CT public key.";
577 ct_verifier->AddLog(external_log_verifier.Pass()); 580 VLOG(1) << "Adding log with description " << log_description;
581 ct_verifier->AddLog(external_log_verifier.Pass());
582
583 if (log_delim_pos == std::string::npos) {
584 switch_value = "";
585 } else {
586 switch_value = switch_value.substr(log_delim_pos + 1);
587 }
588 log_delim_pos = switch_value.find(";");
589 }
578 } 590 }
579 #else 591 #else
580 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 592 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
581 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " 593 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome "
582 "builds using OpenSSL."; 594 "builds using OpenSSL.";
583 } 595 }
584 #endif 596 #endif
585 globals_->ssl_config_service = GetSSLConfigService(); 597 globals_->ssl_config_service = GetSSLConfigService();
586 #if defined(OS_ANDROID) || defined(OS_IOS) 598 #if defined(OS_ANDROID) || defined(OS_IOS)
587 if (DataReductionProxySettings::IsDataReductionProxyAllowed()) { 599 if (DataReductionProxySettings::IsDataReductionProxyAllowed()) {
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 std::string version_flag = 1196 std::string version_flag =
1185 command_line.GetSwitchValueASCII(switches::kQuicVersion); 1197 command_line.GetSwitchValueASCII(switches::kQuicVersion);
1186 for (size_t i = 0; i < supported_versions.size(); ++i) { 1198 for (size_t i = 0; i < supported_versions.size(); ++i) {
1187 net::QuicVersion version = supported_versions[i]; 1199 net::QuicVersion version = supported_versions[i];
1188 if (net::QuicVersionToString(version) == version_flag) { 1200 if (net::QuicVersionToString(version) == version_flag) {
1189 return version; 1201 return version;
1190 } 1202 }
1191 } 1203 }
1192 return net::QUIC_VERSION_UNSUPPORTED; 1204 return net::QUIC_VERSION_UNSUPPORTED;
1193 } 1205 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.cc » ('j') | chrome/common/chrome_switches.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698