From 9ce9789dab68fe453841ad022993092dfb3e4aeb Mon Sep 17 00:00:00 2001 From: "chaocc.wang" <54393160+ChaoCcWang@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:51:57 +0800 Subject: [PATCH 1/4] trans startedEncryptionHandshake signal to class:qwebsocketserver --- src/websockets/qwebsocketserver.h | 1 + src/websockets/qwebsocketserver_p.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/websockets/qwebsocketserver.h b/src/websockets/qwebsocketserver.h index ceb9106b..ff9c945f 100644 --- a/src/websockets/qwebsocketserver.h +++ b/src/websockets/qwebsocketserver.h @@ -159,6 +159,7 @@ class Q_WEBSOCKETS_EXPORT QWebSocketServer : public QObject void sslErrors(const QList &errors); void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator); #endif + void preStartedEncryptionHandshake(QSslSocket *pTcpSocket); void closed(); }; diff --git a/src/websockets/qwebsocketserver_p.cpp b/src/websockets/qwebsocketserver_p.cpp index 3196ca79..96935efc 100644 --- a/src/websockets/qwebsocketserver_p.cpp +++ b/src/websockets/qwebsocketserver_p.cpp @@ -101,6 +101,8 @@ void QWebSocketServerPrivate::init() Qt::QueuedConnection); QObjectPrivate::connect(pSslServer, &QSslServer::startedEncryptionHandshake, this, &QWebSocketServerPrivate::startHandshakeTimeout); + QObject::connect(pSslServer, &QSslServer::startedEncryptionHandshake, + q, &QWebSocketServer::preStartedEncryptionHandshake); QObject::connect(pSslServer, &QSslServer::peerVerifyError, q, &QWebSocketServer::peerVerifyError); QObject::connect(pSslServer, &QSslServer::sslErrors, From 0a328ec5a68b4627dd0170710c02c35f9b803e2f Mon Sep 17 00:00:00 2001 From: "chaocc.wang" <54393160+ChaoCcWang@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:12:50 +0800 Subject: [PATCH 2/4] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 49f75d1b..27510e08 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,6 @@ To use, add `websockets` to the QT variable. ### Missing Features * Extensions and sub-protocols + +### License +This code is licensed under LGPLv3 or LGPLv2.1. From 1e27bd6917ab79a9c6c2ee2573b7eee118f35ac1 Mon Sep 17 00:00:00 2001 From: "chaocc.wang" <54393160+ChaoCcWang@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:14:02 +0800 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27510e08..09f9f376 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,4 @@ To use, add `websockets` to the QT variable. * Extensions and sub-protocols ### License -This code is licensed under LGPLv3 or LGPLv2.1. +This code is licensed under LGPLv3. From 58aabc309a0dbb143fb1386aa4d56bcac0ee8e43 Mon Sep 17 00:00:00 2001 From: "chaocc.wang" <54393160+ChaoCcWang@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:35:31 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 09f9f376..3770c920 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,18 @@ It is implemented as a Qt add-on module, that can easily be embedded into existi * Strict Unicode checking * WSS and proxy support +### Update Notice +In this update, we have added a pre-shared encryption handshake feature to QWebSocketServer, enhancing the security of communication between the server and clients. +#### New Feature +- Pre-Shared Encryption Handshake + - Files: `QWebSocketServer.h` and `QWebSocketServer.cpp` + - Added the `preSharedEncryptionHandshake` function to handle encryption handshakes using pre-shared keys. + +```c++ +void preStartedEncryptionHandshake(QSslSocket *pTcpSocket); +``` +This modification is based on the Qt source code. For more information, please visit the [Qt website](https://qt.io). + ### Requirements Qt 5.x