30 if( m_this ==
nullptr )
60 const std::string & ,
const std::string & ,
const std::string & ,
const std::string & )
86 return std::string() ;
117 return Result_error ;
122 return Result_error ;
127 return Result_error ;
132 return Result_error ;
137 return Result_error ;
142 return std::string() ;
147 return std::string() ;
152 return std::string() ;
173 return std::string() ;
178 return std::string() ;
A base interface for profile classes that work with concrete classes derived from GSsl::LibraryImpBas...
static Library * instance()
Returns a pointer to a library object, if any.
std::string peerCertificateChain() const
Returns the peer certificate chain in PEM format, starting with the peer certificate and progressing ...
An interface to an underlying TLS library.
Digester digester(const std::string &name, const std::string &state=std::string()) const
Returns a digester object.
An abstract interface for reading and writing from a non-blocking i/o channel.
std::string state()
Returns the intermediate state.
static G::StringArray digesters(bool require_state=false)
Returns a list of hash function names (such as "MD5") that the TLS library can do, ordered roughly from strongest to weakest.
bool hasProfile(const std::string &profile_name) const
Returns true if the named profile has been add()ed.
std::vector< std::string > StringArray
A std::vector of std::strings.
static bool enabledAs(const std::string &profile_name)
A static convenience function that returns true if there is an enabled() Library instance() that has ...
static std::string str(Result result)
Converts a result enumeration into a printable string.
void addProfile(const std::string &profile_name, bool is_server_profile, const std::string &key_file=std::string(), const std::string &cert_file=std::string(), const std::string &ca_path=std::string(), const std::string &default_peer_certificate_name=std::string(), const std::string &default_peer_host_name=std::string(), const std::string &profile_config=std::string())
Creates a named Profile object that can be retrieved by profile().
~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, 3 for warnings, and 4 for errors.
Protocol(const Profile &, const std::string &peer_certificate_name=std::string(), const std::string &peer_host_name=std::string())
Constructor.
Result stop()
Initiates the protocol shutdown.
Returns an object that can perform a cryptographic hash.
Result read(char *buffer, size_t buffer_size_in, ssize_t &data_size_out)
Reads user data into the supplied buffer.
Result accept(G::ReadWrite &io)
Starts the protocol passively (as a server).
std::string value()
Returns the hash value.
Result connect(G::ReadWrite &io)
Starts the protocol actively (as a client).
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.
Digester(DigesterImpBase *)
Constructor, used by the Library class.
const Profile & profile(const std::string &profile_name) const
Returns an opaque reference to the named profile.
std::string peerCertificate() const
Returns the peer certificate in PEM format.
size_t valuesize() const
Returns the hash function's value size in bytes.
Library(bool active=true, const std::string &library_config=std::string(), LogFn=Library::log, bool verbose=true)
Constructor.
void add(const std::string &)
Adds data of arbitrary size.
static std::string ids()
Returns a concatenation of all available TLS library names and versions.
Result write(const char *buffer, size_t data_size_in, ssize_t &data_size_out)
Writes user data.
A general-purpose exception class derived from std::exception and containing a std::string.
A singleton class for initialising the underlying TLS library.
static bool real()
Returns true if this is a real TLS library.
size_t statesize() const
Returns the size of the state() string in bytes, or zero if state() is not implemented.
bool enabled() const
Returns true if this is a real TLS library and the constructor's active parameter was set...
size_t blocksize() const
Returns the hash function's block size in bytes.
bool verified() const
Returns true if the peer certificate has been verified.
std::string id() const
Returns the TLS library name and version.