/* */ #ifndef D_WIN_TLS_CONTEXT_H #define D_WIN_TLS_CONTEXT_H #include "common.h" #include "config.h" #include #include #include #include #include "TLSContext.h" #include "DlAbortEx.h" namespace aria2 { namespace wintls { struct cred_deleter { void operator()(CredHandle* handle) { if (handle) { FreeCredentialsHandle(handle); delete handle; } } }; typedef std::unique_ptr CredPtr; } // namespace wintls class WinTLSContext : public TLSContext { public: WinTLSContext(TLSSessionSide side, TLSVersion ver); virtual ~WinTLSContext(); // private key `keyfile' must be decrypted. virtual bool addCredentialFile(const std::string& certfile, const std::string& keyfile) CXX11_OVERRIDE; virtual bool addSystemTrustedCACerts() CXX11_OVERRIDE { return true; } // certfile can contain multiple certificates. virtual bool addTrustedCACertFile(const std::string& certfile) CXX11_OVERRIDE; virtual bool good() const CXX11_OVERRIDE { return true; } virtual TLSSessionSide getSide() const CXX11_OVERRIDE { return side_; } virtual bool getVerifyPeer() const CXX11_OVERRIDE; virtual void setVerifyPeer(bool verify) CXX11_OVERRIDE; CredHandle* getCredHandle(); private: TLSSessionSide side_; SCHANNEL_CRED credentials_; HCERTSTORE store_; wintls::CredPtr cred_; }; } // namespace aria2 #endif // D_LIBSSL_TLS_CONTEXT_H