| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mock_cert_verifier.h" | 5 #include "mock_cert_verifier.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/jni_array.h" | 11 #include "base/android/jni_array.h" |
| 12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
| 13 #include "base/test/test_support_android.h" | 13 #include "base/test/test_support_android.h" |
| 14 #include "crypto/sha2.h" | 14 #include "crypto/sha2.h" |
| 15 #include "jni/MockCertVerifier_jni.h" | 15 #include "jni/MockCertVerifier_jni.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "net/base/test_data_directory.h" | |
| 18 #include "net/cert/asn1_util.h" | 17 #include "net/cert/asn1_util.h" |
| 19 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
| 20 #include "net/cert/cert_verify_result.h" | 19 #include "net/cert/cert_verify_result.h" |
| 21 #include "net/cert/mock_cert_verifier.h" | 20 #include "net/cert/mock_cert_verifier.h" |
| 22 #include "net/test/cert_test_util.h" | 21 #include "net/test/cert_test_util.h" |
| 22 #include "net/test/test_data_directory.h" |
| 23 | 23 |
| 24 namespace cronet { | 24 namespace cronet { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // Populates |out_hash_value| with the SHA256 hash of the |cert| public key. | 28 // Populates |out_hash_value| with the SHA256 hash of the |cert| public key. |
| 29 // Returns true on success. | 29 // Returns true on success. |
| 30 static bool CalculatePublicKeySha256(const net::X509Certificate& cert, | 30 static bool CalculatePublicKeySha256(const net::X509Certificate& cert, |
| 31 net::HashValue* out_hash_value) { | 31 net::HashValue* out_hash_value) { |
| 32 // Convert the cert to DER encoded bytes. | 32 // Convert the cert to DER encoded bytes. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 return reinterpret_cast<jlong>(mock_cert_verifier); | 85 return reinterpret_cast<jlong>(mock_cert_verifier); |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool RegisterMockCertVerifier(JNIEnv* env) { | 88 bool RegisterMockCertVerifier(JNIEnv* env) { |
| 89 return RegisterNativesImpl(env); | 89 return RegisterNativesImpl(env); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace cronet | 92 } // namespace cronet |
| OLD | NEW |