| 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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
| 12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/socket/ssl_socket.h" | 14 #include "net/socket/ssl_socket.h" |
| 15 #include "net/socket/stream_socket.h" | 15 #include "net/socket/stream_socket.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class CertVerifier; | 19 class CertVerifier; |
| 20 class CTVerifier; | 20 class CTVerifier; |
| 21 class ServerBoundCertService; | 21 class ServerBoundCertService; |
| 22 class SSLCertRequestInfo; | 22 class SSLCertRequestInfo; |
| 23 struct SSLConfig; | 23 struct SSLConfig; |
| 24 class SSLInfo; | 24 class SSLInfo; |
| 25 class TransportSecurityState; | 25 class TransportSecurityState; |
| 26 class X509Certificate; |
| 26 | 27 |
| 27 // This struct groups together several fields which are used by various | 28 // This struct groups together several fields which are used by various |
| 28 // classes related to SSLClientSocket. | 29 // classes related to SSLClientSocket. |
| 29 struct SSLClientSocketContext { | 30 struct SSLClientSocketContext { |
| 30 SSLClientSocketContext() | 31 SSLClientSocketContext() |
| 31 : cert_verifier(NULL), | 32 : cert_verifier(NULL), |
| 32 server_bound_cert_service(NULL), | 33 server_bound_cert_service(NULL), |
| 33 transport_security_state(NULL), | 34 transport_security_state(NULL), |
| 34 cert_transparency_verifier(NULL) {} | 35 cert_transparency_verifier(NULL) {} |
| 35 | 36 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 ServerBoundCertService* server_bound_cert_service, | 148 ServerBoundCertService* server_bound_cert_service, |
| 148 bool negotiated_channel_id, | 149 bool negotiated_channel_id, |
| 149 bool channel_id_enabled, | 150 bool channel_id_enabled, |
| 150 bool supports_ecc); | 151 bool supports_ecc); |
| 151 | 152 |
| 152 // Returns whether TLS channel ID is enabled. | 153 // Returns whether TLS channel ID is enabled. |
| 153 static bool IsChannelIDEnabled( | 154 static bool IsChannelIDEnabled( |
| 154 const SSLConfig& ssl_config, | 155 const SSLConfig& ssl_config, |
| 155 ServerBoundCertService* server_bound_cert_service); | 156 ServerBoundCertService* server_bound_cert_service); |
| 156 | 157 |
| 158 // For unit testing only. |
| 159 // Returns the unverified certificate chain as presented by server. |
| 160 // Note that chain may be different than the verified chain returned by |
| 161 // StreamSocket::GetSSLInfo(). |
| 162 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() |
| 163 const = 0; |
| 164 |
| 157 private: | 165 private: |
| 158 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. | 166 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. |
| 159 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 167 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
| 160 ConnectSignedCertTimestampsEnabledTLSExtension); | 168 ConnectSignedCertTimestampsEnabledTLSExtension); |
| 161 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 169 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
| 162 ConnectSignedCertTimestampsEnabledOCSP); | 170 ConnectSignedCertTimestampsEnabledOCSP); |
| 163 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 171 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
| 164 ConnectSignedCertTimestampsDisabled); | 172 ConnectSignedCertTimestampsDisabled); |
| 173 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
| 174 VerifyServerChainProperlyOrdered); |
| 165 | 175 |
| 166 // True if NPN was responded to, independent of selecting SPDY or HTTP. | 176 // True if NPN was responded to, independent of selecting SPDY or HTTP. |
| 167 bool was_npn_negotiated_; | 177 bool was_npn_negotiated_; |
| 168 // True if NPN successfully negotiated SPDY. | 178 // True if NPN successfully negotiated SPDY. |
| 169 bool was_spdy_negotiated_; | 179 bool was_spdy_negotiated_; |
| 170 // Protocol that we negotiated with the server. | 180 // Protocol that we negotiated with the server. |
| 171 NextProto protocol_negotiated_; | 181 NextProto protocol_negotiated_; |
| 172 // True if a channel ID was sent. | 182 // True if a channel ID was sent. |
| 173 bool channel_id_sent_; | 183 bool channel_id_sent_; |
| 174 // True if SCTs were received via a TLS extension. | 184 // True if SCTs were received via a TLS extension. |
| 175 bool signed_cert_timestamps_received_; | 185 bool signed_cert_timestamps_received_; |
| 176 // True if a stapled OCSP response was received. | 186 // True if a stapled OCSP response was received. |
| 177 bool stapled_ocsp_response_received_; | 187 bool stapled_ocsp_response_received_; |
| 178 }; | 188 }; |
| 179 | 189 |
| 180 } // namespace net | 190 } // namespace net |
| 181 | 191 |
| 182 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 192 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |