31 if( m_this ==
nullptr )
61 const std::string & ,
const std::string & ,
const std::string & ,
const std::string & )
72 throw G::Exception(
"invalid profile name: no tls library built in" ) ;
117 return Result::error ;
122 return Result::error ;
127 return Result::error ;
132 return Result::error ;
137 return Result::error ;
A class for objects that can perform a cryptographic hash.
std::string value()
Returns the hash value.
std::size_t statesize() const noexcept
Returns the size of the state() string in bytes, or zero if state() is not implemented.
std::string state()
Returns the intermediate state.
void add(std::string_view)
Adds data of arbitrary size.
std::size_t blocksize() const noexcept
Returns the hash function's block size in bytes.
std::size_t valuesize() const noexcept
Returns the hash function's value size in bytes.
Digester(std::unique_ptr< DigesterImpBase >)
Constructor, used by the Library class.
A singleton class for initialising the underlying TLS library.
static bool enabledAs(const std::string &profile_name)
A static convenience function that returns true if there is an enabled() Library instance() that has ...
bool hasProfile(const std::string &profile_name) const
Returns true if the named profile has been add()ed.
static Library * instance()
Returns a pointer to a library object, if any.
std::string id() const
Returns the TLS library name and version.
static std::string credit(const std::string &prefix, const std::string &eol, const std::string &eot)
Returns a multi-line library credit for all available TLS libraries.
static bool real()
Returns true if this is a real TLS library.
Library(bool active=true, const std::string &library_config={}, LogFn=Library::log, bool verbose=true)
Constructor.
static std::string ids()
Returns a concatenation of all available TLS library names and versions.
void addProfile(const std::string &profile_name, bool is_server_profile, const std::string &key_file={}, const std::string &cert_file={}, const std::string &ca_path={}, const std::string &default_peer_certificate_name={}, const std::string &default_peer_host_name={}, const std::string &profile_config={})
Creates a named Profile object that can be retrieved by profile().
const Profile & profile(const std::string &profile_name) const
Returns an opaque reference to the named profile.
bool enabled() const
Returns true if this is a real TLS library and the constructor's active parameter was set.
Digester digester(const std::string &name, const std::string &state={}, bool need_state=false) const
Returns a digester object.
static G::StringArray digesters(bool need_state=false)
Returns a list of hash function names (such as "MD5") that the TLS library can do,...
~Library()
Destructor. Cleans up the underlying TLS library.
static void log(int level, const std::string &line)
The default logging callback function, where the level is 1 for debug, 2 for info,...
A base interface for profile classes that work with concrete classes derived from GSsl::LibraryImpBas...
Result shutdown()
Initiates the protocol shutdown by sending a "close notify shutdown alert" and does a socket shutdown...
Result read(char *buffer, std::size_t buffer_size_in, ssize_t &data_size_out)
Reads user data into the supplied buffer.
Protocol(const Profile &, const std::string &peer_certificate_name={}, const std::string &peer_host_name={})
Constructor.
std::string cipher() const
Returns the cipher name, or the empty string if not yet available.
bool verified() const
Returns true if the peer certificate has been verified.
static std::string str(Result result)
Converts a result enumeration into a printable string.
std::string peerCertificateChain() const
Returns the peer certificate chain in PEM format, starting with the peer certificate and progressing ...
std::string protocol() const
Returns the protocol version like "TLSv1.2" or the empty string.
Result write(const char *buffer, std::size_t data_size_in, ssize_t &data_size_out)
Writes user data.
Result connect(G::ReadWrite &io)
Starts the protocol actively (as a client).
Result accept(G::ReadWrite &io)
Starts the protocol passively (as a server).
std::string peerCertificate() const
Returns the peer certificate in PEM format.
A general-purpose exception class derived from std::exception and containing an error message.
An abstract interface for reading and writing from a non-blocking i/o channel.
An interface to an underlying TLS library.
std::vector< std::string > StringArray
A std::vector of std::strings.