|
|
| TlsContext (const DataArray &k, const DataArray &c, const DataArrayList &t, const std::string &={}, uint8_t=0) |
| |
|
| TlsContext (const TlsContext &) |
| |
|
| TlsContext (const TlsContext &&)=delete |
| |
|
TlsContext & | operator= (const TlsContext &) |
| |
|
DataArray | key () const |
| |
|
DataArray | certificate () const |
| |
|
DataArrayList | trusted () const |
| |
|
bool | setKey (const DataArray &) |
| |
|
bool | setCertificate (const DataArray &) |
| |
|
bool | appendTrusted (const DataArray &) |
| |
|
bool | setDefaultVerifyPaths () |
| |
|
bool | empty () const |
| |
|
bool | verifyCertificate () const |
| |
|
bool | generateKey (int=2048) |
| |
|
bool | generateCertificate (const std::vector< std::pair< std::string, std::string > > &={{"CN", "Root-CA"}}, const std::string &={}, const std::string &="CA:TRUE,pathlen:1", int=365) |
| |
|
DataArray | generateRequest (const std::vector< std::pair< std::string, std::string > > &, const std::string &={}, const std::string &={}) |
| |
|
DataArray | signRequest (DataArray &, int=365) |
| |
|
std::string | commonName () const |
| |
|
std::string | infoKey () const |
| |
|
std::string | infoCertificate () const |
| |
|
std::string | infoTrusted () const |
| |
|
bool | verifyPeer () |
| |
|
void | setVerifyPeer (bool) |
| |
|
std::string & | verifyName () const |
| |
|
void | setVerifyName (const std::string &) const |
| |
|
void | setIgnoreErrors (uint8_t) const |
| |
The TlsContext class provides functionality for managing TLS certificates.
Examlpe:
#define KEY_BITS 2048
_root_ca.generateKey(KEY_BITS);
_root_ca.generateCertificate();
_ca.generateKey(KEY_BITS);
DataArray req = _ca.generateRequest({{
"C",
"RU"}, {
"CN",
"Eample-CA"}},
"",
"CA:TRUE,pathlen:0");
_ca.setCertificate(_root_ca.signRequest(req));
_cert.generateKey(KEY_BITS);
req = _cert.generateRequest({{"C", "RU"}, {"ST", "Region"}, {"CN", "Eample-cert"}, {"L", "Location"}, {"O", "Org"}, {"OU", "Org-unit"}, {"serialNumber", "device-000-00-00"}, {"emailAddress", "ssl@example.ru"}, {"dnQualifier", "Example-device"}}, "IP:192.168.1.101,IP:192.168.1.102,IP:192.168.1.103,IP:192.168.10.1,IP:192.168.10.100,IP:192.168.10.101,IP:192.168.10.102,IP:192.168.10.103");
_cert.setCertificate(_ca.signRequest(req));
logInfo() << _cert.infoCertificate();
socket->setContext(_cert);