diff options
-rw-r--r-- | src/fbgui/fbgui.cpp | 33 | ||||
-rw-r--r-- | src/fbgui/fbgui.h | 2 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp index b4a8a13..5ef9a9c 100644 --- a/src/fbgui/fbgui.cpp +++ b/src/fbgui/fbgui.cpp @@ -134,6 +134,7 @@ void fbgui::loadURL() { //Add OpenSLX Certificate to SSLConfiguration QList<QSslCertificate> certList = QSslCertificate::fromPath(QLatin1String("/usr/lib/ssl/openslx/CA/certs/openslx-cert.pem")); + certList.append(QSslCertificate::fromPath(QLatin1String("/usr/lib/ssl/openslx/CA/certs/pbsfr-cert.pem"))); setCACertificates(certList); //Ignore the SelfSignedCertificateInChain-error for the OpenSLX-Certificate @@ -148,7 +149,7 @@ void fbgui::loadURL() { QFile keyFile("/usr/lib/ssl/openslx/CA/private/guest.pem"); Q_ASSERT(keyFile.open(QIODevice::ReadOnly)); QByteArray keyContent = keyFile.readAll(); - setPrivateKey(QSslKey(keyContent, QSsl::Rsa)); + setPrivateKey(QSslKey(keyContent, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, QByteArray("guest"))); @@ -169,6 +170,18 @@ void fbgui::loadURL() { _qnr->setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); QObject::connect(_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadURLDone(bool))); _webView->load(*_qnr, QNetworkAccessManager::PostOperation, postData); + +// ////////////////////TEST/////////////////////// +// QSslSocket qssReg = new QSslSocket(this); +// qssReg.setSslConfiguration(_qnr->sslConfiguration()); +// +// QHttp http = new QHttp(QLatin1String("pbs2.mp.openslx.org"), QHttp::ConnectionModeHttps, 443, this); +// http.setSocket(&qssReg); +// +// //QObject::connect(http, SIGNAL(done(bool)), this, SLOT(done(bool))); +// QObject::connect(&http, SIGNAL(sslErrors(const QList<QSslError> &)), this, +// SLOT(sslErrorHandler(const QList<QSslError> & ))); + } // TODO: error page if no host. } @@ -205,13 +218,21 @@ void fbgui::httpErrorHandler(QNetworkReply* reply) { } //Dump all Certificates in SSLConfiguration -void fbgui::dumpCACertificates(){ +void fbgui::dumpSSLConfiguration(){ QSslConfiguration sslConfig = _qnr->sslConfiguration(); - QList<QSslCertificate> caCerts = sslConfig.caCertificates(); - foreach (QSslCertificate cert, caCerts){ - LOG4CXX_DEBUG(coreLogger,"Cert info: \n" << cert.toPem()); + LOG4CXX_DEBUG(coreLogger,"****************SSLConfiguration************************** \n"); + LOG4CXX_DEBUG(coreLogger,"CACertificates: \n"); + foreach (QSslCertificate cert, sslConfig.caCertificates()){ + LOG4CXX_DEBUG(coreLogger,cert.toPem() << "\n"); } + LOG4CXX_DEBUG(coreLogger,"----------------------------------------------------- \n"); + LOG4CXX_DEBUG(coreLogger,"LocalCertificate: \n"); + LOG4CXX_DEBUG(coreLogger,sslConfig.localCertificate().toPem() << "\n"); + LOG4CXX_DEBUG(coreLogger,"----------------------------------------------------- \n"); + LOG4CXX_DEBUG(coreLogger,"Private Key: \n"); + LOG4CXX_DEBUG(coreLogger,sslConfig.privateKey().toPem() << "\n"); + LOG4CXX_DEBUG(coreLogger,"********************************************************** \n"); } //Saves CACertificates to SslConfiguration @@ -245,7 +266,7 @@ void fbgui::setLocalCertificate(const QSslCertificate& cert){ //Saves PrivateKey to SslConfiguration void fbgui::setPrivateKey(const QSslKey & key){ - LOG4CXX_DEBUG(coreLogger,"Is key valid: " << key.isNull()); + LOG4CXX_DEBUG(coreLogger,"Key length: " << key.length()); QSslConfiguration sslConfig = _qnr->sslConfiguration(); sslConfig.setPrivateKey(key); _qnr->setSslConfiguration(sslConfig); diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h index 5fa4323..8afb496 100644 --- a/src/fbgui/fbgui.h +++ b/src/fbgui/fbgui.h @@ -66,7 +66,7 @@ private: void loadURL(); //Dump all Certificates in SSLConfiguration - void dumpCACertificates(); + void dumpSSLConfiguration(); QByteArray generatePOSTData(); |