| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_WIN_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #define SECURITY_WIN32 // Needs to be defined before including security.h | 9 #define SECURITY_WIN32 // Needs to be defined before including security.h |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
| 22 #include "net/base/ssl_config_service.h" | 22 #include "net/base/ssl_config_service.h" |
| 23 #include "net/socket/ssl_client_socket.h" | 23 #include "net/socket/ssl_client_socket.h" |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 | 26 |
| 27 class BoundNetLog; | 27 class BoundNetLog; |
| 28 class CertVerifier; | 28 class CertVerifier; |
| 29 class ClientSocketHandle; | 29 class ClientSocketHandle; |
| 30 class HostPortPair; | 30 class HostPortPair; |
| 31 class SingleRequestCertVerifier; |
| 31 | 32 |
| 32 // An SSL client socket implemented with the Windows Schannel. | 33 // An SSL client socket implemented with the Windows Schannel. |
| 33 class SSLClientSocketWin : public SSLClientSocket { | 34 class SSLClientSocketWin : public SSLClientSocket { |
| 34 public: | 35 public: |
| 35 // Takes ownership of the |transport_socket|, which must already be connected. | 36 // Takes ownership of the |transport_socket|, which must already be connected. |
| 36 // The hostname specified in |host_and_port| will be compared with the name(s) | 37 // The hostname specified in |host_and_port| will be compared with the name(s) |
| 37 // in the server's certificate during the SSL handshake. If SSL client | 38 // in the server's certificate during the SSL handshake. If SSL client |
| 38 // authentication is requested, the host_and_port field of SSLCertRequestInfo | 39 // authentication is requested, the host_and_port field of SSLCertRequestInfo |
| 39 // will be populated with |host_and_port|. |ssl_config| specifies | 40 // will be populated with |host_and_port|. |ssl_config| specifies |
| 40 // the SSL settings. | 41 // the SSL settings. |
| 41 SSLClientSocketWin(ClientSocketHandle* transport_socket, | 42 SSLClientSocketWin(ClientSocketHandle* transport_socket, |
| 42 const HostPortPair& host_and_port, | 43 const HostPortPair& host_and_port, |
| 43 const SSLConfig& ssl_config); | 44 const SSLConfig& ssl_config, |
| 45 CertVerifier* cert_verifier); |
| 44 ~SSLClientSocketWin(); | 46 ~SSLClientSocketWin(); |
| 45 | 47 |
| 46 // SSLClientSocket methods: | 48 // SSLClientSocket methods: |
| 47 virtual void GetSSLInfo(SSLInfo* ssl_info); | 49 virtual void GetSSLInfo(SSLInfo* ssl_info); |
| 48 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 50 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
| 49 virtual NextProtoStatus GetNextProto(std::string* proto); | 51 virtual NextProtoStatus GetNextProto(std::string* proto); |
| 50 | 52 |
| 51 // ClientSocket methods: | 53 // ClientSocket methods: |
| 52 virtual int Connect(CompletionCallback* callback); | 54 virtual int Connect(CompletionCallback* callback); |
| 53 virtual void Disconnect(); | 55 virtual void Disconnect(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 STATE_COMPLETED_RENEGOTIATION, | 140 STATE_COMPLETED_RENEGOTIATION, |
| 139 STATE_COMPLETED_HANDSHAKE | 141 STATE_COMPLETED_HANDSHAKE |
| 140 // After the handshake, the socket remains | 142 // After the handshake, the socket remains |
| 141 // in the STATE_COMPLETED_HANDSHAKE state, | 143 // in the STATE_COMPLETED_HANDSHAKE state, |
| 142 // unless a renegotiate handshake occurs. | 144 // unless a renegotiate handshake occurs. |
| 143 }; | 145 }; |
| 144 State next_state_; | 146 State next_state_; |
| 145 | 147 |
| 146 SecPkgContext_StreamSizes stream_sizes_; | 148 SecPkgContext_StreamSizes stream_sizes_; |
| 147 scoped_refptr<X509Certificate> server_cert_; | 149 scoped_refptr<X509Certificate> server_cert_; |
| 148 scoped_ptr<CertVerifier> verifier_; | 150 CertVerifier* const cert_verifier_; |
| 151 scoped_ptr<SingleRequestCertVerifier> verifier_; |
| 149 CertVerifyResult server_cert_verify_result_; | 152 CertVerifyResult server_cert_verify_result_; |
| 150 | 153 |
| 151 CredHandle* creds_; | 154 CredHandle* creds_; |
| 152 CtxtHandle ctxt_; | 155 CtxtHandle ctxt_; |
| 153 SecBuffer in_buffers_[2]; // Input buffers for InitializeSecurityContext. | 156 SecBuffer in_buffers_[2]; // Input buffers for InitializeSecurityContext. |
| 154 SecBuffer send_buffer_; // Output buffer for InitializeSecurityContext. | 157 SecBuffer send_buffer_; // Output buffer for InitializeSecurityContext. |
| 155 SECURITY_STATUS isc_status_; // Return value of InitializeSecurityContext. | 158 SECURITY_STATUS isc_status_; // Return value of InitializeSecurityContext. |
| 156 scoped_array<char> payload_send_buffer_; | 159 scoped_array<char> payload_send_buffer_; |
| 157 int payload_send_buffer_len_; | 160 int payload_send_buffer_len_; |
| 158 int bytes_sent_; | 161 int bytes_sent_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 195 |
| 193 // True when the decrypter needs more data in order to decrypt. | 196 // True when the decrypter needs more data in order to decrypt. |
| 194 bool need_more_data_; | 197 bool need_more_data_; |
| 195 | 198 |
| 196 BoundNetLog net_log_; | 199 BoundNetLog net_log_; |
| 197 }; | 200 }; |
| 198 | 201 |
| 199 } // namespace net | 202 } // namespace net |
| 200 | 203 |
| 201 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ | 204 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
| OLD | NEW |