MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
ssl_context.hpp
1#ifndef MSTL_NETWORK_SSL_CONTEXT_HPP__
2#define MSTL_NETWORK_SSL_CONTEXT_HPP__
3#ifdef MSTL_SUPPORT_OPENSSL__
4#include "MSTL/core/string/string.hpp"
5#include <openssl/ssl.h>
7
8class MSTL_API ssl_context {
9public:
10 ssl_context() = default;
11 ~ssl_context();
12
13 bool load_certificate(const string& cert_file, const string& key_file);
14 MSTL_NODISCARD ::SSL_CTX* context() const noexcept { return ctx_; }
15
16 MSTL_NODISCARD bool is_valid() const noexcept { return ctx_ != nullptr; }
17
18private:
19 ::SSL_CTX* ctx_ = nullptr;
20};
21
23#endif
24#endif // MSTL_NETWORK_SSL_CONTEXT_HPP__
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL