Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Qt 5.12.3 QtWebEngine + QWebPage + SSL: verify server cert on client side (picture inside)

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

Scheduled Pinned Locked Moved Unsolved QtWebEngine
qtwebengineqwebpagesslcertificateserver - client
2 Posts 2 Posters 2.0k Views
  • 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.
  • forcaF Offline
    forcaF Offline
    forca
    wrote on last edited by
    #1

    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. RoginaP 1 Reply Last reply
    0
    • forcaF forca

      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. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @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
      0

      • Login

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