Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
QtWS25 Last Chance

qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt6.6tls
6 Posts 4 Posters 1.7k 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.
  • T Offline
    T Offline
    TLaren
    wrote on last edited by
    #1

    Qt 6.6.1
    Ubuntu 22.04

    My app needs to send email and that requires TLS to connect.

    I had the App working last July. Went to add a feature, updated Qt Creator before updating my App. In July timeframe OpenSSL 1.1 was the only thing supported. Now it looks like OpenSSL 3 is supported. I made sure both were enabled in Qt management. Everything compiles fine. The App runs on the development system but when I deploy it using qt-deployer and put it on another machine the App runs but TLS fails.

    Everything (that I have found) on Google is old and talks about OpenSSL 5 not being supported, use OpenSSL 1.1. Both are installed but both give the TLS error. I also installed each separately and removed the other but no success.

    If I do ldd using the run script so the environment is setup correctly, I do not see any reference to any ssl libraries and no missing libraries. I look in :~/Qt/6.6.1/gcc_64/lib and there is no libssl libraries so it is using the system libraries for SSL. Both the development system and the deployment system are on Ubuntu 22.04 and fully up to date.

    In the run script I added the system libraries path just to make sure:
    export LD_LIBRARY_PATH="$BASEDIR/lib":/lib/x86_64-linux-gnu

    In mainwindow.h I have included:
    #include <QtNetwork/QAbstractSocket>
    #include <QtNetwork/QSslSocket>
    Is there something else required for Qt 6.6?

    Any ideas?

    jsulmJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      The Qt binaries from the online installer do not link directly to OpenSSL, they dlopen its libraries.

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

      T 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        The Qt binaries from the online installer do not link directly to OpenSSL, they dlopen its libraries.

        T Offline
        T Offline
        TLaren
        wrote on last edited by
        #3

        @SGaist Not sure what this means?

        1 Reply Last reply
        0
        • T TLaren

          Qt 6.6.1
          Ubuntu 22.04

          My app needs to send email and that requires TLS to connect.

          I had the App working last July. Went to add a feature, updated Qt Creator before updating my App. In July timeframe OpenSSL 1.1 was the only thing supported. Now it looks like OpenSSL 3 is supported. I made sure both were enabled in Qt management. Everything compiles fine. The App runs on the development system but when I deploy it using qt-deployer and put it on another machine the App runs but TLS fails.

          Everything (that I have found) on Google is old and talks about OpenSSL 5 not being supported, use OpenSSL 1.1. Both are installed but both give the TLS error. I also installed each separately and removed the other but no success.

          If I do ldd using the run script so the environment is setup correctly, I do not see any reference to any ssl libraries and no missing libraries. I look in :~/Qt/6.6.1/gcc_64/lib and there is no libssl libraries so it is using the system libraries for SSL. Both the development system and the deployment system are on Ubuntu 22.04 and fully up to date.

          In the run script I added the system libraries path just to make sure:
          export LD_LIBRARY_PATH="$BASEDIR/lib":/lib/x86_64-linux-gnu

          In mainwindow.h I have included:
          #include <QtNetwork/QAbstractSocket>
          #include <QtNetwork/QSslSocket>
          Is there something else required for Qt 6.6?

          Any ideas?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @TLaren said in qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed:

          If I do ldd using the run script so the environment is setup correctly, I do not see any reference to any ssl libraries

          @SGaist responded to this. Since Qt does not link against the SSL libraries (it loads them instead at runtime using dlopen) ldd will not show them.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • T Offline
            T Offline
            TLaren
            wrote on last edited by TLaren
            #5

            TLS requires the TLS plugin.
            I guess qt-deployer does not do a very good job including what is needed.
            I copied over the plugins/TLS directory over to the deployment machine and it's fixed.

            TLS/
            libqcertonlybackend.so
            libqopensslbackend.so
            libqcertonlybackend.debug
            libqopensslbackend.debug
            

            I want to thank everyone that looked and I am posting the fix so the next time I forget what I am doing I can search here to fix my problem also maybe it will help someone else.

            M 1 Reply Last reply
            0
            • T TLaren

              TLS requires the TLS plugin.
              I guess qt-deployer does not do a very good job including what is needed.
              I copied over the plugins/TLS directory over to the deployment machine and it's fixed.

              TLS/
              libqcertonlybackend.so
              libqopensslbackend.so
              libqcertonlybackend.debug
              libqopensslbackend.debug
              

              I want to thank everyone that looked and I am posting the fix so the next time I forget what I am doing I can search here to fix my problem also maybe it will help someone else.

              M Offline
              M Offline
              MaximGS
              wrote on last edited by
              #6

              @TLaren And where can I find this plugin and where should I copy it?

              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