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

Unified Diff: components/cronet/android/test/mock_cert_verifier.cc

Issue 2052363002: Enable public key pinning of local trust anchors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed CronetPerfTestActivity test 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/test/mock_cert_verifier.cc
diff --git a/components/cronet/android/test/mock_cert_verifier.cc b/components/cronet/android/test/mock_cert_verifier.cc
index e2e190ff7af81c2e9f800a0c52dd976e12846de7..588f340e35a273e5052e0ea4fc62dd6c4dcfec4f 100644
--- a/components/cronet/android/test/mock_cert_verifier.cc
+++ b/components/cronet/android/test/mock_cert_verifier.cc
@@ -55,6 +55,7 @@ static jlong CreateMockCertVerifier(
JNIEnv* env,
const JavaParamRef<jclass>& jcaller,
const JavaParamRef<jobjectArray>& jcerts,
+ const jboolean jknown_root,
const JavaParamRef<jstring>& jtest_data_dir) {
base::FilePath test_data_dir(
base::android::ConvertJavaStringToUTF8(env, jtest_data_dir));
@@ -63,14 +64,13 @@ static jlong CreateMockCertVerifier(
std::vector<std::string> certs;
base::android::AppendJavaStringArrayToStringVector(env, jcerts, &certs);
net::MockCertVerifier* mock_cert_verifier = new net::MockCertVerifier();
- for (auto cert : certs) {
+ for (const auto& cert : certs) {
net::CertVerifyResult verify_result;
verify_result.verified_cert =
net::ImportCertFromFile(net::GetTestCertsDirectory(), cert);
- // Let the cert be treated as a known root cert.
- // This will enable HPKP verification.
- verify_result.is_issued_by_known_root = true;
+ // By default, HPKP verification is enabled for known trust roots only.
+ verify_result.is_issued_by_known_root = jknown_root;
// Calculate the public key hash and add it to the verify_result.
net::HashValue hashValue;

Powered by Google App Engine
This is Rietveld 408576698