I got a sample projct that uses QSslSocket
and QSslCertificate
to get information from a SSL certificate (Qt 5.7, Windows 10). QSslSocket::supportsSsl()
function returns false and I get these errors at runtime:
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
So I compiled OpenSSL_1.1.0 and linked it to my project:
INCLUDEPATH += . "C:/OpenSSL-Win32/include/" LIBS +=
-L"C:/OpenSSL-Win32/lib/" -llibcrypto -llibssl
But still same errors. I downloaded OpenSSL installer and still the same.
Weird is QSslSocket::sslLibraryBuildVersionString()
returns OpenSSL 1.0.2g 1 Mar 2016
, even though I compiled and installed OpenSSL_1.1.0.
I know I'm missing a simple detail. Please tell me what is it. Thanks.
From the documentation:
QSslSocket::sslLibraryBuildVersionString()
Returns the version string of the SSL library in use at compile time. (emphasis mine)
That you get a result from it doesn't mean that Qt has access to OpenSSL, only that it was compiled against a certain version. That lets you know what binary-compatible version you should provide at runtime if it's dynamically linked (as it is by default).
You want to check QSslSocket::sslLibraryVersionNumber()
- [...] the version of the library in use at run-time (emphasis mine).
Qt will presumably attempt to find a copy of OpenSSL dlls in PATH
, and if not, in the paths given by QCoreApplication::libraryPaths
. You should add the location of OpenSSL dlls to either one before attempting to use OpenSSL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With