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

Unified Diff: net/base/test_root_certs_android.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/base/test_root_certs_android.cc
diff --git a/net/base/test_root_certs_openssl.cc b/net/base/test_root_certs_android.cc
similarity index 52%
copy from net/base/test_root_certs_openssl.cc
copy to net/base/test_root_certs_android.cc
index e01d5c95dadc9f5e6879158c060ad346e83e41ac..5fb2ff171954963a06415cf99db743ee0d06cc10 100644
--- a/net/base/test_root_certs_openssl.cc
+++ b/net/base/test_root_certs_android.cc
@@ -4,29 +4,19 @@
#include "net/base/test_root_certs.h"
-#include <openssl/err.h>
-#include <openssl/x509v3.h>
-
#include "base/location.h"
#include "base/logging.h"
-#include "crypto/openssl_util.h"
+#include "net/android/network_library.h"
#include "net/base/x509_certificate.h"
namespace net {
bool TestRootCerts::Add(X509Certificate* certificate) {
- if (!X509_STORE_add_cert(X509Certificate::cert_store(),
- certificate->os_cert_handle())) {
- unsigned long error_code = ERR_peek_error();
- if (ERR_GET_LIB(error_code) != ERR_LIB_X509 ||
- ERR_GET_REASON(error_code) != X509_R_CERT_ALREADY_IN_HASH_TABLE) {
- crypto::ClearOpenSSLERRStack(FROM_HERE);
- return false;
- }
- ERR_clear_error();
- }
-
- empty_ = false;
+ std::string cert_bytes;
+ X509Certificate::X509Certificate::GetDEREncoded(certificate->os_cert_handle(),
+ &cert_bytes);
+ net::android::AddLocalRootCertificate((const uint8*)cert_bytes.data(),
digit1 2012/11/28 10:42:34 I think the Chrome team prefers the use of C++ sty
ppi 2012/11/28 13:37:31 Thanks, fixed in patch set 2. On 2012/11/28 10:42
+ cert_bytes.size());
return true;
}
@@ -34,7 +24,7 @@ void TestRootCerts::Clear() {
if (empty_)
return;
- X509Certificate::ResetCertStore();
+ net::android::ClearLocalRootCertificates();
empty_ = true;
}
@@ -48,4 +38,4 @@ void TestRootCerts::Init() {
empty_ = true;
}
-} // namespace net
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698