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

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: remove an obsolete findbugs suppression 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..4362ecb31c684f40bf45fec5e331bb6ba1c36c49 100644
--- a/net/android/network_library.cc
+++ b/net/android/network_library.cc
@@ -43,6 +43,18 @@ VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain,
return trusted ? VERIFY_OK : VERIFY_NO_TRUSTED_ROOT;
}
+void AddTestRootCertificate(const uint8* cert, size_t len) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jbyteArray> cert_array = ToJavaByteArray(env, cert, len);
+ DCHECK(!cert_array.is_null());
+ Java_AndroidNetworkLibrary_addTestRootCertificate(env, cert_array.obj());
+}
+
+void ClearTestRootCertificates() {
+ JNIEnv* env = AttachCurrentThread();
+ Java_AndroidNetworkLibrary_clearTestRootCertificates(env);
+}
+
bool StoreKeyPair(const uint8* public_key,
size_t public_len,
const uint8* private_key,

Powered by Google App Engine
This is Rietveld 408576698