X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fsslserver.cpp;h=dd0792e96255a105c6ac54c8fec00e6830c4e252;hb=08bace4e9ecf08273f094c0c6aa8b3363d38ac3e;hp=3d76b41f13fdec521117435fcb37539506fe8d56;hpb=4b22388af4ceb1c6c24c8c4436283c1e3c33dd1f;p=quassel.git diff --git a/src/core/sslserver.cpp b/src/core/sslserver.cpp index 3d76b41f..dd0792e9 100644 --- a/src/core/sslserver.cpp +++ b/src/core/sslserver.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 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,7 +25,6 @@ #endif #include -#include #include "logger.h" #include "quassel.h" @@ -57,7 +56,7 @@ SslServer::SslServer(QObject *parent) quWarning() << "SslServer: Unable to set certificate file\n" << " Quassel Core will still work, but cannot provide SSL for client connections.\n" - << " Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support."; + << " Please see https://quassel-irc.org/faq/cert to learn how to enable SSL support."; sslWarningShown = true; } } @@ -112,12 +111,12 @@ bool SslServer::reloadCerts() quWarning() << "SslServer: Unable to reload certificate file, reverting\n" << " Quassel Core will use the previous key to provide SSL for client connections.\n" - << " Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support."; + << " Please see https://quassel-irc.org/faq/cert to learn how to enable SSL support."; } else { quWarning() << "SslServer: Unable to reload certificate file\n" << " Quassel Core will still work, but cannot provide SSL for client connections.\n" - << " Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support."; + << " Please see https://quassel-irc.org/faq/cert to learn how to enable SSL support."; } return false; } @@ -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