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.
INCLUDEPATHis unnecessary, of course, since you don't compile any code using openssl directly. All you need is theLIBS += ...line. If openssl is compiled as a dynamically linked library, you not only need to add its import library in the.profile, but you also need to ensure that it's in the path when you run your project!INCLUDEPATHand keptLIBSin.profile. Added OpenSSL'sbindirectory in%PATH%. StillQSslSocket::supportsSsl()returns false andQSslSocket::sslLibraryVersionString()returnsOpenSSL 1.0.2g 1 Mar 2016even though I compiled OpenSSL 1.1.0qDebug() << qgetenv("PATH");tomain()and ensure that your library path appears there and that it is correct. Copy-paste the library path from the debug output to an explorer window and make sure it's valid.C:\\OpenSSL-Win32\\libbut it's not valid. Recently I deleted everything and built OpenSSL from scratch inC:\openssl_1.1.0. How can I change it? I couldn't find its setting.