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

Unified Diff: net/android/network_library.cc

Issue 11316210: Implement TestRootCerts for Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: net/android/network_library.cc
diff --git a/net/android/network_library.cc b/net/android/network_library.cc
index b53cefe4783cab5bb6f431a5e157414cdec24504..4bf50899720863e9f2b05219d59d8f93221af9c6 100644
--- a/net/android/network_library.cc
+++ b/net/android/network_library.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "net/android/network_library.h"
-
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
@@ -43,6 +42,21 @@ VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain,
return trusted ? VERIFY_OK : VERIFY_NO_TRUSTED_ROOT;
}
+void AddLocalRootCertificate(const uint8* cert, size_t len) {
+ JNIEnv* env = AttachCurrentThread();
+
+ ScopedJavaLocalRef<jbyteArray> cert_array = ToJavaByteArray(env, cert, len);
+ DCHECK(!cert_array.is_null());
+
+ Java_AndroidNetworkLibrary_addLocalRootCertificate(env, cert_array.obj());
+}
+
+void ClearLocalRootCertificates() {
+ JNIEnv* env = AttachCurrentThread();
+
+ Java_AndroidNetworkLibrary_clearLocalRootCertificates(env);
+}
+
bool StoreKeyPair(const uint8* public_key,
size_t public_len,
const uint8* private_key,

Powered by Google App Engine
This is Rietveld 408576698