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

Side by Side Diff: net/socket/ssl_client_socket_win.h

Issue 4339001: Correctly handle SSL Client Authentication requests when connecting... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include <windows.h> 11 #include <windows.h>
12 #include <wincrypt.h> 12 #include <wincrypt.h>
13 #include <security.h> 13 #include <security.h>
14 14
15 #include <string> 15 #include <string>
16 16
17 #include "base/scoped_ptr.h" 17 #include "base/scoped_ptr.h"
18 #include "net/base/cert_verify_result.h" 18 #include "net/base/cert_verify_result.h"
19 #include "net/base/completion_callback.h" 19 #include "net/base/completion_callback.h"
20 #include "net/base/host_port_pair.h"
20 #include "net/base/net_log.h" 21 #include "net/base/net_log.h"
21 #include "net/base/ssl_config_service.h" 22 #include "net/base/ssl_config_service.h"
22 #include "net/socket/ssl_client_socket.h" 23 #include "net/socket/ssl_client_socket.h"
23 24
24 namespace net { 25 namespace net {
25 26
27 class BoundNetLog;
26 class CertVerifier; 28 class CertVerifier;
27 class ClientSocketHandle; 29 class ClientSocketHandle;
28 class BoundNetLog; 30 class HostPortPair;
29 31
30 // An SSL client socket implemented with the Windows Schannel. 32 // An SSL client socket implemented with the Windows Schannel.
31 class SSLClientSocketWin : public SSLClientSocket { 33 class SSLClientSocketWin : public SSLClientSocket {
32 public: 34 public:
33 // Takes ownership of the |transport_socket|, which must already be connected. 35 // Takes ownership of the |transport_socket|, which must already be connected.
34 // The given hostname will be compared with the name(s) in the server's 36 // The hostname specified in |host_and_port| will be compared with the name(s)
35 // certificate during the SSL handshake. ssl_config specifies the SSL 37 // in the server's certificate during the SSL handshake. If SSL client
36 // settings. 38 // authentication is requested, the host_and_port field of SSLCertRequestInfo
39 // will be populated with |host_and_port|. |ssl_config| specifies
40 // the SSL settings.
37 SSLClientSocketWin(ClientSocketHandle* transport_socket, 41 SSLClientSocketWin(ClientSocketHandle* transport_socket,
38 const std::string& hostname, 42 const HostPortPair& host_and_port,
39 const SSLConfig& ssl_config); 43 const SSLConfig& ssl_config);
40 ~SSLClientSocketWin(); 44 ~SSLClientSocketWin();
41 45
42 // SSLClientSocket methods: 46 // SSLClientSocket methods:
43 virtual void GetSSLInfo(SSLInfo* ssl_info); 47 virtual void GetSSLInfo(SSLInfo* ssl_info);
44 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); 48 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info);
45 virtual NextProtoStatus GetNextProto(std::string* proto); 49 virtual NextProtoStatus GetNextProto(std::string* proto);
46 50
47 // ClientSocket methods: 51 // ClientSocket methods:
48 virtual int Connect(CompletionCallback* callback); 52 virtual int Connect(CompletionCallback* callback);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void DidCompleteRenegotiation(); 100 void DidCompleteRenegotiation();
97 void LogConnectionTypeMetrics() const; 101 void LogConnectionTypeMetrics() const;
98 void FreeSendBuffer(); 102 void FreeSendBuffer();
99 103
100 // Internal callbacks as async operations complete. 104 // Internal callbacks as async operations complete.
101 CompletionCallbackImpl<SSLClientSocketWin> handshake_io_callback_; 105 CompletionCallbackImpl<SSLClientSocketWin> handshake_io_callback_;
102 CompletionCallbackImpl<SSLClientSocketWin> read_callback_; 106 CompletionCallbackImpl<SSLClientSocketWin> read_callback_;
103 CompletionCallbackImpl<SSLClientSocketWin> write_callback_; 107 CompletionCallbackImpl<SSLClientSocketWin> write_callback_;
104 108
105 scoped_ptr<ClientSocketHandle> transport_; 109 scoped_ptr<ClientSocketHandle> transport_;
106 std::string hostname_; 110 HostPortPair hostname_;
eroman 2010/11/12 01:12:56 Please change the name to say host_and_port_, or s
Ryan Hamilton 2010/11/12 16:47:26 Done.
107 SSLConfig ssl_config_; 111 SSLConfig ssl_config_;
108 112
109 // User function to callback when the Connect() completes. 113 // User function to callback when the Connect() completes.
110 CompletionCallback* user_connect_callback_; 114 CompletionCallback* user_connect_callback_;
111 115
112 // User function to callback when a Read() completes. 116 // User function to callback when a Read() completes.
113 CompletionCallback* user_read_callback_; 117 CompletionCallback* user_read_callback_;
114 scoped_refptr<IOBuffer> user_read_buf_; 118 scoped_refptr<IOBuffer> user_read_buf_;
115 int user_read_buf_len_; 119 int user_read_buf_len_;
116 120
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 192
189 // True when the decrypter needs more data in order to decrypt. 193 // True when the decrypter needs more data in order to decrypt.
190 bool need_more_data_; 194 bool need_more_data_;
191 195
192 BoundNetLog net_log_; 196 BoundNetLog net_log_;
193 }; 197 };
194 198
195 } // namespace net 199 } // namespace net
196 200
197 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ 201 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698