PDA

View Full Version : ssl verification fails but the request continue !!!!



mismael85
14th August 2014, 08:53
Hi guys,

I am trying to use an api and i have been asked to be sure first that i am using our backend using ssl verification.

so I used the following code

QFile certFile("d:/backend.cer");
Q_ASSERT(certFile.open(QIODevice::ReadOnly));
qDebug()<< "is ssl supported? " << QSslSocket::supportsSsl();
QByteArray certContent = certFile.readAll();

QSslCertificate cert(certContent, QSsl::Der);

kdebug() <<"Cert info: " << cert.effectiveDate() << cert.expiryDate() << cert.issuerInfo(QSslCertificate::Organization);

QSslConfiguration sslConfig = request.sslConfiguration();

sslConfig.setCaCertificates(QList<QSslCertificate>()<< cert);
sslConfig.setPeerVerifyMode(QSslSocket::QueryPeer) ;
request.setSslConfiguration(sslConfig);

I have two problems here
1- The certificate is not verified and i always get the following response
"ssl error = "The issuer certificate of a locally looked up certificate could not be found"
ssl error = "The root CA certificate is not trusted for this purpose""

2- However the ssl fails to verify the certificate it continues the request and receive the data!!!!

Could any body please help?

Regards,
M.Ismail

mismael85
17th August 2014, 07:47
Is there any body here?

wysota
17th August 2014, 08:13
Please prepare a minimal compilable example reproducing the problem. In particular tell us whether you do anything with the ignoreSslErrors() call.

mismael85
17th August 2014, 09:02
I fixed it. I should not igonre ssl errors