aboutsummaryrefslogtreecommitdiff
path: root/src/ssltrust.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ssltrust.hpp')
-rw-r--r--src/ssltrust.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ssltrust.hpp b/src/ssltrust.hpp
new file mode 100644
index 0000000..62d4985
--- /dev/null
+++ b/src/ssltrust.hpp
@@ -0,0 +1,37 @@
+#ifndef SSLTRUST_HPP
+#define SSLTRUST_HPP
+
+#include <QSslCertificate>
+#include <QSslKey>
+#include <QSettings>
+
+#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);
+};
+
+#endif // SSLTRUST_HPP