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