Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkReply does not return requests with expired SSL certificates. Workaround?
Qt 6.11 is out! See what's new in the release blog

QNetworkReply does not return requests with expired SSL certificates. Workaround?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AttilaPethe
    wrote on last edited by
    #1

    I have a https connection with expired or self issued certificate. If I want to use a code like:
    @reply = manager->get("https.... not valid certificate.. url");@

    I get a QNetworkReply::sslErrors signal (QList<QSslError>) like:
    "The host name did not match any of the valid hosts for this certificate", "No error"
    and a QNetworkReply::error signal: QNetworkReply::SslHandshakeFailedError
    (in two different signal, both are signaled).
    After this QNetworkAccessManager::replyFinished signal is signaled but returns just an empty string, nothing is read from the host.
    How can I read anyway https replies without having a valid certificate?
    If I read http, the code works fine.
    Thanks for ideas!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AttilaPethe
      wrote on last edited by
      #2

      Answer found after reading documentation:

      void QNetworkReply::ignoreSslErrors() [virtual slot]
      If this function is called, SSL errors related to network connection will be ignored, including certificate validation errors.

      Note that calling this function without restraint may pose a security risk for your application. Use it with care.

      This function can be called from the slot connected to the sslErrors() signal, which indicates which errors were found.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sportlover
        wrote on last edited by
        #3

        Check the:
        @QNetworkReply::sslErrors ( const QList<QSslError> & errors )@

        signal documentation which states that you should call:
        @ignoreSslErrors() @

        from the slot connect to the signal to receive the behaviour you want to..

        Edit: you already found it! :-)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved