VideoTools
|
A singleton class for initialising the underlying TLS library. More...
#include <gssl.h>
Public Member Functions | |
Library (bool active=true, const std::string &extra_config=std::string()) | |
Constructor. More... | |
Library (bool active, const std::string &server_key_and_cert_file, const std::string &server_ca_file, const std::string &extra_config=std::string()) | |
A convenience constructor that adds two profiles; one called "server" using the two files, and one called "client". More... | |
~Library () | |
Destructor. Cleans up the underlying TLS library. | |
void | add (const std::string &profile_name, const std::string &key_and_cert_file=std::string(), const std::string &ca_file=std::string(), const std::string &profile_extra_config=std::string()) |
Creates a named Profile object that can be retrieved by profile(). More... | |
bool | has (const std::string &profile_name) const |
Returns true if the named profile has been add()ed. | |
const Profile & | profile (const std::string &profile_name) const |
Returns an opaque reference to the named profile. More... | |
bool | enabled () const |
Returns true if this is a real TLS library and the constructor's active parameter was set. More... | |
Static Public Member Functions | |
static Library * | instance () |
Returns a pointer to a library object, if any. | |
static std::string | id () |
Returns a library identifier (typically name and version). | |
static std::string | credit (const std::string &prefix, const std::string &eol, const std::string &eot) |
Returns a library credit string. | |
Friends | |
class | GSsl::Profile |
A singleton class for initialising the underlying TLS library.
|
explicit |
Constructor.
The 'active' parameter can be set to false as an optimisation if the library is not going to be used; calls to add() will do nothing, calls to has() will return false, and calls to profile() will throw.
Definition at line 28 of file gssl_none.cpp.
|
explicit |
A convenience constructor that adds two profiles; one called "server" using the two files, and one called "client".
Definition at line 34 of file gssl_none.cpp.
void GSsl::Library::add | ( | const std::string & | profile_name, |
const std::string & | key_and_cert_file = std::string() , |
||
const std::string & | ca_file = std::string() , |
||
const std::string & | profile_extra_config = std::string() |
||
) |
Creates a named Profile object that can be retrieved by profile().
A typical application will have two profiles named "client" and "server".
The "key-and-cert-file" parameter points to a file containing our own key and certificate. This is mandatory if acting as a server, ie. using Protocol::accept().
The "ca-file" parameter points to a file (or possibly a directory) containing a list of CA certificates. If this is supplied then peer certificates will be requested and verified. Special values of "<none>" and "<default>" have the obvious meaning. A "client" profile will normally use "<default>" so that it can verify the server.
The profile-extra-config string should be empty by default; the format and interpretation are undefined at this interface. An extra-config string can also be supplied to the Protocol, in which case this config string is completely ignored.
Definition at line 51 of file gssl_none.cpp.
bool GSsl::Library::enabled | ( | ) | const |
Returns true if this is a real TLS library and the constructor's active parameter was set.
Definition at line 65 of file gssl_none.cpp.
const GSsl::Profile & GSsl::Library::profile | ( | const std::string & | profile_name | ) | const |
Returns an opaque reference to the named profile.
The profile can be used to construct a protocol instance.
Definition at line 60 of file gssl_none.cpp.