Tuesday, October 15, 2019

[Fix QT] TLS initialization failed | QSslSocket::connectToHostEncrypted Fail

The solution of TLS initialization failed step by step:

1- Firstly you need to find your SSL version for your windows machine( SSL version strictly depends on QT versions) with this function:
#include <QCoreApplication>
#include <QDebug>
#include <QSslSocket> //To use QSslSocket Class

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    qDebug()<<QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionString();
    return a.exec();
}
Result: 
2- After that run your code and call the above function. It will print your required SSL version in application output. In my case, it was “OpenSSL 1.0.2p 14 Aug 2018” “” which may be different for all the users.
3- TLS initialization failed: Now Download the requires SSL libraries from the link given below:
In my case: I download openssl-1.0.2p-x64_86-win64.zip
4- Paste all the files/content of SSL folder (which you have extracted) into the  debug folder. for eg: In my case it is:
E:\QT\NebProject\NASA_Vision\build-NASA_Vision-Desktop_Qt_5_12_2_MSVC2015_64bit-Debug\debug
Ok...Done

4 comments:

  1. You should know you're a lifesaver.
    Thank you!

    ReplyDelete
  2. It was the only tutorial I found that worked. Thank you very much friend! Congratulations!

    ReplyDelete
  3. Thank you so much !

    ReplyDelete

Back to Top