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

Unified Diff: net/base/cert_database_openssl.cc

Issue 12220104: Wire up SSL client authentication for OpenSSL/Android through the net/ stack (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: restore in-memory public/private in-memory store for Linux/OpenSSL build. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/keygen_handler_openssl.cc » ('j') | net/base/openssl_client_key_store.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cert_database_openssl.cc
diff --git a/net/base/cert_database_openssl.cc b/net/base/cert_database_openssl.cc
index 47effe2876475f4c9c285f5d49a94d6061dbb60c..8d73b3a543cde1fa61a695e7755e2be49cf64556 100644
--- a/net/base/cert_database_openssl.cc
+++ b/net/base/cert_database_openssl.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/observer_list_threadsafe.h"
+#include "crypto/openssl_util.h"
#include "net/base/crypto_module.h"
#include "net/base/net_errors.h"
#include "net/base/openssl_private_key_store.h"
@@ -21,20 +22,35 @@ CertDatabase::CertDatabase()
CertDatabase::~CertDatabase() {}
+// This method is used to check a client certificate before trying to
+// install it on the system, which will happen later by calling
+// AddUserCert() below.
+//
+// On the Linux/OpenSSL build, there is simply no system keystore, but
+// OpenSSLPrivateKeyStore() implements a small in-memory store for
+// (public/private) key pairs generated through keygen.
+//
+// Try to check for a private key in the in-memory store to check
+// for the case when the browser is trying to install a server-generated
+// certificate from a <keygen> exchange.
int CertDatabase::CheckUserCert(X509Certificate* cert) {
if (!cert)
return ERR_CERT_INVALID;
if (cert->HasExpired())
return ERR_CERT_DATE_INVALID;
- if (!OpenSSLPrivateKeyStore::GetInstance()->FetchPrivateKey(
- X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle()))))
+ // X509_PUBKEY_get() transfers ownership, not X509_get_X509_PUBKEY()
+ crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> public_key(
+ X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle())));
+
+ if (!OpenSSLPrivateKeyStore::HasPrivateKey(public_key.get()))
return ERR_NO_PRIVATE_KEY_FOR_CERT;
return OK;
}
int CertDatabase::AddUserCert(X509Certificate* cert) {
+ // There is no certificate store on the Linux/OpenSSL build.
NOTIMPLEMENTED();
return ERR_NOT_IMPLEMENTED;
}
« no previous file with comments | « no previous file | net/base/keygen_handler_openssl.cc » ('j') | net/base/openssl_client_key_store.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698