2018-04-29 02:01:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-05-06 04:59:30 +00:00
|
|
|
#include <QSslConfiguration>
|
2018-06-27 08:31:18 +00:00
|
|
|
#include <QSslCertificate>
|
|
|
|
#include <QSslKey>
|
|
|
|
#include <QSettings>
|
2018-04-29 02:01:00 +00:00
|
|
|
|
|
|
|
class IdentityManager
|
|
|
|
{
|
|
|
|
public:
|
2018-04-29 05:14:27 +00:00
|
|
|
QString
|
|
|
|
getUniqueId();
|
|
|
|
|
|
|
|
QByteArray
|
|
|
|
getCertificate();
|
|
|
|
|
|
|
|
QByteArray
|
|
|
|
getPrivateKey();
|
|
|
|
|
2018-05-06 04:59:30 +00:00
|
|
|
QSslConfiguration
|
|
|
|
getSslConfig();
|
|
|
|
|
2018-06-27 02:01:40 +00:00
|
|
|
static
|
|
|
|
IdentityManager*
|
|
|
|
get();
|
|
|
|
|
2018-04-29 02:01:00 +00:00
|
|
|
private:
|
2018-06-27 02:01:40 +00:00
|
|
|
IdentityManager();
|
|
|
|
|
2018-06-27 08:31:18 +00:00
|
|
|
QSslCertificate
|
|
|
|
getSslCertificate();
|
2018-04-29 02:01:00 +00:00
|
|
|
|
2018-06-27 08:31:18 +00:00
|
|
|
QSslKey
|
|
|
|
getSslKey();
|
|
|
|
|
|
|
|
void
|
|
|
|
createCredentials(QSettings& settings);
|
|
|
|
|
|
|
|
// Initialized in constructor
|
2018-04-29 02:01:00 +00:00
|
|
|
QByteArray m_CachedPrivateKey;
|
2018-04-29 05:14:27 +00:00
|
|
|
QByteArray m_CachedPemCert;
|
2018-06-27 08:31:18 +00:00
|
|
|
|
|
|
|
// Lazy initialized
|
2018-04-29 05:14:27 +00:00
|
|
|
QString m_CachedUniqueId;
|
2018-06-27 08:31:18 +00:00
|
|
|
QSslCertificate m_CachedSslCert;
|
|
|
|
QSslKey m_CachedSslKey;
|
2018-06-27 02:01:40 +00:00
|
|
|
|
|
|
|
static IdentityManager* s_Im;
|
2018-04-29 02:01:00 +00:00
|
|
|
};
|