| OLD | NEW |
| 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 "net/android/cert_verify_result_android.h" | 5 #include "net/android/cert_verify_result_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "jni/AndroidCertVerifyResult_jni.h" | 9 #include "jni/AndroidCertVerifyResult_jni.h" |
| 10 | 10 |
| 11 using base::android::AttachCurrentThread; | 11 using base::android::AttachCurrentThread; |
| 12 using base::android::JavaArrayOfByteArrayToStringVector; | 12 using base::android::JavaArrayOfByteArrayToStringVector; |
| 13 using base::android::JavaRef; |
| 13 using base::android::ScopedJavaLocalRef; | 14 using base::android::ScopedJavaLocalRef; |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 namespace android { | 17 namespace android { |
| 17 | 18 |
| 18 void ExtractCertVerifyResult(jobject result, | 19 void ExtractCertVerifyResult(const JavaRef<jobject>& result, |
| 19 CertVerifyStatusAndroid* status, | 20 CertVerifyStatusAndroid* status, |
| 20 bool* is_issued_by_known_root, | 21 bool* is_issued_by_known_root, |
| 21 std::vector<std::string>* verified_chain) { | 22 std::vector<std::string>* verified_chain) { |
| 22 JNIEnv* env = AttachCurrentThread(); | 23 JNIEnv* env = AttachCurrentThread(); |
| 23 | 24 |
| 24 *status = static_cast<CertVerifyStatusAndroid>( | 25 *status = static_cast<CertVerifyStatusAndroid>( |
| 25 Java_AndroidCertVerifyResult_getStatus(env, result)); | 26 Java_AndroidCertVerifyResult_getStatus(env, result)); |
| 26 | 27 |
| 27 *is_issued_by_known_root = | 28 *is_issued_by_known_root = |
| 28 Java_AndroidCertVerifyResult_isIssuedByKnownRoot(env, result); | 29 Java_AndroidCertVerifyResult_isIssuedByKnownRoot(env, result); |
| 29 | 30 |
| 30 ScopedJavaLocalRef<jobjectArray> chain_byte_array = | 31 ScopedJavaLocalRef<jobjectArray> chain_byte_array = |
| 31 Java_AndroidCertVerifyResult_getCertificateChainEncoded(env, result); | 32 Java_AndroidCertVerifyResult_getCertificateChainEncoded(env, result); |
| 32 JavaArrayOfByteArrayToStringVector( | 33 JavaArrayOfByteArrayToStringVector( |
| 33 env, chain_byte_array.obj(), verified_chain); | 34 env, chain_byte_array.obj(), verified_chain); |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace android | 37 } // namespace android |
| 37 } // namespace net | 38 } // namespace net |
| OLD | NEW |