self signed Certificate error



  • How to install or load a crt or pfx Certificate in Qt for webService https untrusted , using soap library request

    i use this code deploying in android , but still appear
    error: Network transport error (6): SSL handshake failed"

    QFile certFile(":/cert.crt");
    Q_ASSERT(certFile.open(QIODevice::ReadOnly));
    QSslCertificate cert(&certFile, QSsl::Pem);
    QSslSocket *sslSocket = new QSslSocket(this);
    sslSocket->addCaCertificate(cert);
    

    ??



  • Hi and welcome to devnet,

    here you can see how to disable this error (by default Qt don't allows self-signed certificate)



  • @mcosta thanks for reply
    i use that one but im still have the same problem
    QList<QSslCertificate> cert = QSslCertificate::fromPath(QLatin1String(":/certificate.crt"));
    QSslError error(QSslError::SelfSignedCertificate, cert.at(0));
    QList<QSslError> expectedSslErrors;
    expectedSslErrors.append(error);

     QSslSocket socket;
     socket.ignoreSslErrors(expectedSslErrors);
     socket.connectToHostEncrypted("https://host",port);


  • Hi,

    can you print the list of SSL errors? qDebug() << socket.sslErrors()



  • @mcosta
    W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
    W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
    W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
    W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
    W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
    W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
    W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.