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/cert/asn1_util.h" | 17 #include "net/cert/asn1_util.h" |
18 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
19 #include "net/cert/cert_verify_result.h" | 19 #include "net/cert/cert_verify_result.h" |
20 #include "net/cert/mock_cert_verifier.h" | 20 #include "net/cert/mock_cert_verifier.h" |
21 #include "net/test/cert_test_util.h" | 21 #include "net/test/cert_test_util.h" |
22 #include "net/test/test_data_directory.h" | 22 #include "net/test/test_data_directory.h" |
23 | 23 |
| 24 using base::android::JavaParamRef; |
| 25 |
24 namespace cronet { | 26 namespace cronet { |
25 | 27 |
26 namespace { | 28 namespace { |
27 | 29 |
28 // Populates |out_hash_value| with the SHA256 hash of the |cert| public key. | 30 // Populates |out_hash_value| with the SHA256 hash of the |cert| public key. |
29 // Returns true on success. | 31 // Returns true on success. |
30 static bool CalculatePublicKeySha256(const net::X509Certificate& cert, | 32 static bool CalculatePublicKeySha256(const net::X509Certificate& cert, |
31 net::HashValue* out_hash_value) { | 33 net::HashValue* out_hash_value) { |
32 // Convert the cert to DER encoded bytes. | 34 // Convert the cert to DER encoded bytes. |
33 std::string der_cert_bytes; | 35 std::string der_cert_bytes; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 85 } |
84 | 86 |
85 return reinterpret_cast<jlong>(mock_cert_verifier); | 87 return reinterpret_cast<jlong>(mock_cert_verifier); |
86 } | 88 } |
87 | 89 |
88 bool RegisterMockCertVerifier(JNIEnv* env) { | 90 bool RegisterMockCertVerifier(JNIEnv* env) { |
89 return RegisterNativesImpl(env); | 91 return RegisterNativesImpl(env); |
90 } | 92 } |
91 | 93 |
92 } // namespace cronet | 94 } // namespace cronet |
OLD | NEW |