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>
69 const std::string& ca_file,
70 const std::string& cert_file,
71 const std::string& key_file,
72 bool cert_required =
true);
125 io_service_(io_service), tls_context_(tls_context) {
139template <
typename Callback,
typename TlsStreamImpl>
StreamService(const IOServicePtr &io_service, TlsContextPtr &tls_context)
Constructor.
virtual ~TlsContextBase()
Destructor.
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 setCertRequired(bool cert_required)=0
Set the peer certificate requirement mode.
virtual void loadCertFile(const std::string &cert_file)=0
Load the certificate file.
virtual bool getCertRequired() const =0
Get the peer certificate requirement mode.
virtual void loadKeyFile(const std::string &key_file)=0
Load the private key from a file.
virtual void loadCaFile(const std::string &ca_file)=0
Load the trust anchor aka certification authority.
TlsContextBase(TlsRole role)
Create a fresh context.
TlsRole getRole() const
Returns the role.
TlsRole getRole() const
Returns the role.
TlsStreamBase(const IOServicePtr &service, TlsContextPtr context)
Constructor.
virtual void handshake(Callback &callback)=0
TLS Handshake.
virtual std::string getIssuer()=0
Return the commonName part of the issuerName of the peer certificate.
TlsRole role_
The role i.e. client or server.
virtual ~TlsStreamBase()
Destructor.
virtual std::string getSubject()=0
Return the commonName part of the subjectName of the peer certificate.
virtual void shutdown(Callback &callback)=0
TLS shutdown.
A wrapper interface for the ASIO library.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
TlsRole
Client and server roles.
Defines the logger used by the top-level component of kea-lfc.