/* */ #ifndef _D_LIBGNUTLS_TLS_CONTEXT_H_ #define _D_LIBGNUTLS_TLS_CONTEXT_H_ #include "common.h" #include #include #include "DlAbortEx.h" namespace aria2 { class Logger; class TLSContext { private: gnutls_certificate_credentials_t _certCred; bool _good; bool _peerVerificationEnabled; Logger* _logger; public: TLSContext(); ~TLSContext(); // private key `keyfile' must be decrypted. void addClientKeyFile(const std::string& certfile, const std::string& keyfile) throw(DlAbortEx); // certfile can contain multiple certificates. void addTrustedCACertFile(const std::string& certfile) throw(DlAbortEx); bool good() const; bool bad() const; gnutls_certificate_credentials_t getCertCred() const; void enablePeerVerification(); void disablePeerVerification(); bool peerVerificationEnabled() const; }; } // namespace aria2 #endif // _D_LIBGNUTLS_TLS_CONTEXT_H_