X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fsslserver.cpp;h=183bbe18c7a486bb34f9d81b473f81806b4a7a7e;hb=f12d6496251729f7d21f4fbcb0814dec7fba4b75;hp=8b0d06577b292200b48ef95c48dfdfdfb4591643;hpb=c2e3479b87e7d0713d302d26fb2d7d01d7b8c9c2;p=quassel.git diff --git a/src/core/sslserver.cpp b/src/core/sslserver.cpp index 8b0d0657..183bbe18 100644 --- a/src/core/sslserver.cpp +++ b/src/core/sslserver.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -25,10 +25,9 @@ #endif #include -#include -#include "logger.h" #include "quassel.h" +#include "logmessage.h" #ifdef HAVE_SSL @@ -182,10 +181,10 @@ bool SslServer::setCertificate(const QString &path, const QString &keyPath) return false; } - untestedKey = QSslKey(&keyFile, QSsl::Rsa); + untestedKey = loadKey(&keyFile); keyFile.close(); } else { - untestedKey = QSslKey(&certFile, QSsl::Rsa); + untestedKey = loadKey(&certFile); } certFile.close(); @@ -227,4 +226,21 @@ bool SslServer::setCertificate(const QString &path, const QString &keyPath) } +QSslKey SslServer::loadKey(QFile *keyFile) +{ + QSslKey key; + key = QSslKey(keyFile, QSsl::Rsa); +#if QT_VERSION >= 0x050500 + if (key.isNull()) { + if (!keyFile->reset()) { + quWarning() << "SslServer: IO error reading key file"; + return key; + } + key = QSslKey(keyFile, QSsl::Ec); + } +#endif + return key; +} + + #endif // HAVE_SSL