 Chromium Code Reviews
 Chromium Code Reviews Issue 2108833005:
  Adds domain names for all qualified CT logs  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2108833005:
  Adds domain names for all qualified CT logs  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 <utility> | 7 #include <utility> | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/base64.h" | 10 #include "base/base64.h" | 
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 #else | 532 #else | 
| 533 globals_->cert_verifier = net::CertVerifier::CreateDefault(); | 533 globals_->cert_verifier = net::CertVerifier::CreateDefault(); | 
| 534 #endif | 534 #endif | 
| 535 | 535 | 
| 536 globals_->transport_security_state.reset(new net::TransportSecurityState()); | 536 globals_->transport_security_state.reset(new net::TransportSecurityState()); | 
| 537 | 537 | 
| 538 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs( | 538 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs( | 
| 539 net::ct::CreateLogVerifiersForKnownLogs()); | 539 net::ct::CreateLogVerifiersForKnownLogs()); | 
| 540 | 540 | 
| 541 // Add logs from command line | 541 // Add logs from command line | 
| 542 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { | 542 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { | 
| 
Ryan Sleevi
2016/07/18 19:06:38
Do we still need this? What's it in use for?
If w
 
Rob Percival
2016/07/18 22:20:06
Eran and I have used this in the past for testing,
 
Eran Messeri
2016/07/21 15:03:51
I think the flag should remain, since it does come
 
Ryan Sleevi
2016/07/22 22:35:45
We should have this conversation elsewhere on a co
 | |
| 543 std::string switch_value = command_line.GetSwitchValueASCII( | 543 std::string switch_value = command_line.GetSwitchValueASCII( | 
| 544 switches::kCertificateTransparencyLog); | 544 switches::kCertificateTransparencyLog); | 
| 545 for (const base::StringPiece& curr_log : base::SplitStringPiece( | 545 for (const base::StringPiece& curr_log : base::SplitStringPiece( | 
| 546 switch_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | 546 switch_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | 
| 547 std::vector<std::string> log_metadata = base::SplitString( | 547 std::vector<std::string> log_metadata = base::SplitString( | 
| 548 curr_log, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 548 curr_log, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 
| 549 CHECK_GE(log_metadata.size(), 3u) | 549 CHECK_GE(log_metadata.size(), 3u) | 
| 550 << "CT log metadata missing: Switch format is " | 550 << "CT log metadata missing: Switch format is " | 
| 551 << "'description:base64_key:url_without_schema'."; | 551 << "'description:base64_key:url_without_schema[:dns_domain]'."; | 
| 552 std::string log_description(log_metadata[0]); | 552 std::string log_description(log_metadata[0]); | 
| 553 std::string log_url(std::string("https://") + log_metadata[2]); | 553 std::string log_url(std::string("https://") + log_metadata[2]); | 
| 554 std::string log_dns_domain; | |
| 555 if (log_metadata.size() >= 4) | |
| 556 log_dns_domain = log_metadata[3]; | |
| 554 std::string ct_public_key_data; | 557 std::string ct_public_key_data; | 
| 555 CHECK(base::Base64Decode(log_metadata[1], &ct_public_key_data)) | 558 CHECK(base::Base64Decode(log_metadata[1], &ct_public_key_data)) | 
| 556 << "Unable to decode CT public key."; | 559 << "Unable to decode CT public key."; | 
| 557 scoped_refptr<const net::CTLogVerifier> external_log_verifier( | 560 scoped_refptr<const net::CTLogVerifier> external_log_verifier( | 
| 558 net::CTLogVerifier::Create(ct_public_key_data, log_description, | 561 net::CTLogVerifier::Create(ct_public_key_data, log_description, | 
| 559 log_url)); | 562 log_url, log_dns_domain)); | 
| 560 CHECK(external_log_verifier) << "Unable to parse CT public key."; | 563 CHECK(external_log_verifier) << "Unable to parse CT public key."; | 
| 561 VLOG(1) << "Adding log with description " << log_description; | 564 VLOG(1) << "Adding log with description " << log_description; | 
| 562 ct_logs.push_back(external_log_verifier); | 565 ct_logs.push_back(external_log_verifier); | 
| 563 } | 566 } | 
| 564 } | 567 } | 
| 565 | 568 | 
| 566 globals_->ct_logs.assign(ct_logs.begin(), ct_logs.end()); | 569 globals_->ct_logs.assign(ct_logs.begin(), ct_logs.end()); | 
| 567 | 570 | 
| 568 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier(); | 571 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier(); | 
| 569 globals_->cert_transparency_verifier.reset(ct_verifier); | 572 globals_->cert_transparency_verifier.reset(ct_verifier); | 
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 989 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 992 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 
| 990 // system URLRequestContext too. There's no reason this should be tied to a | 993 // system URLRequestContext too. There's no reason this should be tied to a | 
| 991 // profile. | 994 // profile. | 
| 992 return context; | 995 return context; | 
| 993 } | 996 } | 
| 994 | 997 | 
| 995 const metrics::UpdateUsagePrefCallbackType& | 998 const metrics::UpdateUsagePrefCallbackType& | 
| 996 IOThread::GetMetricsDataUseForwarder() { | 999 IOThread::GetMetricsDataUseForwarder() { | 
| 997 return metrics_data_use_forwarder_; | 1000 return metrics_data_use_forwarder_; | 
| 998 } | 1001 } | 
| OLD | NEW |