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 |