[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
svaldez | e83af29 | 2016-04-26 14:33:37 | [diff] [blame] | 5 | #ifndef NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ |
6 | #define NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ | ||||
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 7 | |
tbansal | f82cc8e | 2015-10-14 20:05:49 | [diff] [blame] | 8 | #include <stdint.h> |
9 | |||||
danakj | 655b66c | 2016-04-16 00:51:38 | [diff] [blame] | 10 | #include <memory> |
11 | |||||
Avi Drissman | 13fc893 | 2015-12-20 04:40:46 | [diff] [blame] | 12 | #include "base/macros.h" |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 13 | #include "net/base/io_buffer.h" |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 14 | #include "net/socket/ssl_server_socket.h" |
svaldez | 6e7e82a2 | 2015-10-28 19:39:53 | [diff] [blame] | 15 | #include "net/ssl/ssl_server_config.h" |
tfarina | e8cb8aa | 2016-10-21 02:44:01 | [diff] [blame] | 16 | #include "third_party/boringssl/src/include/openssl/base.h" |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 17 | |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 18 | namespace net { |
19 | |||||
svaldez | e83af29 | 2016-04-26 14:33:37 | [diff] [blame] | 20 | class SSLServerContextImpl : public SSLServerContext { |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 21 | public: |
svaldez | e83af29 | 2016-04-26 14:33:37 | [diff] [blame] | 22 | SSLServerContextImpl(X509Certificate* certificate, |
23 | const crypto::RSAPrivateKey& key, | ||||
24 | const SSLServerConfig& ssl_server_config); | ||||
Ryan Ki Sing Chung | 665861e | 2017-12-15 22:05:55 | [diff] [blame] | 25 | SSLServerContextImpl(X509Certificate* certificate, |
26 | scoped_refptr<SSLPrivateKey> key, | ||||
27 | const SSLServerConfig& ssl_server_config); | ||||
svaldez | e83af29 | 2016-04-26 14:33:37 | [diff] [blame] | 28 | ~SSLServerContextImpl() override; |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 29 | |
danakj | 655b66c | 2016-04-16 00:51:38 | [diff] [blame] | 30 | std::unique_ptr<SSLServerSocket> CreateSSLServerSocket( |
31 | std::unique_ptr<StreamSocket> socket) override; | ||||
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 32 | |
33 | private: | ||||
David Benjamin | b8ab385 | 2017-08-04 00:17:32 | [diff] [blame] | 34 | class SocketImpl; |
35 | |||||
Ryan Ki Sing Chung | 665861e | 2017-12-15 22:05:55 | [diff] [blame] | 36 | void Init(); |
37 | |||||
davidben | d80c12c | 2016-10-11 00:13:49 | [diff] [blame] | 38 | bssl::UniquePtr<SSL_CTX> ssl_ctx_; |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 39 | |
40 | // Options for the SSL socket. | ||||
ryanchung | 987b2ff | 2016-02-19 00:17:12 | [diff] [blame] | 41 | SSLServerConfig ssl_server_config_; |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 42 | |
43 | // Certificate for the server. | ||||
44 | scoped_refptr<X509Certificate> cert_; | ||||
45 | |||||
46 | // Private key used by the server. | ||||
Ryan Ki Sing Chung | 665861e | 2017-12-15 22:05:55 | [diff] [blame] | 47 | // Only one representation should be set at any time. |
danakj | 655b66c | 2016-04-16 00:51:38 | [diff] [blame] | 48 | std::unique_ptr<crypto::RSAPrivateKey> key_; |
Ryan Ki Sing Chung | 665861e | 2017-12-15 22:05:55 | [diff] [blame] | 49 | const scoped_refptr<SSLPrivateKey> private_key_; |
[email protected] | c8a80e9 | 2014-05-17 16:02:08 | [diff] [blame] | 50 | }; |
51 | |||||
52 | } // namespace net | ||||
53 | |||||
svaldez | e83af29 | 2016-04-26 14:33:37 | [diff] [blame] | 54 | #endif // NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ |