summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslsocket_openssl_p.h
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-03-23 11:01:42 +0000
committerQt by Nokia <qt-info@nokia.com>2012-04-11 15:49:02 +0200
commit7386ab17df94e58efeb2f2fba91b9f816834c077 (patch)
tree7c74a96457f9d9ab36fa09b4a38f32602d54182d /src/network/ssl/qsslsocket_openssl_p.h
parent62cda62c0c70a75de3f87cbd802a1be24d27ef18 (diff)
Use windows API to update missing CA roots
Windows ships with a minimal set of CA roots. When using windows API to verify a certificate, it will fetch the root certificate from windows update (assuming it is part of the Microsoft trust program). As we are using openssl, this does not happen transparently. If SSL errors occur which indicate a broken chain then attempt to fix it using the windows API before emitting sslErrors. If the system CA certs are not in use (a CA bundle has been set on the socket or as the global configuration), then this is skipped. This is so an application can continue to use its own cert bundle rather than trusting the system certs. Key usage is specified, so that windows will return not trusted status if the root is not suitable for SSL (server auth or client auth OID). Testability: - to test, must delete the CA cert(s) from the "third party root certification authorities" section of the cert store using mmc.exe. - If the workaround of installing the windows XP cert bundle was performed, then you also need to delete certs from the "trusted root certification authorities" section. This is dangerous, be careful not to delete the required certificates which are documented on MS website - Naturally, modifying these areas of the cert store requires elevated privilege. Task-number: QTBUG-24827 Change-Id: I5cfe71c8a10595731f6bbbbabaaefa3313496654 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/ssl/qsslsocket_openssl_p.h')
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index b31eae9c97..deeceb8d85 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -117,6 +117,11 @@ public:
void disconnected();
QSslCipher sessionCipher() const;
void continueHandshake();
+ bool checkSslErrors();
+#ifdef Q_OS_WIN
+ void fetchCaRootForCert(const QSslCertificate &cert);
+ void _q_caRootLoaded(QSslCertificate,QSslCertificate);
+#endif
Q_AUTOTEST_EXPORT static long setupOpenSslOptions(QSsl::SslProtocol protocol, QSsl::SslOptions sslOptions);
static QSslCipher QSslCipher_from_SSL_CIPHER(SSL_CIPHER *cipher);
@@ -127,6 +132,23 @@ public:
static QString getErrorsFromOpenSsl();
};
+#ifdef Q_OS_WIN
+class QWindowsCaRootFetcher : public QObject
+{
+ Q_OBJECT;
+public:
+ QWindowsCaRootFetcher(const QSslCertificate &certificate, QSslSocket::SslMode sslMode);
+ ~QWindowsCaRootFetcher();
+public slots:
+ void start();
+signals:
+ void finished(QSslCertificate brokenChain, QSslCertificate caroot);
+private:
+ QSslCertificate cert;
+ QSslSocket::SslMode mode;
+};
+#endif
+
QT_END_NAMESPACE
#endif