Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / android / cert_verify_result_android.cc
blob151c4ef4eaed7d1043bb3af6f2230d565aad165a
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
3 // found in the LICENSE file.
5 #include "net/android/cert_verify_result_android.h"
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h"
9 #include "jni/AndroidCertVerifyResult_jni.h"
11 using base::android::AttachCurrentThread;
12 using base::android::JavaArrayOfByteArrayToStringVector;
14 namespace net {
15 namespace android {
17 void ExtractCertVerifyResult(jobject result,
18 CertVerifyStatusAndroid* status,
19 bool* is_issued_by_known_root,
20 std::vector<std::string>* verified_chain) {
21 JNIEnv* env = AttachCurrentThread();
23 *status = static_cast<CertVerifyStatusAndroid>(
24 Java_AndroidCertVerifyResult_getStatus(env, result));
26 *is_issued_by_known_root =
27 Java_AndroidCertVerifyResult_isIssuedByKnownRoot(env, result);
29 ScopedJavaLocalRef<jobjectArray> chain_byte_array =
30 Java_AndroidCertVerifyResult_getCertificateChainEncoded(env, result);
31 JavaArrayOfByteArrayToStringVector(
32 env, chain_byte_array.obj(), verified_chain);
35 bool RegisterCertVerifyResult(JNIEnv* env) {
36 return RegisterNativesImpl(env);
39 } // namespace android
40 } // namespace net