Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trans startedEncryptionHandshake signal to class:qwebsocketserver #5

Open
wants to merge 4 commits into
base: 5.15
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -32,3 +44,6 @@ To use, add `websockets` to the QT variable.

### Missing Features
* Extensions and sub-protocols

### License
This code is licensed under LGPLv3.
1 change: 1 addition & 0 deletions src/websockets/qwebsocketserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class Q_WEBSOCKETS_EXPORT QWebSocketServer : public QObject
void sslErrors(const QList<QSslError> &errors);
void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator);
#endif
void preStartedEncryptionHandshake(QSslSocket *pTcpSocket);
void closed();
};

Expand Down
2 changes: 2 additions & 0 deletions src/websockets/qwebsocketserver_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down