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_SERVER_SOCKET_NSS_H_ | 5 #ifndef NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ |
6 #define NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ | 6 #define NET_SOCKET_SSL_SERVER_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> |
(...skipping 15 matching lines...) Expand all Loading... |
26 // See comments on CreateSSLServerSocket for details of how these | 26 // See comments on CreateSSLServerSocket for details of how these |
27 // parameters are used. | 27 // parameters are used. |
28 SSLServerSocketNSS(scoped_ptr<StreamSocket> socket, | 28 SSLServerSocketNSS(scoped_ptr<StreamSocket> socket, |
29 scoped_refptr<X509Certificate> certificate, | 29 scoped_refptr<X509Certificate> certificate, |
30 crypto::RSAPrivateKey* key, | 30 crypto::RSAPrivateKey* key, |
31 const SSLServerConfig& ssl_config); | 31 const SSLServerConfig& ssl_config); |
32 ~SSLServerSocketNSS() override; | 32 ~SSLServerSocketNSS() override; |
33 | 33 |
34 // SSLServerSocket interface. | 34 // SSLServerSocket interface. |
35 int Handshake(const CompletionCallback& callback) override; | 35 int Handshake(const CompletionCallback& callback) override; |
| 36 void SetRequireClientCert(bool require_client_cert) override; |
| 37 void SetClientCertCAList(const CertificateList& client_cert_ca_list) override; |
| 38 void SetClientCertVerifier(CertVerifier* client_cert_verifier) override; |
36 | 39 |
37 // SSLSocket interface. | 40 // SSLSocket interface. |
38 int ExportKeyingMaterial(const base::StringPiece& label, | 41 int ExportKeyingMaterial(const base::StringPiece& label, |
39 bool has_context, | 42 bool has_context, |
40 const base::StringPiece& context, | 43 const base::StringPiece& context, |
41 unsigned char* out, | 44 unsigned char* out, |
42 unsigned int outlen) override; | 45 unsigned int outlen) override; |
43 int GetTLSUniqueChannelBinding(std::string* out) override; | 46 int GetTLSUniqueChannelBinding(std::string* out) override; |
44 | 47 |
45 // Socket interface (via StreamSocket). | 48 // Socket interface (via StreamSocket). |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void DoReadCallback(int result); | 103 void DoReadCallback(int result); |
101 void DoWriteCallback(int result); | 104 void DoWriteCallback(int result); |
102 | 105 |
103 static SECStatus OwnAuthCertHandler(void* arg, | 106 static SECStatus OwnAuthCertHandler(void* arg, |
104 PRFileDesc* socket, | 107 PRFileDesc* socket, |
105 PRBool checksig, | 108 PRBool checksig, |
106 PRBool is_server); | 109 PRBool is_server); |
107 static void HandshakeCallback(PRFileDesc* socket, void* arg); | 110 static void HandshakeCallback(PRFileDesc* socket, void* arg); |
108 | 111 |
109 int Init(); | 112 int Init(); |
| 113 void ExtractClientCert(); |
110 | 114 |
111 // Members used to send and receive buffer. | 115 // Members used to send and receive buffer. |
112 bool transport_send_busy_; | 116 bool transport_send_busy_; |
113 bool transport_recv_busy_; | 117 bool transport_recv_busy_; |
114 | 118 |
115 scoped_refptr<IOBuffer> recv_buffer_; | 119 scoped_refptr<IOBuffer> recv_buffer_; |
116 | 120 |
117 BoundNetLog net_log_; | 121 BoundNetLog net_log_; |
118 | 122 |
119 CompletionCallback user_handshake_callback_; | 123 CompletionCallback user_handshake_callback_; |
(...skipping 19 matching lines...) Expand all Loading... |
139 | 143 |
140 // Options for the SSL socket. | 144 // Options for the SSL socket. |
141 SSLServerConfig ssl_config_; | 145 SSLServerConfig ssl_config_; |
142 | 146 |
143 // Certificate for the server. | 147 // Certificate for the server. |
144 scoped_refptr<X509Certificate> cert_; | 148 scoped_refptr<X509Certificate> cert_; |
145 | 149 |
146 // Private key used by the server. | 150 // Private key used by the server. |
147 scoped_ptr<crypto::RSAPrivateKey> key_; | 151 scoped_ptr<crypto::RSAPrivateKey> key_; |
148 | 152 |
| 153 // Certificate of the client. |
| 154 scoped_refptr<X509Certificate> client_cert_; |
| 155 |
149 State next_handshake_state_; | 156 State next_handshake_state_; |
150 bool completed_handshake_; | 157 bool completed_handshake_; |
151 | 158 |
| 159 // Information to be used in CertificateRequest message. |
| 160 CertificateList client_cert_ca_list_; |
| 161 |
| 162 // Used to provide callback for client certificate verification. |
| 163 CertVerifier* client_cert_verifier_; |
| 164 |
152 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketNSS); | 165 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketNSS); |
153 }; | 166 }; |
154 | 167 |
155 } // namespace net | 168 } // namespace net |
156 | 169 |
157 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ | 170 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ |
OLD | NEW |