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_NSS_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
7 | 7 |
8 #include <certt.h> | 8 #include <certt.h> |
9 #include <keyt.h> | 9 #include <keyt.h> |
10 #include <nspr.h> | 10 #include <nspr.h> |
11 #include <nss.h> | 11 #include <nss.h> |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
17 #include "net/base/cert_verify_result.h" | 17 #include "net/base/cert_verify_result.h" |
18 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
19 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
20 #include "net/base/nss_memio.h" | 20 #include "net/base/nss_memio.h" |
21 #include "net/base/ssl_config_service.h" | 21 #include "net/base/ssl_config_service.h" |
22 #include "net/base/x509_certificate.h" | 22 #include "net/base/x509_certificate.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; |
| 30 class X509Certificate; |
29 | 31 |
30 // An SSL client socket implemented with Mozilla NSS. | 32 // An SSL client socket implemented with Mozilla NSS. |
31 class SSLClientSocketNSS : public SSLClientSocket { | 33 class SSLClientSocketNSS : public SSLClientSocket { |
32 public: | 34 public: |
33 // Takes ownership of the transport_socket, which may already be connected. | 35 // Takes ownership of the transport_socket, which may already be connected. |
34 // The given hostname will be compared with the name(s) in the server's | 36 // The given hostname will be compared with the name(s) in the server's |
35 // certificate during the SSL handshake. ssl_config specifies the SSL | 37 // certificate during the SSL handshake. ssl_config specifies the SSL |
36 // settings. | 38 // settings. |
37 SSLClientSocketNSS(ClientSocket* transport_socket, | 39 SSLClientSocketNSS(ClientSocketHandle* transport_socket, |
38 const std::string& hostname, | 40 const std::string& hostname, |
39 const SSLConfig& ssl_config); | 41 const SSLConfig& ssl_config); |
40 ~SSLClientSocketNSS(); | 42 ~SSLClientSocketNSS(); |
41 | 43 |
42 // SSLClientSocket methods: | 44 // SSLClientSocket methods: |
43 virtual void GetSSLInfo(SSLInfo* ssl_info); | 45 virtual void GetSSLInfo(SSLInfo* ssl_info); |
44 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 46 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
45 virtual NextProtoStatus GetNextProto(std::string* proto); | 47 virtual NextProtoStatus GetNextProto(std::string* proto); |
46 | 48 |
47 // ClientSocket methods: | 49 // ClientSocket methods: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // argument. | 111 // argument. |
110 static void HandshakeCallback(PRFileDesc* socket, void* arg); | 112 static void HandshakeCallback(PRFileDesc* socket, void* arg); |
111 | 113 |
112 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; | 114 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; |
113 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; | 115 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; |
114 bool transport_send_busy_; | 116 bool transport_send_busy_; |
115 bool transport_recv_busy_; | 117 bool transport_recv_busy_; |
116 scoped_refptr<IOBuffer> recv_buffer_; | 118 scoped_refptr<IOBuffer> recv_buffer_; |
117 | 119 |
118 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; | 120 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; |
119 scoped_ptr<ClientSocket> transport_; | 121 scoped_ptr<ClientSocketHandle> transport_; |
120 std::string hostname_; | 122 std::string hostname_; |
121 SSLConfig ssl_config_; | 123 SSLConfig ssl_config_; |
122 | 124 |
123 CompletionCallback* user_connect_callback_; | 125 CompletionCallback* user_connect_callback_; |
124 CompletionCallback* user_read_callback_; | 126 CompletionCallback* user_read_callback_; |
125 CompletionCallback* user_write_callback_; | 127 CompletionCallback* user_write_callback_; |
126 | 128 |
127 // Used by Read function. | 129 // Used by Read function. |
128 scoped_refptr<IOBuffer> user_read_buf_; | 130 scoped_refptr<IOBuffer> user_read_buf_; |
129 int user_read_buf_len_; | 131 int user_read_buf_len_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // 2. Copy client certificates from the "MY" system certificate store into | 177 // 2. Copy client certificates from the "MY" system certificate store into |
176 // this store so that we can close the system store when we finish | 178 // this store so that we can close the system store when we finish |
177 // searching for client certificates. | 179 // searching for client certificates. |
178 static HCERTSTORE cert_store_; | 180 static HCERTSTORE cert_store_; |
179 #endif | 181 #endif |
180 }; | 182 }; |
181 | 183 |
182 } // namespace net | 184 } // namespace net |
183 | 185 |
184 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 186 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
OLD | NEW |