Unsolved How to make Secure WebSocket Server doesn't verify clients
-
Hello,
I have a trouble with verification via WSS on server side. I need server doesn't ask for certificate, as client can connect from different https domains.
server code:m_pWebSocketServer(Q_NULLPTR) { m_pWebSocketServer = new QWebSocketServer(QStringLiteral("SSL Echo Server"), QWebSocketServer::SecureMode, this); QFile certFile(QStringLiteral("d:\\Qt\\test_proects\\build-SSLWebSocketServer-Desktop_Qt_5_9_1_MinGW_32bit-Debug\\debug\\localhost.cert")); QFile keyFile(QStringLiteral("d:\\Qt\\test_proects\\build-SSLWebSocketServer-Desktop_Qt_5_9_1_MinGW_32bit-Debug\\debug\\localhost.key")); certFile.open(QIODevice::ReadOnly); keyFile.open(QIODevice::ReadOnly); QSslCertificate certificate(&certFile, QSsl::Pem); QSslKey sslKey(&keyFile, QSsl::Rsa, QSsl::Pem); certFile.close(); keyFile.close(); QSslConfiguration sslConfiguration = QSslConfiguration::defaultConfiguration(); sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyNone); sslConfiguration.setLocalCertificate(certificate); sslConfiguration.setPrivateKey(sslKey); sslConfiguration.setProtocol(QSsl::AnyProtocol); m_pWebSocketServer->setSslConfiguration(sslConfiguration); if (m_pWebSocketServer->listen(QHostAddress::Any, port)) { qDebug() << "SSL Echo Server listening on port" << port; connect(m_pWebSocketServer, &QWebSocketServer::newConnection, this, &SslEchoServer::onNewConnection); connect(m_pWebSocketServer, &QWebSocketServer::sslErrors, this, &SslEchoServer::onSslErrors); connect(m_pWebSocketServer, &QWebSocketServer::peerVerifyError, this, &SslEchoServer::onPeerVerifyError); connect(m_pWebSocketServer, &QWebSocketServer::acceptError, this, &SslEchoServer::onAcceptError); }
On my client in the browser I get the error:
WebSocket connection to 'wss://...' failed: Error in connection establishment: net::ERR_INSECURE_RESPONSE