/* */ #ifndef D_LIBSSL_TLS_CONTEXT_H #define D_LIBSSL_TLS_CONTEXT_H #include "common.h" #include # include #include "TLSContext.h" #include "DlAbortEx.h" namespace aria2 { class TLSContext { private: SSL_CTX* sslCtx_; TLSSessionSide side_; bool good_; bool peerVerificationEnabled_; public: TLSContext(TLSSessionSide side); ~TLSContext(); // private key `keyfile' must be decrypted. bool addCredentialFile(const std::string& certfile, const std::string& keyfile); bool addSystemTrustedCACerts(); // certfile can contain multiple certificates. bool addTrustedCACertFile(const std::string& certfile); bool good() const; bool bad() const; SSL_CTX* getSSLCtx() const { return sslCtx_; } TLSSessionSide getSide() const { return side_; } void enablePeerVerification(); void disablePeerVerification(); bool peerVerificationEnabled() const { return peerVerificationEnabled_; } }; } // namespace aria2 #endif // D_LIBSSL_TLS_CONTEXT_H