Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-18722

Timing Issue: QSslCertificate can NULL when receiving SSL errors from QNetworkReply

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0 RC
    • 4.8.0, 5.5.1
    • Network: HTTP, Network: SSL
    • None
    • Linux X11
    • 63cf5d3d26a6f65938c3cdec1734eac9faaaf8cb

    Description

      Any CA certificates are removed:

      QList<QSslCertificate> certificates;

      QSslConfiguration config = QSslConfiguration::defaultConfiguration();

      config.setProtocol(QSsl::TlsV1);
      config.setCaCertificates(certificates);

      QSslConfiguration::setDefaultConfiguration(config);

      A QWebView is instantiated:

      QWebView *browserWebView = new QWebView(this);
      browserWebView->show();

      QNetworkAccessManager *network = new QNetworkAccessManager();
      browserWebView->page()->setNetworkAccessManager(network);

      connect(network, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
      SLOT(sslErrorsMethod(QNetworkReply*,QList<QSslError>)));

      browserWebView->load(QUrl("https://.....")); #a page wich contains multiple images from different https site's

      void MainWindow::sslErrorsMethod(QNetworkReply *reply,QList<QSslError> list)
      {
      for(int i=0;i<list.size();i++)

      { qDebug("%s",list.at(i).errorString().toAscii().data()); }

      if (config.peerCertificate().isNull())
      qDebug("--------------sslErrorsMethod: peer certificate is null!!!");

      sleep(2);
      }

      This is the output:

      SSL Errors
      The issuer certificate of a locally looked up certificate could not be found
      The root CA certificate is not trusted for this purpose
      --------------sslErrorsMethod: peer certificate is null!!!

      SSL Errors
      The issuer certificate of a locally looked up certificate could not be found
      The root CA certificate is not trusted for this purpose

      SSL Errors
      The issuer certificate of a locally looked up certificate could not be found
      The root CA certificate is not trusted for this purpose
      --------------sslErrorsMethod: peer certificate is null!!!

      It is pretty random, sometimes is ok sometimes is not.
      NOT OK means to have a NULL certificate in replay when sslError slot is called

      Thank you

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mgoetz2 Markus Goetz (Woboq GmbH)
            mihaiadrian Mihai Adrian
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes