blob: 15de44d120405e7cffaa0e4838c77e360ac2b693 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#ifndef SSLTRUST_HPP
#define SSLTRUST_HPP
#include <QSslCertificate>
#include <QSslKey>
#include <QSettings>
#include <QSslError>
#include "trustedhostcollection.hpp"
struct SslTrust
{
enum TrustLevel {
TrustOnFirstUse = 0, // default
TrustEverything = 1, // not recommended
TrustNoOne = 2, // approve every fingerprint by hand
};
SslTrust() = default;
SslTrust(SslTrust const &) = default;
SslTrust(SslTrust &&) = default;
SslTrust & operator=(SslTrust const &) = default;
SslTrust & operator=(SslTrust &&) = default;
TrustLevel trust_level = TrustOnFirstUse;
TrustedHostCollection trusted_hosts;
bool enable_ca = false;
void load(QSettings & settings);
void save(QSettings & settings) const;
bool isTrusted(QUrl const & url, QSslCertificate const & certificate);
static bool isTrustRelated(QSslError::SslError err);
};
#endif // SSLTRUST_HPP
|