Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Using OpenSSL 3 https connection

Using OpenSSL 3 https connection

Scheduled Pinned Locked Moved Unsolved Game Development
10 Posts 4 Posters 481 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.
  • K Offline
    K Offline
    kevin_d
    wrote on 11 Jan 2025, 11:17 last edited by
    #1

    Hello Folks!

    I need to access a https connection in Qt 5 with a windows and a linux build.

    This is the code I am trying tu use:

    QNetworkAccessManager nam;
    QSslConfiguration config( QSslConfiguration::defaultConfiguration() );
    QNetworkRequest req(QUrl("https://myurl.file"));
    req.setSslConfiguration( config );
    QNetworkReply* reply = nam.get(req);
    QEventLoop loop;
    QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
    loop.exec();
    bool isConnected = reply->bytesAvailable(); // false
    

    What do i need to connect via OpenSSL3 (Windows and Linux Client)

    best regards, kevin

    J 1 Reply Last reply 12 Jan 2025, 10:28
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 11 Jan 2025, 20:24 last edited by
      #2

      Hi,

      Two conditions:

      • have a build of Qt which supports OpenSSL 3
      • have the OpenSSL 3 libraries in a suitable place where Qt can load them.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kevin_d
        wrote on 12 Jan 2025, 09:01 last edited by kevin_d 1 Dec 2025, 09:51
        #3

        On Windows:

        • With the Qt MaintenanceTool, I installed "OpenSSL 3.0.15 Toolkit" 64 bit Binaries.
        • From X:\Qt3D\Tools\OpenSSLv3\Win_x64\bin, I copied "libcrypto-3-x64.dll" and "libssl-3-x64.dll" to my build directory
        • In my .pro-File, I added
        • LIBS += X:\Qt3D\Tools\OpenSSLv3\Win_x64\lib\libcrypto.lib
        • LIBS += X:\Qt3D\Tools\OpenSSLv3\Win_x64\lib\libssl.lib
        • INCLUDEPATH += X:\Qt3D\Tools\OpenSSLv3\Win_x64\include\openssl

        Also, i added the path to the .dlls to the Windows-PATH variable.
        According to "https://doc.qt.io/qt-5/windows-requirements.html", i added

        • libcrypto-3-x64.dll and
        • libssl-3-x64.dll
          to the X:\Windows\system32 folder.

        The runtime states:
        qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
        sslibbuild: "OpenSSL 1.1.1g 21 Apr 2020"
        ssllibversionstring: ""
        supportsSsl: false

        And connection still fails.

        What am I missing?

        best regards, kevin

        1 Reply Last reply
        0
        • K kevin_d
          11 Jan 2025, 11:17

          Hello Folks!

          I need to access a https connection in Qt 5 with a windows and a linux build.

          This is the code I am trying tu use:

          QNetworkAccessManager nam;
          QSslConfiguration config( QSslConfiguration::defaultConfiguration() );
          QNetworkRequest req(QUrl("https://myurl.file"));
          req.setSslConfiguration( config );
          QNetworkReply* reply = nam.get(req);
          QEventLoop loop;
          QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
          loop.exec();
          bool isConnected = reply->bytesAvailable(); // false
          

          What do i need to connect via OpenSSL3 (Windows and Linux Client)

          best regards, kevin

          J Offline
          J Offline
          JonB
          wrote on 12 Jan 2025, 10:28 last edited by
          #4

          @kevin_d said in Using OpenSSL 3 https connection:

          I need to access a https connection in Qt 5

          @SGaist said in Using OpenSSL 3 https connection:

          have a build of Qt which supports OpenSSL 3

          Although this is not my area, start by checking exactly which version of Qt 5 you have? Read through e.g. https://forum.qt.io/topic/136960/does-qt-5-15-support-openssl-3-x. It appears to me you need Qt 5.15.13 onward. I am unclear whether it requires you to build the Qt 5.x with this support yourself. Google qt 5 ssl 3 for further reading, e.g. maybe https://gist.github.com/seyedmmousavi/b1f6681eb37f3edbe3dcabb6e89c5d43.

          Assuming you do need SSL 3, I don't know whether you might be better considering upgrading your own to Qt 6.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kevin_d
            wrote on 12 Jan 2025, 10:34 last edited by
            #5

            I am indeed using Qt 5.15.2

            S 1 Reply Last reply 12 Jan 2025, 16:10
            0
            • K kevin_d
              12 Jan 2025, 10:34

              I am indeed using Qt 5.15.2

              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 12 Jan 2025, 16:10 last edited by
              #6

              @kevin_d then you have to build the latest Qt 5 version yourself or use Qt 6.

              I remember there's a forum member providing builds of Qt 5. You can search for it.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • P Offline
                P Offline
                piervalli
                wrote on 13 Jan 2025, 08:56 last edited by
                #7

                The version 5.15.2 does not support Openssl 1.1, you should build by source last version of Qt5. Usually I copy libcrypto-3-x64.dll and
                libssl-3-x64.dll in the folder of executable to avoid conflit con system32.

                S 1 Reply Last reply 13 Jan 2025, 11:55
                0
                • P piervalli
                  13 Jan 2025, 08:56

                  The version 5.15.2 does not support Openssl 1.1, you should build by source last version of Qt5. Usually I copy libcrypto-3-x64.dll and
                  libssl-3-x64.dll in the folder of executable to avoid conflit con system32.

                  S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 13 Jan 2025, 11:55 last edited by
                  #8

                  @piervalli Qt 5.15.2 does support OpenSSL 1.1 it's 3.0 that's not supported.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • J Offline
                    J Offline
                    JonB
                    wrote on 13 Jan 2025, 13:07 last edited by JonB
                    #9

                    Indeed. As per the post I drew attention to previously, apparently for Qt5 with SSL/OpenSSL 3 you would need 5.15.3, and OP only has 5.15.2 :(
                    I am still not sure whether the 5.15.3 has to be compiled a certain way (option) to make it do SSL at all or SSL 3 at least. If you get one pre-compiled by someone else you would need to check this.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      piervalli
                      wrote on 13 Jan 2025, 18:23 last edited by
                      #10

                      @JonB in the release notes openssl 3 is added in the 5.15.10

                      1 Reply Last reply
                      1

                      7/10

                      13 Jan 2025, 08:56

                      • Login

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