Ported servatrice

This commit is contained in:
Fabio Bas 2014-06-24 18:42:46 +02:00
parent 80f68306b5
commit 2953c6ba2a
2 changed files with 38 additions and 4 deletions

View file

@ -234,8 +234,16 @@ bool Servatrice::initServer()
if (!certFile.open(QIODevice::ReadOnly))
throw QString("Error opening certificate file: %1").arg(certFileName);
QSslCertificate cert(&certFile);
#if QT_VERSION < 0x050000
if (!cert.isValid())
throw(QString("Invalid certificate."));
#else
const QDateTime currentTime = QDateTime::currentDateTime();
if(currentTime < cert.effectiveDate() ||
currentTime > cert.expiryDate() ||
cert.isBlacklisted())
throw(QString("Invalid certificate."));
#endif
qDebug() << "Loading private key...";
QFile keyFile(keyFileName);
if (!keyFile.open(QIODevice::ReadOnly))