16 #error crypto_tls.h must be included in place of common_tls.h
21 #include <boost/noncopyable.hpp>
22 #include <boost/shared_ptr.hpp>
24 #include <netinet/in.h>
25 #include <sys/socket.h>
67 static void configure(TlsContextPtr& context,
69 const std::string& ca_file,
70 const std::string& cert_file,
71 const std::string& key_file,
72 bool cert_required =
true);
93 virtual void loadCaFile(
const std::string& ca_file) = 0;
100 virtual void loadCaPath(
const std::string& ca_path) = 0;
107 virtual void loadCertFile(
const std::string& cert_file) = 0;
114 virtual void loadKeyFile(
const std::string& key_file) = 0;
125 template <
typename Callback,
typename TlsStreamImpl>
147 virtual void handshake(Callback& callback) = 0;
152 virtual void shutdown(Callback& callback) = 0;
183 #endif // COMMON_TLS_H
TlsRole getRole() const
Returns the role.
virtual ~TlsContextBase()
Destructor.
TlsRole role_
The role i.e. client or server.
virtual std::string getIssuer()=0
Return the commonName part of the issuerName of the peer certificate.
virtual std::string getSubject()=0
Return the commonName part of the subjectName of the peer certificate.
The IOService class is a wrapper for the ASIO io_service class.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
TlsRole getRole() const
Returns the role.
virtual void loadCaPath(const std::string &ca_path)=0
Load the trust anchor aka certification authority.
static void configure(TlsContextPtr &context, TlsRole role, const std::string &ca_file, const std::string &cert_file, const std::string &key_file, bool cert_required=true)
Configure.
TlsRole role_
The role i.e. client or server.
virtual void handshake(Callback &callback)=0
TLS Handshake.
Defines the logger used by the top-level component of kea-dhcp-ddns.
TlsStreamBase(IOService &service, TlsContextPtr context)
Constructor.
virtual void loadKeyFile(const std::string &key_file)=0
Load the private key from a file.
virtual void shutdown(Callback &callback)=0
TLS shutdown.
A wrapper interface for the ASIO library.
virtual ~TlsStreamBase()
Destructor.
virtual void loadCertFile(const std::string &cert_file)=0
Load the certificate file.
TlsRole
Client and server roles.
virtual bool getCertRequired() const =0
Get the peer certificate requirement mode.
TlsContextBase(TlsRole role)
Create a fresh context.
virtual void setCertRequired(bool cert_required)=0
Set the peer certificate requirement mode.
virtual void loadCaFile(const std::string &ca_file)=0
Load the trust anchor aka certification authority.