QcTlsCredentials Struct
The certificate and private key a server shows in the TLS handshake (decision E-872): an EC key on P-256 from OpenSSL (QcTlsKey) and a self-signed certificate for it, whose structure this program writes in DER (QcDer), made once per installation and kept in its data folder next to server.json. More...
| Header: | #include <network/tls/QcTlsCredentials.h> |
Public Functions
| bool | isNull() const |
Public Variables
| QSslCertificate | certificate |
| QSslKey | privateKey |
Static Public Members
| const char[23] | certificateFileName |
| const char[15] | defaultCommonName |
| QcResult<QcTlsCredentials> | fromPem(const QByteArray &certificatePem, const QByteArray &keyPem) |
| QcResult<QcTlsCredentials> | generate(const QString &commonName = QString::fromLatin1(defaultCommonName)) |
| const char[15] | keyFileName |
| QcResult<QcTlsCredentials> | loadOrCreate(const QString &directory) |
Detailed Description
No authority signs it; clients pin it at their first connection (QcKnownServers), so it must stay the same: it is valid until 9000.
Member Function Documentation
[static] QcResult<QcTlsCredentials> QcTlsCredentials::fromPem(const QByteArray &certificatePem, const QByteArray &keyPem)
Returns the credentials in the PEM texts certificatePem and keyPem (the files, or a test's fixed credentials), or why they cannot be read.
[static] QcResult<QcTlsCredentials> QcTlsCredentials::generate(const QString &commonName = QString::fromLatin1(defaultCommonName))
Returns a new key and its certificate for commonName; fails in a build without TLS.
bool QcTlsCredentials::isNull() const
Returns true when the certificate or the key is missing.
[static] QcResult<QcTlsCredentials> QcTlsCredentials::loadOrCreate(const QString &directory)
Returns the two files in directory; when neither exists they are made and written, the key readable only by the user. A damaged or single file is an error and nothing is replaced: players have pinned the certificate, a new one would look like an attack to them. Without TLS (QcTlsBackend::enabled) empty credentials and no files.
Member Variable Documentation
const char[15] QcTlsCredentials::defaultCommonName
The subject of a new certificate.