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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 5594009: Adds first cut implementation of a private key store abstraction for openssl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wtc comment from http://codereview.chromium.org/5592003/ Created 10 years 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 | « net/net.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_openssl.cc
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index b3690a9bfc1b0d02747ee74f6d05132cecfb6cce..145aec9d35cd681a713b45f4c17f9e5ed3edaf93 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -16,6 +16,7 @@
#include "base/singleton.h"
#include "net/base/cert_verifier.h"
#include "net/base/net_errors.h"
+#include "net/base/openssl_private_key_store.h"
#include "net/base/ssl_cert_request_info.h"
#include "net/base/ssl_connection_status_flags.h"
#include "net/base/ssl_info.h"
@@ -528,10 +529,18 @@ int SSLClientSocketOpenSSL::ClientCertRequestCallback(SSL* ssl,
// Second pass: a client certificate should have been selected.
if (ssl_config_.client_cert) {
- // TODO(joth): We need a way to lookup the private key this
- // certificate. See http://crbug.com/64951 and example code in
- // http://codereview.chromium.org/5195001/diff/6001/net/socket/ssl_client_socket_openssl.cc
- NOTIMPLEMENTED();
+ EVP_PKEY* privkey = OpenSSLPrivateKeyStore::GetInstance()->FetchPrivateKey(
+ X509_PUBKEY_get(X509_get_X509_PUBKEY(
+ ssl_config_.client_cert->os_cert_handle())));
+ if (privkey) {
+ // TODO(joth): (copied from NSS) We should wait for server certificate
+ // verification before sending our credentials. See http://crbug.com/13934
+ *x509 = X509Certificate::DupOSCertHandle(
+ ssl_config_.client_cert->os_cert_handle());
+ *pkey = privkey;
+ return 1;
+ }
+ LOG(WARNING) << "Client cert found without private key";
}
// Send no client certificate.
« no previous file with comments | « net/net.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698