| 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" | |
| 11 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| 12 #include "net/base/load_flags.h" | 11 #include "net/base/load_flags.h" |
| 13 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 14 #include "net/socket/ssl_socket.h" | 13 #include "net/socket/ssl_socket.h" |
| 15 #include "net/socket/stream_socket.h" | 14 #include "net/socket/stream_socket.h" |
| 16 | 15 |
| 17 namespace net { | 16 namespace net { |
| 18 | 17 |
| 19 class CertVerifier; | 18 class CertVerifier; |
| 20 class CTVerifier; | 19 class CTVerifier; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 virtual ServerBoundCertService* GetServerBoundCertService() const = 0; | 124 virtual ServerBoundCertService* GetServerBoundCertService() const = 0; |
| 126 | 125 |
| 127 // Returns true if a channel ID was sent on this connection. | 126 // Returns true if a channel ID was sent on this connection. |
| 128 // This may be useful for protocols, like SPDY, which allow the same | 127 // This may be useful for protocols, like SPDY, which allow the same |
| 129 // connection to be shared between multiple domains, each of which need | 128 // connection to be shared between multiple domains, each of which need |
| 130 // a channel ID. | 129 // a channel ID. |
| 131 // | 130 // |
| 132 // Public for ssl_client_socket_openssl_unittest.cc. | 131 // Public for ssl_client_socket_openssl_unittest.cc. |
| 133 virtual bool WasChannelIDSent() const; | 132 virtual bool WasChannelIDSent() const; |
| 134 | 133 |
| 134 // Returns true if the server sent Certificate Transparency SCTs |
| 135 // via a TLS extension. |
| 136 // Temporary glue for testing while the CT code hasn't landed. |
| 137 // TODO(ekasper): expose received SCTs via SSLInfo instead. |
| 138 virtual bool WereSignedCertTimestampsReceived() const; |
| 139 |
| 135 protected: | 140 protected: |
| 136 virtual void set_channel_id_sent(bool channel_id_sent); | 141 virtual void set_channel_id_sent(bool channel_id_sent); |
| 137 | 142 |
| 138 virtual void set_signed_cert_timestamps_received( | 143 virtual void set_signed_cert_timestamps_received( |
| 139 bool signed_cert_timestamps_received); | 144 bool signed_cert_timestamps_received); |
| 140 | 145 |
| 141 virtual void set_stapled_ocsp_response_received( | |
| 142 bool stapled_ocsp_response_received); | |
| 143 | |
| 144 // Records histograms for channel id support during full handshakes - resumed | 146 // Records histograms for channel id support during full handshakes - resumed |
| 145 // handshakes are ignored. | 147 // handshakes are ignored. |
| 146 static void RecordChannelIDSupport( | 148 static void RecordChannelIDSupport( |
| 147 ServerBoundCertService* server_bound_cert_service, | 149 ServerBoundCertService* server_bound_cert_service, |
| 148 bool negotiated_channel_id, | 150 bool negotiated_channel_id, |
| 149 bool channel_id_enabled, | 151 bool channel_id_enabled, |
| 150 bool supports_ecc); | 152 bool supports_ecc); |
| 151 | 153 |
| 152 // Returns whether TLS channel ID is enabled. | 154 // Returns whether TLS channel ID is enabled. |
| 153 static bool IsChannelIDEnabled( | 155 static bool IsChannelIDEnabled( |
| 154 const SSLConfig& ssl_config, | 156 const SSLConfig& ssl_config, |
| 155 ServerBoundCertService* server_bound_cert_service); | 157 ServerBoundCertService* server_bound_cert_service); |
| 156 | 158 |
| 157 private: | 159 private: |
| 158 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. | |
| 159 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | |
| 160 ConnectSignedCertTimestampsEnabledTLSExtension); | |
| 161 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | |
| 162 ConnectSignedCertTimestampsEnabledOCSP); | |
| 163 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | |
| 164 ConnectSignedCertTimestampsDisabled); | |
| 165 | |
| 166 // True if NPN was responded to, independent of selecting SPDY or HTTP. | 160 // True if NPN was responded to, independent of selecting SPDY or HTTP. |
| 167 bool was_npn_negotiated_; | 161 bool was_npn_negotiated_; |
| 168 // True if NPN successfully negotiated SPDY. | 162 // True if NPN successfully negotiated SPDY. |
| 169 bool was_spdy_negotiated_; | 163 bool was_spdy_negotiated_; |
| 170 // Protocol that we negotiated with the server. | 164 // Protocol that we negotiated with the server. |
| 171 NextProto protocol_negotiated_; | 165 NextProto protocol_negotiated_; |
| 172 // True if a channel ID was sent. | 166 // True if a channel ID was sent. |
| 173 bool channel_id_sent_; | 167 bool channel_id_sent_; |
| 174 // True if SCTs were received via a TLS extension. | 168 // True if SCTs were received via a TLS extension. |
| 175 bool signed_cert_timestamps_received_; | 169 bool signed_cert_timestamps_received_; |
| 176 // True if a stapled OCSP response was received. | |
| 177 bool stapled_ocsp_response_received_; | |
| 178 }; | 170 }; |
| 179 | 171 |
| 180 } // namespace net | 172 } // namespace net |
| 181 | 173 |
| 182 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 174 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |