Problem with Ssl
-
Hello everyone.
I have problem with ssl.
My code Next:@void LogIn::checkResponce() {
QNetworkReply reply = qobject_cast<QNetworkReply>(sender());
qDebug() << "1";
if (reply) {
qDebug() << "2";
qDebug() << reply->errorString();
qDebug() << reply->error();
if (reply->error() == QNetworkReply::NoError) {
qDebug() << "3";
qDebug() << reply->readAll();
}
reply->deleteLater();
}
}void LogIn::checkSslError(QList<QSslError> am) {
while(!am.isEmpty()) {
qDebug() << am.at(0).error();
qDebug() << am.at(0).errorString();
am.takeFirst();
}
}void LogIn::loginCheck()
{
emit disable(true);
QNetworkAccessManager netManager;
QUrl url("https://localhost/test.cgi");
QNetworkRequest req(url);
QNetworkReply* repl;
QList<QSslCertificate> cert = QSslCertificate::fromPath(QLatin1String("cert.pem"));
qDebug() << cert.at(0).isNull();
QSslError error(QSslError::SelfSignedCertificate , cert.at(0));
QSslError error1(QSslError::CertificateUntrusted , cert.at(0));
QList<QSslError> expectedSslErrors;
expectedSslErrors.append(error);
expectedSslErrors.append(error1);repl = netManager.get(req); repl->ignoreSslErrors(expectedSslErrors); connect(repl, SIGNAL(finished()), this, SLOT(checkResponce())); connect(repl , SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(checkSslError(QList<QSslError>)));
}@
But in console i have next text:
"The certificate is self-signed, and untrusted"
"The certificate is self-signed, and untrusted"
1
2
"SSL handshake failed"
6But I have already added this error before as you can see.
Please help me.Thank
-
Hi there,
I am having a similar error on Mavericks. Did you ever manage to resolve the issue?