| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3309 SSLConfig ssl_config; | 3309 SSLConfig ssl_config; |
| 3310 int rv; | 3310 int rv; |
| 3311 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3311 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
| 3312 SSLInfo ssl_info; | 3312 SSLInfo ssl_info; |
| 3313 ASSERT_TRUE(sock_->GetSSLInfo(&ssl_info)); | 3313 ASSERT_TRUE(sock_->GetSSLInfo(&ssl_info)); |
| 3314 | 3314 |
| 3315 EXPECT_EQ(OK, rv); | 3315 EXPECT_EQ(OK, rv); |
| 3316 EXPECT_TRUE(sock_->IsConnected()); | 3316 EXPECT_TRUE(sock_->IsConnected()); |
| 3317 | 3317 |
| 3318 EXPECT_TRUE(ssl_info.pkp_bypassed); | 3318 EXPECT_TRUE(ssl_info.pkp_bypassed); |
| 3319 EXPECT_FALSE(ssl_info.cert_status & CERT_STATUS_PINNED_KEY_MISSING); |
| 3319 } | 3320 } |
| 3320 | 3321 |
| 3321 TEST_F(SSLClientSocketTest, PKPEnforced) { | 3322 TEST_F(SSLClientSocketTest, PKPEnforced) { |
| 3322 SpawnedTestServer::SSLOptions ssl_options; | 3323 SpawnedTestServer::SSLOptions ssl_options; |
| 3323 ASSERT_TRUE(StartTestServer(ssl_options)); | 3324 ASSERT_TRUE(StartTestServer(ssl_options)); |
| 3324 scoped_refptr<X509Certificate> server_cert = | 3325 scoped_refptr<X509Certificate> server_cert = |
| 3325 spawned_test_server()->GetCertificate(); | 3326 spawned_test_server()->GetCertificate(); |
| 3326 | 3327 |
| 3327 // Certificate is trusted, but chains to a public root that doesn't match the | 3328 // Certificate is trusted, but chains to a public root that doesn't match the |
| 3328 // pin hashes. | 3329 // pin hashes. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3346 ASSERT_TRUE(sock_->GetSSLInfo(&ssl_info)); | 3347 ASSERT_TRUE(sock_->GetSSLInfo(&ssl_info)); |
| 3347 | 3348 |
| 3348 EXPECT_EQ(ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, rv); | 3349 EXPECT_EQ(ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, rv); |
| 3349 EXPECT_TRUE(ssl_info.cert_status & CERT_STATUS_PINNED_KEY_MISSING); | 3350 EXPECT_TRUE(ssl_info.cert_status & CERT_STATUS_PINNED_KEY_MISSING); |
| 3350 EXPECT_TRUE(sock_->IsConnected()); | 3351 EXPECT_TRUE(sock_->IsConnected()); |
| 3351 | 3352 |
| 3352 EXPECT_FALSE(ssl_info.pkp_bypassed); | 3353 EXPECT_FALSE(ssl_info.pkp_bypassed); |
| 3353 } | 3354 } |
| 3354 | 3355 |
| 3355 } // namespace net | 3356 } // namespace net |
| OLD | NEW |