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

QSslSocket::setProtocol() does not work for TLS v1.2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.0.2, 5.2.0
    • Network: SSL
    • None

    Description

      The securesocketclient example can be used to reproduce this issue. http://qt-project.org/doc/qt-5.0/qtnetwork/securesocketclient.html

      If one modifies the sslclient.cpp:

      void SslClient::secureConnect()
      {
          if (!socket) {
              socket = new QSslSocket(this);
              connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
                      this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
              connect(socket, SIGNAL(encrypted()),
                      this, SLOT(socketEncrypted()));
              connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
                      this, SLOT(sslErrors(QList<QSslError>)));
              connect(socket, SIGNAL(readyRead()),
                      this, SLOT(socketReadyRead()));
          }
      
          socket->setProtocol(QSsl::TlsV1_2); // New/Changed
          socket->connectToHostEncrypted(form->hostNameEdit->text(),
          form->portBox->value());
          updateEnabledState();
      }
      

      You can test wit TLS 1.2-enabled website e.g.:
      www.google.com
      www.mit.edu
      www.yale.edu
      www.whitehouse.gov

      (Note: OpenSSL 1.0.1+ is required for TLS 1.2 support)

      Expected:
      The application connects without errors.

      Actual:
      After this modification, the application does not seem to connect at all, but no errors are shown either.

      See the attached screen shots.

      Also it should possible to select TLS1.0, TLS1.1 and TLS1.2 (all three) for the allowed protocol (e.g. to exclude SSLv2 and SSLv3). It looks like the current API allows only a single protocol.

      Attachments

        1. client.cpp
          3 kB
        2. genuine.png
          genuine.png
          12 kB
        3. modified.png
          modified.png
          11 kB
        4. server.cpp
          3 kB

        Issue Links

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

          Activity

            People

              kkohne Kai Köhne
              qtcomsupport Qt Support
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes