Using QSslSocket with custom OpenSSL
-
You can build Qt with the
-openssl-linked
option and pointconfigure
to your self-built version of OpenSSL. -
@SGaist said in Using QSslSocket with custom OpenSSL:
You can build Qt with the
-openssl-linked
option and pointconfigure
to your self-built version of OpenSSL.i tried it that way, but buildung QT 5.7 with OpenSSL 1.1.0b ist not supported till QT 5.9 because in OpenSSL are some changes done, so that building QT 5.7 with that new OpenSSL version did not work. See here: https://bugreports.qt.io/browse/QTBUG-52905
Then i tried it with an older version of OpenSSL (1.0.2j) - this works.
But what ist the difference between building Qt gainst OpenSSL with -openssl on running the configure-command and to link against the OpenSSL headers and libs and build it inside the Project? If i build against OpenSSL i have to include the headers anyway to work with the libs if i want to use the OpenSSL specific stuff.
And i noticed that i can replace the built in OpenSSL libs with the own build one. So it would be much simpler to include the ehaders of OpenSSL via INCLUDEPATH. So i get OpenSSL support = true on output of: qDebug() << QSslSocket::supportsSsl();
And if print out his i got the Output which i wrote behind:
qDebug() << QSslSocket::sslLibraryBuildVersionString(); // OpenSSL 1.0.2g 1 Mar 2016
qDebug() << QSslSocket::sslLibraryVersionString(); // OpenSSL 1.0.2j 26 Sep 2016Why is the first one at all time: OpenSSL 1.0.2g 1 Mar 2016 - This i got, too if i build Qt at own and link against OpenSSL 1.0.2j??
-
It's in the docs:
sslLibraryBuildVersionString
is returning the version of the OpenSSL library used when building Qt.
sslLibraryVersionString
is returning the version of the OpenSSL library used at run time.By default OpenSSL is dlopened because some countries have restrictions about encryption related software and OpenSSL can't be distributed just like that.
-
Silly question but are you sure that you are using your self-build Qt in your kit ?
-
No, the Qt version used to build Qt Creator doesn't affect any any way the Qt version you are using with your kit.
Do you have another OpenSSL version installed on your system ?
-
@SGaist said in Using QSslSocket with custom OpenSSL:
on used to bui
no not installed like the precompiled OpenSSL Libraries. I searched the whole PC (Windows) for OpenSSL and libeay32.dll. I found many applications which are using OpenSSL but only one Application uses the specific OpenSSL version OpenSSL 1.0.2g 1 Mar 2016 i posted above. This Application is Adobe Lightroom.
Could this be the problem on building Qt that some shipped libeay32.dlls are used on build process?
-
@SGaist Sorry, i have the same problem.
When i print:
qDebug() << QSslSocket::supportsSsl(); ==> false
qDebug() << QSslSocket::sslLibraryBuildVersionString(); ==> "OpenSSL 1.0.2g 1 Mar 2016"
qDebug() << QSslSocket::sslLibraryVersionString(); ==> ""and i obtain these messages:
qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_errorI have instaled only Qt 5.7 on Windows 7 32. What can i do?
Thanks -
Hi,
Do you have OpenSSL installed ? Built with the same compiler as Qt ? In a folder known to your application ?
-
IIRC there was a renaming of the libraries of OpenSSL so you'll have to double check.