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

Properly support self-signed and client certificates with WebSockets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 5.0.1
    • WebKit
    • None

    Description

      I'm have nginx webserver with proxying websockets.
      I'm generate self-signed CA certificates, and generate clients certificates, signed by CA certificates.
      In my application I subclass QNetworkAccessManager as:

      QNetworkReply* QNetworkAccessManagerEx::createRequest(Operation op, const QNetworkRequest & req, QIODevice * outgoingData)

      { QNetworkRequest myReq = req; QSslConfiguration conf = req.sslConfiguration(); conf.setPeerVerifyMode(QSslSocket::VerifyNone); QFile certFile("client01.crt"); certFile.open(QIODevice::ReadOnly); conf.setLocalCertificate(QSslCertificate(certFile.readAll())); QFile keyFile("client01.key"); keyFile.open(QIODevice::ReadOnly); QSslKey key(keyFile.readAll(), QSsl::Rsa); conf.setPrivateKey(key); certFile.close(); myReq.setSslConfiguration(conf); QNetworkReply *repl = QNetworkAccessManager::createRequest( op, myReq, outgoingData ); return repl; }

      And set my QNetworkAccessManagerEx to QWebView:

      ui->webView->page()->setNetworkAccessManager(&networkAccessManager);

      If, navigate to site websocket.org, and trying to connect to secure websocket, all working correctly, and QWebView appeals to my QNetworkAccessManagerEx::createRequest(…)
      If navigate to my local web server, QWebView appeals to my QNetworkAccessManagerEx::createRequest(…) only during loading web page, after that, when I want connect to websocket manually (button on web page) QWebView dont appeals to QNetworkAccessManagerEx::createRequest(…).
      I tried call ignoreSslErrors(), but no effect.
      It seems that the signal and an indication of client certificates do not reach the engine javascript in QWebView.

      Attachments

        Issue Links

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

          Activity

            People

              annulen Konstantin Tokarev
              modigar Evgeny
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes