blob: 0e45a6a3104641f36def97c794fd054ad81e4abb [file] [log] [blame]
[email protected]c8a80e92014-05-17 16:02:081// 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
svaldeze83af292016-04-26 14:33:375#ifndef NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_
6#define NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_
[email protected]c8a80e92014-05-17 16:02:087
tbansalf82cc8e2015-10-14 20:05:498#include <stdint.h>
9
danakj655b66c2016-04-16 00:51:3810#include <memory>
11
Avi Drissman13fc8932015-12-20 04:40:4612#include "base/macros.h"
[email protected]c8a80e92014-05-17 16:02:0813#include "net/base/io_buffer.h"
[email protected]c8a80e92014-05-17 16:02:0814#include "net/socket/ssl_server_socket.h"
svaldez6e7e82a22015-10-28 19:39:5315#include "net/ssl/ssl_server_config.h"
tfarinae8cb8aa2016-10-21 02:44:0116#include "third_party/boringssl/src/include/openssl/base.h"
[email protected]c8a80e92014-05-17 16:02:0817
[email protected]c8a80e92014-05-17 16:02:0818namespace net {
19
svaldeze83af292016-04-26 14:33:3720class SSLServerContextImpl : public SSLServerContext {
[email protected]c8a80e92014-05-17 16:02:0821 public:
svaldeze83af292016-04-26 14:33:3722 SSLServerContextImpl(X509Certificate* certificate,
23 const crypto::RSAPrivateKey& key,
24 const SSLServerConfig& ssl_server_config);
Ryan Ki Sing Chung665861e2017-12-15 22:05:5525 SSLServerContextImpl(X509Certificate* certificate,
26 scoped_refptr<SSLPrivateKey> key,
27 const SSLServerConfig& ssl_server_config);
svaldeze83af292016-04-26 14:33:3728 ~SSLServerContextImpl() override;
[email protected]c8a80e92014-05-17 16:02:0829
danakj655b66c2016-04-16 00:51:3830 std::unique_ptr<SSLServerSocket> CreateSSLServerSocket(
31 std::unique_ptr<StreamSocket> socket) override;
[email protected]c8a80e92014-05-17 16:02:0832
33 private:
David Benjaminb8ab3852017-08-04 00:17:3234 class SocketImpl;
35
Ryan Ki Sing Chung665861e2017-12-15 22:05:5536 void Init();
37
davidbend80c12c2016-10-11 00:13:4938 bssl::UniquePtr<SSL_CTX> ssl_ctx_;
[email protected]c8a80e92014-05-17 16:02:0839
40 // Options for the SSL socket.
ryanchung987b2ff2016-02-19 00:17:1241 SSLServerConfig ssl_server_config_;
[email protected]c8a80e92014-05-17 16:02:0842
43 // Certificate for the server.
44 scoped_refptr<X509Certificate> cert_;
45
46 // Private key used by the server.
Ryan Ki Sing Chung665861e2017-12-15 22:05:5547 // Only one representation should be set at any time.
danakj655b66c2016-04-16 00:51:3848 std::unique_ptr<crypto::RSAPrivateKey> key_;
Ryan Ki Sing Chung665861e2017-12-15 22:05:5549 const scoped_refptr<SSLPrivateKey> private_key_;
[email protected]c8a80e92014-05-17 16:02:0850};
51
52} // namespace net
53
svaldeze83af292016-04-26 14:33:3754#endif // NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_