Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Qt 5.12.3 QtWebEngine + QWebPage + SSL: verify server cert on client side (picture inside)

    QtWebEngine
    qtwebengine qwebpage ssl certificate server - client
    2
    2
    1256
    Loading More Posts
    • 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.
    • forca
      forca last edited by

      Hello all,

      I try to check/verify (ca "identifier" info available) server cert on client side, like it pictured in step(3), in order to avoid step 4+5 (yes, I dont want send my client cert "offhandedly").
      alt text
      From the QWebEnginePage, there is a virtual method:

      virtual bool certificateError(const QWebEngineCertificateError& err) override;
      

      or a signal

      void signal QWebEnginePage::selectClientCertificate(QWebEngineClientCertificateSelection selection)
      

      but, nothing about incoming from step(2) server cert.
      Is there any way to get info about, incoming from step(2), server cert?

      this is my impl of page:

         class WebPage : public QWebEnginePage
         {
            public:
               WebPage(QObject* parent = NULL);
               virtual ~WebPage();
      
            protected:
               virtual bool certificateError(const QWebEngineCertificateError& err) override;
      
            private slots:
               void handleSelectClientCertificate(QWebEngineClientCertificateSelection selection);
      
            private:
               bool mState;
      
      connect(this, &QWebEnginePage::selectClientCertificate, this, &WebPage::handleSelectClientCertificate);
         };
      

      here is my (as solved) associated bug request about client cert handling on linux:
      https://bugreports.qt.io/browse/QTBUG-71103

      Thank you all.

      Pablo J. Rogina 1 Reply Last reply Reply Quote 0
      • Pablo J. Rogina
        Pablo J. Rogina @forca last edited by

        @forca maybe you need to do some additional steps

        From QSslSocket documentation:

        Describes the peer verification modes for QSslSocket. The default mode is AutoVerifyPeer, which selects an appropriate mode depending on the socket's QSocket::SslMode.
        QSslSocket::QueryPeer 1
        QSslSocket will request a certificate from the peer, but does not require this certificate to be valid. This is useful when you want to display peer certificate details to the user without affecting the actual SSL handshake. This mode is the default for servers. Note: In Schannel this value acts the same as VerifyNone.

        And looking at this QWebEnginePage browser example, check the Downloading Favicons code snippet, which may help you accessing the underlying QSslSocket

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 0
        • First post
          Last post