Use windows API to update missing CA roots
authorShane Kearns <ext-shane.2.kearns@nokia.com>
Fri, 23 Mar 2012 11:01:42 +0000 (11:01 +0000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 11 Apr 2012 13:49:02 +0000 (15:49 +0200)
commit7386ab17df94e58efeb2f2fba91b9f816834c077
tree7c74a96457f9d9ab36fa09b4a38f32602d54182d
parent62cda62c0c70a75de3f87cbd802a1be24d27ef18
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>
src/network/ssl/qsslsocket.h
src/network/ssl/qsslsocket_openssl.cpp
src/network/ssl/qsslsocket_openssl_p.h
src/network/ssl/qsslsocket_p.h
src/network/ssl/ssl.pri