| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_IMPL_H_ | 5 #ifndef NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ |
| 6 #define NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ | 6 #define NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ |
| 7 | 7 |
| 8 #include <openssl/base.h> |
| 8 #include <stdint.h> | 9 #include <stdint.h> |
| 9 | 10 |
| 10 #include <memory> | 11 #include <memory> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 14 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
| 15 #include "net/socket/ssl_server_socket.h" | 16 #include "net/socket/ssl_server_socket.h" |
| 16 #include "net/ssl/scoped_openssl_types.h" | |
| 17 #include "net/ssl/ssl_server_config.h" | 17 #include "net/ssl/ssl_server_config.h" |
| 18 | 18 |
| 19 // Avoid including misc OpenSSL headers, i.e.: | |
| 20 // <openssl/bio.h> | |
| 21 typedef struct bio_st BIO; | |
| 22 // <openssl/ssl.h> | |
| 23 typedef struct ssl_st SSL; | |
| 24 typedef struct x509_store_ctx_st X509_STORE_CTX; | |
| 25 | |
| 26 namespace net { | 19 namespace net { |
| 27 | 20 |
| 28 class SSLInfo; | 21 class SSLInfo; |
| 29 | 22 |
| 30 class SSLServerContextImpl : public SSLServerContext { | 23 class SSLServerContextImpl : public SSLServerContext { |
| 31 public: | 24 public: |
| 32 SSLServerContextImpl(X509Certificate* certificate, | 25 SSLServerContextImpl(X509Certificate* certificate, |
| 33 const crypto::RSAPrivateKey& key, | 26 const crypto::RSAPrivateKey& key, |
| 34 const SSLServerConfig& ssl_server_config); | 27 const SSLServerConfig& ssl_server_config); |
| 35 ~SSLServerContextImpl() override; | 28 ~SSLServerContextImpl() override; |
| 36 | 29 |
| 37 std::unique_ptr<SSLServerSocket> CreateSSLServerSocket( | 30 std::unique_ptr<SSLServerSocket> CreateSSLServerSocket( |
| 38 std::unique_ptr<StreamSocket> socket) override; | 31 std::unique_ptr<StreamSocket> socket) override; |
| 39 | 32 |
| 40 private: | 33 private: |
| 41 ScopedSSL_CTX ssl_ctx_; | 34 bssl::UniquePtr<SSL_CTX> ssl_ctx_; |
| 42 | 35 |
| 43 // Options for the SSL socket. | 36 // Options for the SSL socket. |
| 44 SSLServerConfig ssl_server_config_; | 37 SSLServerConfig ssl_server_config_; |
| 45 | 38 |
| 46 // Certificate for the server. | 39 // Certificate for the server. |
| 47 scoped_refptr<X509Certificate> cert_; | 40 scoped_refptr<X509Certificate> cert_; |
| 48 | 41 |
| 49 // Private key used by the server. | 42 // Private key used by the server. |
| 50 std::unique_ptr<crypto::RSAPrivateKey> key_; | 43 std::unique_ptr<crypto::RSAPrivateKey> key_; |
| 51 }; | 44 }; |
| 52 | 45 |
| 53 } // namespace net | 46 } // namespace net |
| 54 | 47 |
| 55 #endif // NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ | 48 #endif // NET_SOCKET_SSL_SERVER_SOCKET_IMPL_H_ |
| OLD | NEW |