summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2011-03-25 12:45:24 (GMT)
committerTimo Turunen <timo.p.turunen@nokia.com>2011-03-28 16:39:56 (GMT)
commitb3f64f1b4eb949bd639c4a088121a4c5ad2eb743 (patch)
treec0d96bcaf3896aba77e683b96f0930f9ed548cea
parent1f6c02c290b3330c7c784c83b1c0f8a94155f9e5 (diff)
downloadQt-b3f64f1b4eb949bd639c4a088121a4c5ad2eb743.zip
Qt-b3f64f1b4eb949bd639c4a088121a4c5ad2eb743.tar.gz
Qt-b3f64f1b4eb949bd639c4a088121a4c5ad2eb743.tar.bz2
QSslSocket internals: abort on encountering blacklisted certificates
tested manually with "openssl s_server -cert blacklisted.pem -key key.pem" and connecting a QSslSocket. Reviewed-by: Markus Goetz Task-number: QTBUG-18338 (cherry picked from commit b87528a71b66e786c11804d7b79e408aae612748)
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 7395c0a..0024ee6 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1183,6 +1183,13 @@ bool QSslSocketBackendPrivate::startHandshake()
X509 *x509 = q_SSL_get_peer_certificate(ssl);
configuration.peerCertificate = QSslCertificatePrivate::QSslCertificate_from_X509(x509);
q_X509_free(x509);
+ if (QSslCertificatePrivate::isBlacklisted(configuration.peerCertificate)) {
+ q->setErrorString(QSslSocket::tr("The peer certificate is blacklisted"));
+ q->setSocketError(QAbstractSocket::SslHandshakeFailedError);
+ emit q->error(QAbstractSocket::SslHandshakeFailedError);
+ plainSocket->disconnectFromHost();
+ return false;
+ }
// Start translating errors.
QList<QSslError> errors;