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();
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);
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);
To copy to clipboard, switch view to plain text mode
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
Bookmarks