S
S
Sergey2020-09-13 22:45:33
Qt
Sergey, 2020-09-13 22:45:33

How to connect openssl to qt5?

I am using this example https://code.qt.io/cgit/qt/qtwebsockets.git/tree/e... to create a wss connection. (ws works)
With the addition of code:

connect( &m_webSocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error), [=](QAbstractSocket::SocketError) {
  qInfo() << "error" << m_webSocket.errorString();
});

Gives error "SSL Sockets are not supported on this platform."

qDebug() << "QSslSocket::sslLibraryBuildVersionString()" << QSslSocket::sslLibraryBuildVersionString();
qDebug() << "QSslSocket::sslLibraryVersionString()" << QSslSocket::sslLibraryVersionString();
qDebug() << "Supports SSL: " << QSslSocket::supportsSsl();

Gives
QSslSocket::sslLibraryBuildVersionString() "OpenSSL 1.1.1d 10 Sep 2019"
QSslSocket::sslLibraryVersionString() ""
Supports SSL: false

I didn't understand how to build it using mingw. Used Visual Studio:

perl Configure VC-WIN32 no-asm shared
nmake
nmake test
nmake install

Got C:\Program Files (x86)\OpenSSL
In terminal
OpenSSL> version
OpenSSL 1.1.1g 21 Apr 2020

What to do next? What and how to connect in the project file * .pro
Everything that I tried does not work, maybe I tried nonsense. Google didn't help much either.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ighor July, 2020-09-13
@IGHOR

>What and how to connect in the *.pro
LIBS project file += -lssl -lcrypto
https://doc.qt.io/qt-5/ssl.html

A
Alexander Ananiev, 2020-09-14
@SaNNy32

https://stackoverflow.com/questions/61388831/win-q...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question