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. Using QSslSocket with custom OpenSSL

Using QSslSocket with custom OpenSSL

Scheduled Pinned Locked Moved Unsolved General and Desktop
c++ qtopensslsslwindows 10
41 Posts 9 Posters 33.3k 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.
  • N Nalnalital

    This post is deleted!

    N Offline
    N Offline
    Nalnalital
    wrote on last edited by
    #21
    This post is deleted!
    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nalnalital
      wrote on last edited by Nalnalital
      #22

      Using Qt5.7+msvc2015+W8

      Solved, in Qt_naming dll respect, without openssl compilation :
      http://www.npcglib.org/~stathis/downloads/openssl-1.0.1t-vs2015.7z

      1 Reply Last reply
      1
      • SGaistS SGaist

        How did you modify PATH ? In your Windows settings or in Qt Creator ?

        M Offline
        M Offline
        MChelik
        wrote on last edited by
        #23

        @SGaist I modified it via Windows settings and I don't know even khow how to change %PATH in Qt. Can you tell me? ( ͡° ͜ʖ ͡°)
        @hskoglund I'll try it at work. Thank you for your solution.

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

          Not in Qt but within Qt Creator. Go to the Run part of the Project panel. There you can modify your environment for your application only.

          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
          • raven-worxR raven-worx

            @MChelik
            on windows they are called ssleay32.dll and libeay32.dll

            R Offline
            R Offline
            RMcFatter
            wrote on last edited by
            #25

            @raven-worx Not any more. As of OpenSSL 1.1.0, following OpenSSL's build instructions on Windows (and with shared libraries enabled), we get:

            bin/libcrypto-1_1.dll
            bin/libssl-1_1.dll
            lib/libcrypto.lib
            lib/libssl.lib

            The names "ssleay32" and "libeay32" were deprecated. So does Qt only look for the old names despite any attempts at configuring it otherwise?

            Qt's docs on the topic, for some reason, only describe building OpenSSL for Android.

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

              @RMcFatter
              Hi and welcome to devnet,

              From a quick look at Qt's sources, it doesn't search yet for libcrypto/ssl-1_1.

              That something you should check in the bug report system to see if there's already something planned for that.

              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
              • O Offline
                O Offline
                Opa114
                wrote on last edited by
                #27

                same problem here.

                I want to use some functions from OpenSSL which i actually can not access from the prebuilt OpenSSL Libs which are shipped with QT (libeay32.dll and ssleay32.dll);

                So i thought i can build OpenSSL on my own and link to these libs in my project. This works as expected, but i now have the coexistence of the prebuilt OpenSSL Libs and my own built libs (libcrypto-1_1.dll and libssl-1_1.dll)

                This is not a big problem, but i tghought why using these two libs together, when i can maybe use only one? So i tried to rename my own build libs to the names of the old one, but there my application is crashing whith multiple error messages:

                qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
                qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
                qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
                qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
                qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_cleanup
                qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_init
                qt.network.ssl: QSslSocket: cannot resolve sk_new_null
                qt.network.ssl: QSslSocket: cannot resolve sk_push
                qt.network.ssl: QSslSocket: cannot resolve sk_free
                qt.network.ssl: QSslSocket: cannot resolve sk_num
                qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
                qt.network.ssl: QSslSocket: cannot resolve sk_value
                qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
                qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
                qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
                qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
                qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
                qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
                qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
                qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
                qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
                qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
                qt.network.ssl: QSslSocket: cannot resolve SSLeay
                qt.network.ssl: QSslSocket: cannot resolve SSLeay_version
                qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
                qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_num_locks
                qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
                qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
                qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
                qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
                qt.network.ssl: QSslSocket: cannot call unresolved function sk_num
                

                Then i found this Thread here and hoped to get the solution, but no, like @SGaist said. So i think i have to wait for an updated Qt version so that i can replace the files. Or could it be the better solution to built Qt on my own with own OpenSSL Support? if yes, is there a good Tutorial? Or can i use ALL the OpenSSL Functions with the prebuilt OpenSSL in Qt? If yes, a little example would be nice, because i don't got it.

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

                  You can build Qt with the -openssl-linked option and point configure to your self-built version of OpenSSL.

                  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
                  • O Offline
                    O Offline
                    Opa114
                    wrote on last edited by
                    #29

                    @SGaist said in Using QSslSocket with custom OpenSSL:

                    You can build Qt with the -openssl-linked option and point configure to your self-built version of OpenSSL.

                    i tried it that way, but buildung QT 5.7 with OpenSSL 1.1.0b ist not supported till QT 5.9 because in OpenSSL are some changes done, so that building QT 5.7 with that new OpenSSL version did not work. See here: https://bugreports.qt.io/browse/QTBUG-52905

                    Then i tried it with an older version of OpenSSL (1.0.2j) - this works.

                    But what ist the difference between building Qt gainst OpenSSL with -openssl on running the configure-command and to link against the OpenSSL headers and libs and build it inside the Project? If i build against OpenSSL i have to include the headers anyway to work with the libs if i want to use the OpenSSL specific stuff.

                    And i noticed that i can replace the built in OpenSSL libs with the own build one. So it would be much simpler to include the ehaders of OpenSSL via INCLUDEPATH. So i get OpenSSL support = true on output of: qDebug() << QSslSocket::supportsSsl();

                    And if print out his i got the Output which i wrote behind:
                    qDebug() << QSslSocket::sslLibraryBuildVersionString(); // OpenSSL 1.0.2g 1 Mar 2016
                    qDebug() << QSslSocket::sslLibraryVersionString(); // OpenSSL 1.0.2j 26 Sep 2016

                    Why is the first one at all time: OpenSSL 1.0.2g 1 Mar 2016 - This i got, too if i build Qt at own and link against OpenSSL 1.0.2j??

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

                      It's in the docs:
                      sslLibraryBuildVersionString is returning the version of the OpenSSL library used when building Qt.
                      sslLibraryVersionString is returning the version of the OpenSSL library used at run time.

                      By default OpenSSL is dlopened because some countries have restrictions about encryption related software and OpenSSL can't be distributed just like that.

                      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
                      • O Offline
                        O Offline
                        Opa114
                        wrote on last edited by
                        #31

                        Thanks! But why are my versions different?
                        I build Qt with OpenSSL 1.0.2j, so both outputs must be the same or not?

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

                          Silly question but are you sure that you are using your self-build Qt in your kit ?

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

                          O 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Silly question but are you sure that you are using your self-build Qt in your kit ?

                            O Offline
                            O Offline
                            Opa114
                            wrote on last edited by Opa114
                            #33

                            @SGaist said in Using QSslSocket with custom OpenSSL:

                            Silly question but are you sure that you are using your self-build Qt in your kit ?

                            yes :)
                            could it have to do with Qt-Creator, which was build with another version?

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

                              No, the Qt version used to build Qt Creator doesn't affect any any way the Qt version you are using with your kit.

                              Do you have another OpenSSL version installed on your system ?

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

                              O C 2 Replies Last reply
                              0
                              • SGaistS SGaist

                                No, the Qt version used to build Qt Creator doesn't affect any any way the Qt version you are using with your kit.

                                Do you have another OpenSSL version installed on your system ?

                                O Offline
                                O Offline
                                Opa114
                                wrote on last edited by
                                #35

                                @SGaist said in Using QSslSocket with custom OpenSSL:

                                on used to bui

                                no not installed like the precompiled OpenSSL Libraries. I searched the whole PC (Windows) for OpenSSL and libeay32.dll. I found many applications which are using OpenSSL but only one Application uses the specific OpenSSL version OpenSSL 1.0.2g 1 Mar 2016 i posted above. This Application is Adobe Lightroom.

                                Could this be the problem on building Qt that some shipped libeay32.dlls are used on build process?

                                1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  No, the Qt version used to build Qt Creator doesn't affect any any way the Qt version you are using with your kit.

                                  Do you have another OpenSSL version installed on your system ?

                                  C Offline
                                  C Offline
                                  CarlosQ
                                  wrote on last edited by
                                  #36

                                  @SGaist Sorry, i have the same problem.
                                  When i print:
                                  qDebug() << QSslSocket::supportsSsl(); ==> false
                                  qDebug() << QSslSocket::sslLibraryBuildVersionString(); ==> "OpenSSL 1.0.2g 1 Mar 2016"
                                  qDebug() << QSslSocket::sslLibraryVersionString(); ==> ""

                                  and i obtain these messages:
                                  qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
                                  qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
                                  qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
                                  qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
                                  qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error

                                  I have instaled only Qt 5.7 on Windows 7 32. What can i do?
                                  Thanks

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

                                    Hi,

                                    Do you have OpenSSL installed ? Built with the same compiler as Qt ? In a folder known to your application ?

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

                                    C 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      Hi,

                                      Do you have OpenSSL installed ? Built with the same compiler as Qt ? In a folder known to your application ?

                                      C Offline
                                      C Offline
                                      CarlosQ
                                      wrote on last edited by
                                      #38

                                      @SGaist No, no and no. Ohhhh. i'll try to build the libraries.

                                      Sorry, thanks.

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

                                        You can find here prebuilt versions of OpenSSL for various compilers.

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

                                        C 1 Reply Last reply
                                        0
                                        • SGaistS SGaist

                                          You can find here prebuilt versions of OpenSSL for various compilers.

                                          C Offline
                                          C Offline
                                          CarlosQ
                                          wrote on last edited by
                                          #40

                                          @SGaist Thank you for the link. I was trying to build the libraries and I'm going crazy.

                                          I have Qt 5.7.0 on a Windows 7 32 bits, which instalation should be correct?. I think "Win32 OpenSSL v1.1.0c". Is it ok?.

                                          Thanks again.

                                          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