summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neves2012-02-02 19:29:27 +0100
committerMichael Neves2012-02-02 19:29:27 +0100
commit9fc53432ca9d65420f1e36c0bed834a280547eab (patch)
treeb49ee61e1c4b59aa7dcba7d4e996449eac3ca82a
parenttested (diff)
downloadfbgui-9fc53432ca9d65420f1e36c0bed834a280547eab.tar.gz
fbgui-9fc53432ca9d65420f1e36c0bed834a280547eab.tar.xz
fbgui-9fc53432ca9d65420f1e36c0bed834a280547eab.zip
ignore SelfSignedCertificateInChain-Error fot OpenSLX-Cert
-rw-r--r--src/fbgui/fbgui.cpp19
-rw-r--r--src/fbgui/fbgui.h2
2 files changed, 14 insertions, 7 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp
index 37913b7..989b2c1 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -245,8 +245,9 @@ void fbgui::loadURL() {
QByteArray postData = generatePOSTData();
_qnr = new QNetworkRequest(baseURL);
- QList<QSslCertificate> certList;
- certList.append(readCertificate("/usr/lib/ssl/openslx/CA/certs/openslx-cert.pem"));
+ QList<QSslCertificate> certList = QSslCertificate::fromPath(QLatin1String("/usr/lib/ssl/openslx/CA/certs/openslx-cert.pem"));
+ QSslError error(QSslError::SelfSignedCertificateInChain, certList.at(0));
+ _expectedSslErrors.append(error);
registerCACertificates(certList);
//Connect webViews NetworkAccessManager to SSLErrorHandler SLOT
@@ -287,9 +288,13 @@ void fbgui::loadURLDone(bool success) {
void fbgui::sslErrorHandler(QNetworkReply* reply, const QList<QSslError> & errlist) {
foreach (QSslError err, errlist)
- LOG4CXX_DEBUG(coreLogger, "SSL Error: " << err.errorString());
+ LOG4CXX_DEBUG(coreLogger, "SSL Error: " << err.error());
- //reply->ignoreSslErrors();
+// QSslConfiguration replySslConf = reply->sslConfiguration();
+// foreach (QSslCertificate cert, replySslConf.peerCertificateChain())
+// LOG4CXX_DEBUG(coreLogger,"Cert info: \n" << cert.toPem());
+
+ reply->ignoreSslErrors(_expectedSslErrors);
}
//Handles QNetworkReply Errors
@@ -314,8 +319,7 @@ void fbgui::dumpCACertificates(){
QList<QSslCertificate> caCerts = sslConfig.caCertificates();
foreach (QSslCertificate cert, caCerts){
- LOG4CXX_DEBUG(coreLogger,"Is cert valid: " << cert.isValid());
- LOG4CXX_DEBUG(coreLogger,"Cert info: " << cert.issuerInfo(QSslCertificate::Organization));
+ LOG4CXX_DEBUG(coreLogger,"Cert info: \n" << cert.toPem());
}
}
@@ -324,7 +328,8 @@ void fbgui::registerCACertificates(const QList<QSslCertificate> & certificates){
foreach (QSslCertificate cert, certificates){
LOG4CXX_DEBUG(coreLogger,"Is cert valid: " << cert.isValid());
- LOG4CXX_DEBUG(coreLogger,"Cert info: " << cert.issuerInfo(QSslCertificate::Organization));
+ LOG4CXX_DEBUG(coreLogger,"Cert Issuer: " << cert.issuerInfo(QSslCertificate::CommonName));
+ LOG4CXX_DEBUG(coreLogger,"Cert Subject: " << cert.subjectInfo(QSslCertificate::CommonName));
}
QSslConfiguration sslConfig = _qnr->sslConfiguration();
diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h
index 4f60b12..1c9d8ae 100644
--- a/src/fbgui/fbgui.h
+++ b/src/fbgui/fbgui.h
@@ -97,6 +97,8 @@ private:
QWebView* _webView;
// QNetworkRequest for the Network Request
QNetworkRequest* _qnr;
+ // List for expected SSL Errors, like selfsigned certificate error
+ QList<QSslError> _expectedSslErrors;
// QSplitter to split the main window in two resizable frames.
QSplitter* _splitter;
// QTextEdit implementing a minimalistic debug console.