Added HTTPS support (backend)

This commit is contained in:
Ishan Arora
2011-05-07 13:48:42 +00:00
parent 122db6a77e
commit 669d1a3a46
3 changed files with 74 additions and 0 deletions

View File

@@ -37,6 +37,8 @@
#include <QTime>
#include <QList>
#include <QDebug>
#include <QSslCertificate>
#include <QSslKey>
#include <libtorrent/version.hpp>
#ifndef DISABLE_GUI
@@ -773,6 +775,36 @@ public:
return pass_ha1;
}
bool isWebUiHttpsEnabled() const {
return value("Preferences/WebUI/HTTPS/Enabled", false).toBool();
}
void setWebUiHttpsEnabled(bool enabled) {
setValue("Preferences/WebUI/HTTPS/Enabled", enabled);
}
QSslCertificate getWebUiHttpsCertificate() const {
return QSslCertificate(value("Preferences/WebUI/HTTPS/Certificate").toByteArray());
}
void setWebUiHttpsCertificate(QString filename) {
QFile file(filename);
file.open(QIODevice::ReadOnly);
setValue("Preferences/WebUI/HTTPS/Certificate", file.readAll());
file.close();
}
QSslKey getWebUiHttpsKey() const {
return QSslKey(value("Preferences/WebUI/HTTPS/Key").toByteArray(), QSsl::Rsa);
}
void setWebUiHttpsKey(QString filename) {
QFile file(filename);
file.open(QIODevice::ReadOnly);
setValue("Preferences/WebUI/HTTPS/Key", file.readAll());
file.close();
}
bool isDynDNSEnabled() const {
return value("Preferences/DynDNS/Enabled", false).toBool();
}