Unsolved qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
-
Hello!
I've written the Fortune Client, which works great. Now, I want to implement the QsslSocket to get an encrypted connection, after the Server answers with welcome, but I do always the error:
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
This is the code:
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, socket(new QSslSocket(this))
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
qDebug() << QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionString();tcpSocket = new QTcpSocket(this); mIn.setDevice(tcpSocket); mIn.setVersion(QDataStream::Qt_5_0); connect(tcpSocket, &QIODevice::readyRead, this, &MainWindow::readServer); connect(tcpSocket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),this, &MainWindow::displayError);
}
void MainWindow::messageHandler(QStringList answer){
if(answer[0] == "welcomeToServer"){ qDebug()<<"Encryption started"; QSslSocket *tsocket = new QSslSocket(this); connect(tsocket, &QIODevice::readyRead, this, &MainWindow::readServer); tsocket->connectToHostEncrypted("Example.com", 993); tsocket->waitForReadyRead();
hope You can help me
-
I have exactly the same problem and searching for a solution but cant find one !!
-
-
Hi,
What version of Qt are you using ?
On what platform ?
What version of OpenSSL ?
How did you install everything ? -
@SGaist
5.14
Windows
What do i need to install? -
-> OpenSSL
Check the Maintenance Tool. IIRC, you can install it from there. -
This post is deleted!