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/io_thread.cc

Issue 1440643002: Certificate Transparency: Per-profile CT verification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing iOS compilation Created 5 years 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/profiles/profile_impl_io_data.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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 net::CertVerifyProc::CreateDefault())); 682 net::CertVerifyProc::CreateDefault()));
683 #endif 683 #endif
684 684
685 globals_->transport_security_state.reset(new net::TransportSecurityState()); 685 globals_->transport_security_state.reset(new net::TransportSecurityState());
686 686
687 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 687 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
688 // is fixed. 688 // is fixed.
689 tracked_objects::ScopedTracker tracking_profile8( 689 tracked_objects::ScopedTracker tracking_profile8(
690 FROM_HERE_WITH_EXPLICIT_FUNCTION( 690 FROM_HERE_WITH_EXPLICIT_FUNCTION(
691 "466432 IOThread::InitAsync::CreateLogVerifiers::Start")); 691 "466432 IOThread::InitAsync::CreateLogVerifiers::Start"));
692 std::vector<scoped_refptr<net::CTLogVerifier>> ct_logs( 692 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
693 net::ct::CreateLogVerifiersForKnownLogs()); 693 net::ct::CreateLogVerifiersForKnownLogs());
694 694
695 // Add logs from command line 695 // Add logs from command line
696 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 696 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
697 std::string switch_value = command_line.GetSwitchValueASCII( 697 std::string switch_value = command_line.GetSwitchValueASCII(
698 switches::kCertificateTransparencyLog); 698 switches::kCertificateTransparencyLog);
699 for (const base::StringPiece& curr_log : base::SplitStringPiece( 699 for (const base::StringPiece& curr_log : base::SplitStringPiece(
700 switch_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { 700 switch_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
701 std::vector<std::string> log_metadata = base::SplitString( 701 std::vector<std::string> log_metadata = base::SplitString(
702 curr_log, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 702 curr_log, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
703 CHECK_GE(log_metadata.size(), 3u) 703 CHECK_GE(log_metadata.size(), 3u)
704 << "CT log metadata missing: Switch format is " 704 << "CT log metadata missing: Switch format is "
705 << "'description:base64_key:url_without_schema'."; 705 << "'description:base64_key:url_without_schema'.";
706 std::string log_description(log_metadata[0]); 706 std::string log_description(log_metadata[0]);
707 std::string log_url(std::string("https://") + log_metadata[2]); 707 std::string log_url(std::string("https://") + log_metadata[2]);
708 std::string ct_public_key_data; 708 std::string ct_public_key_data;
709 CHECK(base::Base64Decode(log_metadata[1], &ct_public_key_data)) 709 CHECK(base::Base64Decode(log_metadata[1], &ct_public_key_data))
710 << "Unable to decode CT public key."; 710 << "Unable to decode CT public key.";
711 scoped_refptr<net::CTLogVerifier> external_log_verifier( 711 scoped_refptr<const net::CTLogVerifier> external_log_verifier(
712 net::CTLogVerifier::Create(ct_public_key_data, log_description, 712 net::CTLogVerifier::Create(ct_public_key_data, log_description,
713 log_url)); 713 log_url));
714 CHECK(external_log_verifier) << "Unable to parse CT public key."; 714 CHECK(external_log_verifier) << "Unable to parse CT public key.";
715 VLOG(1) << "Adding log with description " << log_description; 715 VLOG(1) << "Adding log with description " << log_description;
716 ct_logs.push_back(external_log_verifier); 716 ct_logs.push_back(external_log_verifier);
717 } 717 }
718 } 718 }
719 719
720 globals_->ct_logs.assign(ct_logs.begin(), ct_logs.end());
721
720 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 722 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
721 // is fixed. 723 // is fixed.
722 tracked_objects::ScopedTracker tracking_profile9( 724 tracked_objects::ScopedTracker tracking_profile9(
723 FROM_HERE_WITH_EXPLICIT_FUNCTION( 725 FROM_HERE_WITH_EXPLICIT_FUNCTION(
724 "466432 IOThread::InitAsync::CreateLogVerifiers::End")); 726 "466432 IOThread::InitAsync::CreateLogVerifiers::End"));
725 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 727 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
726 // is fixed. 728 // is fixed.
727 tracked_objects::ScopedTracker tracking_profile7( 729 tracked_objects::ScopedTracker tracking_profile7(
728 FROM_HERE_WITH_EXPLICIT_FUNCTION( 730 FROM_HERE_WITH_EXPLICIT_FUNCTION(
729 "466432 IOThread::InitAsync::CreateMultiLogVerifier")); 731 "466432 IOThread::InitAsync::CreateMultiLogVerifier"));
730 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier(); 732 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier();
731 globals_->cert_transparency_verifier.reset(ct_verifier); 733 globals_->cert_transparency_verifier.reset(ct_verifier);
732 // Add built-in logs 734 // Add built-in logs
733 ct_verifier->AddLogs(ct_logs); 735 ct_verifier->AddLogs(globals_->ct_logs);
734 736
735 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 737 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
736 // is fixed. 738 // is fixed.
737 tracked_objects::ScopedTracker tracking_profile10( 739 tracked_objects::ScopedTracker tracking_profile10(
738 FROM_HERE_WITH_EXPLICIT_FUNCTION( 740 FROM_HERE_WITH_EXPLICIT_FUNCTION(
739 "466432 IOThread::InitAsync::CertPolicyEnforcer")); 741 "466432 IOThread::InitAsync::CertPolicyEnforcer"));
740 net::CertPolicyEnforcer* policy_enforcer = new net::CertPolicyEnforcer; 742 net::CertPolicyEnforcer* policy_enforcer = new net::CertPolicyEnforcer;
741 globals_->cert_policy_enforcer.reset(policy_enforcer); 743 globals_->cert_policy_enforcer.reset(policy_enforcer);
742 744
743 globals_->ssl_config_service = GetSSLConfigService(); 745 globals_->ssl_config_service = GetSSLConfigService();
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); 1666 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass();
1665 1667
1666 context->set_job_factory( 1668 context->set_job_factory(
1667 globals->proxy_script_fetcher_url_request_job_factory.get()); 1669 globals->proxy_script_fetcher_url_request_job_factory.get());
1668 1670
1669 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1671 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1670 // system URLRequestContext too. There's no reason this should be tied to a 1672 // system URLRequestContext too. There's no reason this should be tied to a
1671 // profile. 1673 // profile.
1672 return context; 1674 return context;
1673 } 1675 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/profiles/profile_impl_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698