/* */ #ifndef D_TLS_CONTEXT_H #define D_TLS_CONTEXT_H #include #include "common.h" namespace aria2 { enum TLSSessionSide { TLS_CLIENT, TLS_SERVER }; enum TLSVersion { TLS_PROTO_NONE, TLS_PROTO_SSL3, TLS_PROTO_TLS10, TLS_PROTO_TLS11, TLS_PROTO_TLS12, }; class TLSContext { public: static TLSContext* make(TLSSessionSide side, TLSVersion minVer); virtual ~TLSContext() {} // private key `keyfile' must be decrypted. virtual bool addCredentialFile(const std::string& certfile, const std::string& keyfile) = 0; virtual bool addSystemTrustedCACerts() = 0; // certfile can contain multiple certificates. virtual bool addTrustedCACertFile(const std::string& certfile) = 0; virtual bool good() const = 0; virtual TLSSessionSide getSide() const = 0; virtual bool getVerifyPeer() const = 0; virtual void setVerifyPeer(bool) = 0; }; } // namespace aria2 #endif // D_TLS_CONTEXT_H