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

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2052363002: Enable public key pinning of local trust anchors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/cronet/android/cronet_url_request_context_adapter.h" 5 #include "components/cronet/android/cronet_url_request_context_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 628 }
629 629
630 // Iterate through PKP configuration for every host. 630 // Iterate through PKP configuration for every host.
631 for (const auto& pkp : config->pkp_list) { 631 for (const auto& pkp : config->pkp_list) {
632 // Add the host pinning. 632 // Add the host pinning.
633 context_->transport_security_state()->AddHPKP( 633 context_->transport_security_state()->AddHPKP(
634 pkp->host, pkp->expiration_date, pkp->include_subdomains, 634 pkp->host, pkp->expiration_date, pkp->include_subdomains,
635 pkp->pin_hashes, GURL::EmptyGURL()); 635 pkp->pin_hashes, GURL::EmptyGURL());
636 } 636 }
637 637
638 context_->transport_security_state()->EnableLocalTrustAnchorPinning(
Ryan Sleevi 2016/06/13 17:03:11 Naming: This C++ method name is not correct/consis
kapishnikov 2016/06/15 00:56:20 Done.
639 config->pin_local_trust_anchors);
640
638 JNIEnv* env = base::android::AttachCurrentThread(); 641 JNIEnv* env = base::android::AttachCurrentThread();
639 jcronet_url_request_context_.Reset(env, jcronet_url_request_context.obj()); 642 jcronet_url_request_context_.Reset(env, jcronet_url_request_context.obj());
640 Java_CronetUrlRequestContext_initNetworkThread( 643 Java_CronetUrlRequestContext_initNetworkThread(
641 env, jcronet_url_request_context.obj()); 644 env, jcronet_url_request_context.obj());
642 645
643 #if defined(DATA_REDUCTION_PROXY_SUPPORT) 646 #if defined(DATA_REDUCTION_PROXY_SUPPORT)
644 if (data_reduction_proxy_) 647 if (data_reduction_proxy_)
645 data_reduction_proxy_->Init(true, GetURLRequestContext()); 648 data_reduction_proxy_->Init(true, GetURLRequestContext());
646 #endif 649 #endif
647 is_context_initialized_ = true; 650 is_context_initialized_ = true;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 const JavaParamRef<jstring>& jquic_default_user_agent_id, 795 const JavaParamRef<jstring>& jquic_default_user_agent_id,
793 jboolean jhttp2_enabled, 796 jboolean jhttp2_enabled,
794 jboolean jsdch_enabled, 797 jboolean jsdch_enabled,
795 const JavaParamRef<jstring>& jdata_reduction_proxy_key, 798 const JavaParamRef<jstring>& jdata_reduction_proxy_key,
796 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy, 799 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy,
797 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy, 800 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy,
798 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url, 801 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url,
799 jboolean jdisable_cache, 802 jboolean jdisable_cache,
800 jint jhttp_cache_mode, 803 jint jhttp_cache_mode,
801 jlong jhttp_cache_max_size, 804 jlong jhttp_cache_max_size,
805 jboolean jpin_local_trust_anchors,
802 const JavaParamRef<jstring>& jexperimental_quic_connection_options, 806 const JavaParamRef<jstring>& jexperimental_quic_connection_options,
803 jlong jmock_cert_verifier) { 807 jlong jmock_cert_verifier) {
804 return reinterpret_cast<jlong>(new URLRequestContextConfig( 808 return reinterpret_cast<jlong>(new URLRequestContextConfig(
805 jquic_enabled, 809 jquic_enabled,
806 ConvertNullableJavaStringToUTF8(env, jquic_default_user_agent_id), 810 ConvertNullableJavaStringToUTF8(env, jquic_default_user_agent_id),
807 jhttp2_enabled, jsdch_enabled, 811 jhttp2_enabled, jsdch_enabled,
808 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode), 812 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode),
809 jhttp_cache_max_size, jdisable_cache, 813 jhttp_cache_max_size, jdisable_cache,
810 ConvertNullableJavaStringToUTF8(env, jstorage_path), 814 ConvertNullableJavaStringToUTF8(env, jstorage_path),
811 ConvertNullableJavaStringToUTF8(env, juser_agent), 815 ConvertNullableJavaStringToUTF8(env, juser_agent),
812 ConvertNullableJavaStringToUTF8(env, 816 ConvertNullableJavaStringToUTF8(env,
813 jexperimental_quic_connection_options), 817 jexperimental_quic_connection_options),
814 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_key), 818 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_key),
815 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_primary_proxy), 819 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_primary_proxy),
816 ConvertNullableJavaStringToUTF8(env, 820 ConvertNullableJavaStringToUTF8(env,
817 jdata_reduction_proxy_fallback_proxy), 821 jdata_reduction_proxy_fallback_proxy),
818 ConvertNullableJavaStringToUTF8( 822 ConvertNullableJavaStringToUTF8(
819 env, jdata_reduction_proxy_secure_proxy_check_url), 823 env, jdata_reduction_proxy_secure_proxy_check_url),
824 jpin_local_trust_anchors,
820 base::WrapUnique( 825 base::WrapUnique(
821 reinterpret_cast<net::CertVerifier*>(jmock_cert_verifier)))); 826 reinterpret_cast<net::CertVerifier*>(jmock_cert_verifier))));
822 } 827 }
823 828
824 // Add a QUIC hint to a URLRequestContextConfig. 829 // Add a QUIC hint to a URLRequestContextConfig.
825 static void AddQuicHint(JNIEnv* env, 830 static void AddQuicHint(JNIEnv* env,
826 const JavaParamRef<jclass>& jcaller, 831 const JavaParamRef<jclass>& jcaller,
827 jlong jurl_request_context_config, 832 jlong jurl_request_context_config,
828 const JavaParamRef<jstring>& jhost, 833 const JavaParamRef<jstring>& jhost,
829 jint jport, 834 jint jport,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 JNIEnv* env, 909 JNIEnv* env,
905 const JavaParamRef<jclass>& jcaller) { 910 const JavaParamRef<jclass>& jcaller) {
906 base::StatisticsRecorder::Initialize(); 911 base::StatisticsRecorder::Initialize();
907 std::vector<uint8_t> data; 912 std::vector<uint8_t> data;
908 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 913 if (!HistogramManager::GetInstance()->GetDeltas(&data))
909 return ScopedJavaLocalRef<jbyteArray>(); 914 return ScopedJavaLocalRef<jbyteArray>();
910 return base::android::ToJavaByteArray(env, &data[0], data.size()); 915 return base::android::ToJavaByteArray(env, &data[0], data.size());
911 } 916 }
912 917
913 } // namespace cronet 918 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698