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

SSL Echo Client doesn't actually use SSL

    XMLWordPrintable

Details

    • All
    • 8
    • 6821b4426 (dev), 2288aa3ca (6.5)
    • Foundation Sprint 77

    Description

      The SSL Echo Server/Client example is meant to demonstrate how to set up a secure local WebSocket channel. The example server uses a self-signed certificate. The example client, however, does not set this certificate - in fact it does not do any SSL configuration at all, and explicitly ignores all SSL errors. This is a bit underwhelming.

      Note that there is a complete other set of examples (Echo Server/Client) demonstrating non-secure WebSocket communication, so the only reason anyone would look at this example is to find out how the SSL configuration works - which the example then utterly fails to demonstrate.

      To fix, this, the following would have to be added to the SslEchoClient constructor:

          QSslConfiguration sslConfiguration;
          sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyPeer);
          QFile certFile(QStringLiteral(":/localhost.cert"));
          assert(certFile.open(QIODevice::ReadOnly));
          QSslCertificate certificate(&certFile, QSsl::Pem);
          certFile.close();
          sslConfiguration.addCaCertificate(certificate);
          m_webSocket.setSslConfiguration(sslConfiguration);
      

      and of course the localhost.cert file from the server added to the client's resources.

      Attachments

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

        Activity

          People

            ievgenii.meshcheriakov Ievgenii Meshcheriakov
            linoleo Lino Schraudolph
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes