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

Side by Side Diff: net/android/network_library.cc

Issue 11031043: Fix handling of user and CA certificates on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 unified diff | Download patch
« no previous file with comments | « net/android/network_library.h ('k') | net/base/cert_database_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/network_library.h" 5 #include "net/android/network_library.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 "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 ToJavaByteArray(env, public_key, public_len); 57 ToJavaByteArray(env, public_key, public_len);
58 ScopedJavaLocalRef<jbyteArray> private_array = 58 ScopedJavaLocalRef<jbyteArray> private_array =
59 ToJavaByteArray(env, private_key, private_len); 59 ToJavaByteArray(env, private_key, private_len);
60 jboolean ret = Java_AndroidNetworkLibrary_storeKeyPair(env, 60 jboolean ret = Java_AndroidNetworkLibrary_storeKeyPair(env,
61 GetApplicationContext(), public_array.obj(), private_array.obj()); 61 GetApplicationContext(), public_array.obj(), private_array.obj());
62 LOG_IF(WARNING, !ret) << 62 LOG_IF(WARNING, !ret) <<
63 "Call to Java_AndroidNetworkLibrary_storeKeyPair failed"; 63 "Call to Java_AndroidNetworkLibrary_storeKeyPair failed";
64 return ret; 64 return ret;
65 } 65 }
66 66
67 void StoreCertificateOrKeychain(const char* data,
68 size_t data_len,
69 bool is_pkcs12) {
70 JNIEnv* env = AttachCurrentThread();
71 ScopedJavaLocalRef<jbyteArray> data_array =
72 ToJavaByteArray(env, reinterpret_cast<const uint8*>(data), data_len);
73 jboolean ret = Java_AndroidNetworkLibrary_storeCertificateOrKeychain(env,
74 GetApplicationContext(), data_array.obj(), is_pkcs12);
75 LOG_IF(WARNING, !ret) <<
76 "Call to Java_AndroidNetworkLibrary_storeCertificateOrKeychain"
77 " failed";
78 // Intentionally do not return 'ret', there is little the caller can
79 // do in case of failure (the CertInstaller itself will deal with
80 // incorrect data and display the appropriate toast).
81 }
82
67 bool HaveOnlyLoopbackAddresses() { 83 bool HaveOnlyLoopbackAddresses() {
68 JNIEnv* env = AttachCurrentThread(); 84 JNIEnv* env = AttachCurrentThread();
69 return Java_AndroidNetworkLibrary_haveOnlyLoopbackAddresses(env); 85 return Java_AndroidNetworkLibrary_haveOnlyLoopbackAddresses(env);
70 } 86 }
71 87
72 std::string GetNetworkList() { 88 std::string GetNetworkList() {
73 JNIEnv* env = AttachCurrentThread(); 89 JNIEnv* env = AttachCurrentThread();
74 ScopedJavaLocalRef<jstring> ret = 90 ScopedJavaLocalRef<jstring> ret =
75 Java_AndroidNetworkLibrary_getNetworkList(env); 91 Java_AndroidNetworkLibrary_getNetworkList(env);
76 return ConvertJavaStringToUTF8(ret); 92 return ConvertJavaStringToUTF8(ret);
(...skipping 17 matching lines...) Expand all
94 *result = ConvertJavaStringToUTF8(ret); 110 *result = ConvertJavaStringToUTF8(ret);
95 return true; 111 return true;
96 } 112 }
97 113
98 bool RegisterNetworkLibrary(JNIEnv* env) { 114 bool RegisterNetworkLibrary(JNIEnv* env) {
99 return RegisterNativesImpl(env); 115 return RegisterNativesImpl(env);
100 } 116 }
101 117
102 } // namespace android 118 } // namespace android
103 } // namespace net 119 } // namespace net
OLDNEW
« no previous file with comments | « net/android/network_library.h ('k') | net/base/cert_database_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698