void MainWindow::setUpSSL()
{
	QFile file(":/cert/client.pem");
 // QtSoapHttpTransport http;/*defined in h*/
	QNetworkReply *request = http.networkReply(); // this fails....ok its a NULL ptr. when is it initialied? Or better what to use to set the cert? 
	QSslCertificate cert(&file, QSsl::Pem);
	file.close();
 
     if(cert.isValid() && !cert.isNull())
    {
 
	     QSslConfiguration sslConfiguration = request->sslConfiguration();
	     sslConfiguration.setLocalCertificate(cert);
	     file.close();
	     QSslKey key(&file, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
	     qDebug() << "key isNull ? " << key.isNull();
	     sslConfiguration.setPrivateKey(key);
	     sslConfiguration.setProtocol(QSsl::SslV2);
	     sslConfiguration.setPeerVerifyMode(QSslSocket::QueryPeer);
	     request->setSslConfiguration(sslConfiguration);
     }
     qDebug() << "sending post";
 
}
        void MainWindow::setUpSSL()
{
	QFile file(":/cert/client.pem");
// QtSoapHttpTransport http;/*defined in h*/
	QNetworkReply *request = http.networkReply(); // this fails....ok its a NULL ptr. when is it initialied? Or better what to use to set the cert? 
	Q_ASSERT(file.open(QIODevice::ReadOnly));
	QSslCertificate cert(&file, QSsl::Pem);
	file.close();
     if(cert.isValid() && !cert.isNull())
    {
	     QSslConfiguration sslConfiguration = request->sslConfiguration();
	     sslConfiguration.setLocalCertificate(cert);
	     file.close();
	     file.open(QIODevice::ReadOnly);
	     QSslKey key(&file, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
	     qDebug() << "key isNull ? " << key.isNull();
	     sslConfiguration.setPrivateKey(key);
	     sslConfiguration.setProtocol(QSsl::SslV2);
	     sslConfiguration.setPeerVerifyMode(QSslSocket::QueryPeer);
	     request->setSslConfiguration(sslConfiguration);
     }
     qDebug() << "sending post";
}
To copy to clipboard, switch view to plain text mode 
  
	
	connect(http.networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))
	     ,this, SLOT(authReq(QNetworkReply*,QAuthenticator*)));
 
     connect(http.networkAccessManager(),SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(on_sslErr(QNetworkReply*,QList<QSslError>)));
     connect(http.
networkAccessManager(), 
SIGNAL(proxyAuthenticationRequired
(QNetworkProxy,QAuthenticator
*)), 
this,
SLOT(on_proxyReq
(QNetworkProxy,QAuthenticator
*)));
  
     connect(&http, SIGNAL(responseReady()), SLOT(readResponse()));
        connect(http.networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))
	     ,this, SLOT(authReq(QNetworkReply*,QAuthenticator*)));
     connect(http.networkAccessManager(),SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(on_sslErr(QNetworkReply*,QList<QSslError>)));
     connect(http.networkAccessManager(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this,SLOT(on_proxyReq(QNetworkProxy,QAuthenticator*)));
     connect(&http, SIGNAL(responseReady()), SLOT(readResponse()));
To copy to clipboard, switch view to plain text mode 
  
Bookmarks