Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

SSL Configuration for Linux Steps



  • Is there an official step by step guide for enabling SSL in Linux? If not what are the high level steps?

    I am trying to run some code that uses HTTPS but I get the following error:

    QDEBUG : TestHttpHelper::testGetCookies() SSL version used for build SSL version use for build "OpenSSL 1.0.2k-fips 26 Jan 2017"
    QDEBUG : TestHttpHelper::testGetCookies() SSL version used for run-time 0
    QWARN : TestHttpHelper::testGetCookies() qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
    QWARN : TestHttpHelper::testGetCookies() qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
    QWARN : TestHttpHelper::testGetCookies() qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
    QWARN : TestHttpHelper::testGetCookies() qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
    QWARN : TestHttpHelper::testGetCookies() qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
    QWARN : TestHttpHelper::testGetCookies() We got a connection error when networkLayerState is Unknown
    QNetworkReply::NetworkError(UnknownNetworkError)


  • Lifetime Qt Champion

    Hi @Alex94102,

    it seems Qt was build for OpenSSL 1.0.2k

    Which OpenSSL do you have on your system?

    Please note that OpenSSL 1.1 is incompatible to 1.0.

    Regards



  • Hi Aha_1980,

    I have: openssl (1.1.0g-2ubuntu4.1)

    I also tried building and installing 1.0 but no luck. Even if I specify the library in the project itself (ssl and crypto) Is there something that needs to be configured in a specific way? I am really looking for some good documentation

    thank you,
    alex



  • Update:

    I build openssl-1.0.2o into /opt/openssl-1.0.2o using the "shared" option (when you run ./config

    then I added the following lines to my project:

    LIBS += -L/opt/openssl-1.0.2o/ -llibssl
    LIBS += -L/opt/openssl-1.0.2o/ -llibcrypto

    it works, but isn't this an ugly solution? Do I need to put this in every single project? can this pick up the system openssl libraries automatically? I think there has to be a cleaner way to get this to work.

    Thank you,
    alex


  • Lifetime Qt Champion

    Hi @Alex94102,

    I can only tell you my knowledge - which is rather limited in that area:

    • OpenSSL 1.0 and 1.1 are binary incompatible
    • Qt 5.11 can be compiled to use OpenSSL 1.1, but uses 1.0 by default
    • The linker will pick up the system libraries (under /lib and /usr/lib) first by default, which is 1.1 I guess?

    So what you did looks like an hack but I can't see a really clean solution at the moment (except building Qt 5.11 from source with OpenSSL 1.1 support). Maybe someone else has an idea...

    Which Qt version are you using? And which OS is this?



  • @aha_1980 said in SSL Configuration for Linux Steps:

    Which Qt version are you using? And which OS is this?

    Linux Mint 19, and Qt 5.11.1


  • Lifetime Qt Champion

    Hi,

    Doesn't Mint provide both versions of OpenSSL ?



  • Hello @SGaist

    1. Ok, I was not able to install openssl 1.0 using the synaptic, or apt. Pretty much I run into dependencies and broken packages issues--it didn't work.

    2. Now, I found a very good article:
      https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/

    and after replacing the default 1.1 with 1.0 it worked perfectly. I removed my project openssl references "LIBS" and Qt was able to now pick up the default system level openssl libraries.

    Thanks a lot for the hint!! :-)



  • @Alex94102 if your issue is solved, please don't forget to mark your post as such. Thanks


Log in to reply