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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 994743003: Support for client certs in ssl_server_socket. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Passing this CL to RyanChung for further work. Created 5 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
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | net/socket/ssl_server_socket.h » ('j') | 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 0d39f6483f2b3bcfed6a543a61e78995d917828a..9b260b78526e9e7b9ae6f83f98e446371f62cdbd 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -28,6 +28,7 @@
#include "base/values.h"
#include "crypto/ec_private_key.h"
#include "crypto/openssl_util.h"
+#include "crypto/rsa_private_key.h"
#include "crypto/scoped_openssl_types.h"
#include "net/base/ip_address_number.h"
#include "net/base/net_errors.h"
@@ -1802,9 +1803,11 @@ int SSLClientSocketOpenSSL::ClientCertRequestCallback(SSL* ssl) {
#else
// TODO(davidben): Lift this call up to the embedder so we can actually test
// this code. https://crbug.com/394131
- private_key_ = FetchClientCertPrivateKey(
- ssl_config_.client_cert.get(),
- g_platform_key_task_runner.Get().task_runner());
+ if (!private_key_) {
+ private_key_ = FetchClientCertPrivateKey(
+ ssl_config_.client_cert.get(),
+ g_platform_key_task_runner.Get().task_runner());
+ }
if (!private_key_) {
// Could not find the private key. Fail the handshake and surface an
// appropriate error to the caller.
@@ -2161,4 +2164,12 @@ void SSLClientSocketOpenSSL::OnPrivateKeySignComplete(
PumpReadWriteEvents();
}
+void SSLClientSocketOpenSSL::ForceClientCertificateAndKeyForTest(
+ scoped_refptr<X509Certificate> client_cert,
+ scoped_ptr<SSLPrivateKey> client_private_key) {
+ ssl_config_.send_client_cert = true;
+ ssl_config_.client_cert = client_cert;
+ private_key_ = client_private_key.Pass();
+}
+
} // namespace net
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | net/socket/ssl_server_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698