summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslsocket_winrt_p.h
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-08-28 14:05:49 +0300
committerAndrew Knight <andrew.knight@digia.com>2014-08-30 08:21:10 +0200
commit74a7f13ac153fa9c48ee72909ce0b3e4b4e882da (patch)
tree73f7145de286c00cedcb59c974457aba2036793b /src/network/ssl/qsslsocket_winrt_p.h
parent5328ec7e1043ac892b46afd4c315d4b8e3136aed (diff)
winrt: Implement missing SSL socket methods
Move from a stub to a functional SSL socket implementation. This implementation has some limitations. Due to the way the native SSL upgrade works, it is not possible to ignore SSL errors after the handshake has begun. The user must set the ignore flags before connecting to the host. Due to missing implementation in the underlying native socket, the synchronous methods (waitForConnected(), waitForDisconnected()) are not functional either. Users must rely on the asynchronous methods instead. This is not a problem in the general case, as HTTP(S) is not affected. SSL server sockets are not supported by the native API, so it is not possible to bind an SSL server socket. Change-Id: Id0b323f273892580b294aa5a6ff601a8241470df Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Diffstat (limited to 'src/network/ssl/qsslsocket_winrt_p.h')
-rw-r--r--src/network/ssl/qsslsocket_winrt_p.h48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/network/ssl/qsslsocket_winrt_p.h b/src/network/ssl/qsslsocket_winrt_p.h
index 791330a6fd..aa31c85d6e 100644
--- a/src/network/ssl/qsslsocket_winrt_p.h
+++ b/src/network/ssl/qsslsocket_winrt_p.h
@@ -39,30 +39,15 @@
**
****************************************************************************/
-/****************************************************************************
-**
-** In addition, as a special exception, the copyright holders listed above give
-** permission to link the code of its release of Qt with the OpenSSL project's
-** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the
-** same license as the original version), and distribute the linked executables.
-**
-** You must comply with the GNU General Public License version 2 in all
-** respects for all of the code used other than the "OpenSSL" code. If you
-** modify this file, you may extend this exception to your version of the file,
-** but you are not obligated to do so. If you do not wish to do so, delete
-** this exception statement from your version of this file.
-**
-****************************************************************************/
-
-#ifndef QSSLSOCKET_OPENSSL_P_H
-#define QSSLSOCKET_OPENSSL_P_H
+#ifndef QSSLSOCKET_WINRT_P_H
+#define QSSLSOCKET_WINRT_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
+// of the QtNetwork library. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
@@ -70,8 +55,24 @@
#include "qsslsocket_p.h"
+#include <wrl.h>
+#include <windows.networking.sockets.h>
+
QT_BEGIN_NAMESPACE
+class QSslSocketConnectionHelper : public QObject
+{
+ Q_OBJECT
+public:
+ QSslSocketConnectionHelper(QSslSocketBackendPrivate *d)
+ : d(d) { }
+
+ Q_INVOKABLE void disconnectSocketFromHost();
+
+private:
+ QSslSocketBackendPrivate *d;
+};
+
class QSslSocketBackendPrivate : public QSslSocketPrivate
{
Q_DECLARE_PUBLIC(QSslSocket)
@@ -89,13 +90,22 @@ public:
QSsl::SslProtocol sessionProtocol() const Q_DECL_OVERRIDE;
void continueHandshake() Q_DECL_OVERRIDE;
+ static QList<QSslCipher> defaultCiphers();
static QList<QSslError> verify(QList<QSslCertificate> certificateChain, const QString &hostName);
static bool importPKCS12(QIODevice *device,
QSslKey *key, QSslCertificate *cert,
QList<QSslCertificate> *caCertificates,
const QByteArray &passPhrase);
+
+private:
+ HRESULT onSslUpgrade(ABI::Windows::Foundation::IAsyncAction *,
+ ABI::Windows::Foundation::AsyncStatus);
+
+ QScopedPointer<QSslSocketConnectionHelper> connectionHelper;
+ ABI::Windows::Networking::Sockets::SocketProtectionLevel protectionLevel;
+ QSet<QSslCertificate> previousCaCertificates;
};
QT_END_NAMESPACE
-#endif
+#endif // QSSLSOCKET_WINRT_P_H