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

Unified Diff: net/socket/ssl_client_socket_openssl_unittest.cc

Issue 1422573008: Plumbing SSLPrivateKey (//net) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing extra tab. Created 5 years, 2 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
Index: net/socket/ssl_client_socket_openssl_unittest.cc
diff --git a/net/socket/ssl_client_socket_openssl_unittest.cc b/net/socket/ssl_client_socket_openssl_unittest.cc
index 3a8b52ce6aa489f4266d5ea92920bf16eb81df47..ac72b679677f73d0f54a6b45332c3f6b576c2b00 100644
--- a/net/socket/ssl_client_socket_openssl_unittest.cc
+++ b/net/socket/ssl_client_socket_openssl_unittest.cc
@@ -33,9 +33,9 @@
#include "net/socket/client_socket_handle.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/tcp_client_socket.h"
-#include "net/ssl/openssl_client_key_store.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_config_service.h"
+#include "net/ssl/ssl_platform_key.h"
#include "net/test/cert_test_util.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -87,10 +87,9 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
cert_verifier_->set_default_result(OK);
context_.cert_verifier = cert_verifier_.get();
context_.transport_security_state = transport_security_state_.get();
- key_store_ = OpenSSLClientKeyStore::GetInstance();
}
- ~SSLClientSocketOpenSSLClientAuthTest() override { key_store_->Flush(); }
+ ~SSLClientSocketOpenSSLClientAuthTest() override {}
protected:
scoped_ptr<SSLClientSocket> CreateSSLClientSocket(
@@ -131,17 +130,6 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
return true;
}
- // Record a certificate's private key to ensure it can be used
- // by the OpenSSL-based SSLClientSocket implementation.
- // |ssl_config| provides a client certificate.
- // |private_key| must be an EVP_PKEY for the corresponding private key.
- // Returns true on success, false on failure.
- bool RecordPrivateKey(SSLConfig& ssl_config,
- EVP_PKEY* private_key) {
- return key_store_->RecordClientCertPrivateKey(
- ssl_config.client_cert.get(), private_key);
- }
-
// Create an SSLClientSocket object and use it to connect to a test
// server, then wait for connection results. This must be called after
// a succesful ConnectToTestServer() call.
@@ -178,7 +166,6 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
scoped_ptr<MockCertVerifier> cert_verifier_;
scoped_ptr<TransportSecurityState> transport_security_state_;
SSLClientSocketContext context_;
- OpenSSLClientKeyStore* key_store_;
scoped_ptr<SpawnedTestServer> test_server_;
AddressList addr_;
TestCompletionCallback callback_;
@@ -218,6 +205,7 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendEmptyCert) {
SSLConfig ssl_config;
ssl_config.send_client_cert = true;
ssl_config.client_cert = NULL;
+ ssl_config.client_private_key = NULL;
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
@@ -246,8 +234,8 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendGoodCert) {
crypto::ScopedEVP_PKEY client_private_key;
ASSERT_TRUE(LoadPrivateKeyOpenSSL(certs_dir.AppendASCII("client_1.key"),
&client_private_key));
- EXPECT_TRUE(RecordPrivateKey(ssl_config, client_private_key.get()));
-
+ ssl_config.client_private_key =
+ net::WrapOpenSSLPrivateKey(client_private_key.Pass());
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));

Powered by Google App Engine
This is Rietveld 408576698