Important: Please read the Qt Code of Conduct -

[SOLVED] How to use SSL support without manualy building Qt libraries?

  • I used Windows QtSDK online installer. By default the network module has openssl support disabled. The online installer works great for me since it has very good update mechanism, I would really like to continue use pre-built libraries.

    I already have libeay32.dll, libssl32.dll and ssleay32.dll in my application exe directory. I need to enable Qt to use them. Is there any way of enabling SSL support without manually building Qt libraries?

    Thanks in advance!

  • To start at the beginning: did you include the line CONFIG += openssl-linked to your project file?

  • For me, the prebuilt binaries of OpenSSL never worked with a MingW build of Qt. I did build OpenSSL myself to enable encryption.

  • [quote author="rutger" date="1338319052"]To start at the beginning: did you include the line CONFIG += openssl-linked to your project file?[/quote]

    Yes I tried with CONFIG += openssl-linked and CONFIG += openssl, rebuild the project but again I get network error "Error creating SSL context () ". I tried on various domains including those with valid and invalid SSL certificate.

    I have copied openssl dll files from "QtSDK\QtCreator\bin" to my application exe directory. I guess these dll are fine since QtCreator is using them.

  • I use QtWebKit in my application (QWebView) and can access HTTPS sites without problem. First I was happy to access the Internet at all :-) but later was not satisfied and tried to include SSL sites also. What I did was:

    • took the parts of code from the browser code which was I believe a Qt Labs project
    • added CONFIG += openssl-linked
    • QT += core network sql svg webkit xml
    • copied from the QtSdk the (MingW) libeay32.dll and ssleay32.dll next to the executable

    and the HTTPS sites are available

  • Do I need to include any openssl header or it is already included with #include <QtNetwork>?

    I use MSVC2008 compiler via QtCreator so I guess dlls compiled with MinGW may not work, but the only libeay32.dll and ssleay32.dll are inside "C:\QtSDK\QtCreator\bin" directory, there are no such dlls in QtSDk MSVC folder. I download these files from "here": but no solution again. I downloaded and install Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) and again no solution.

  • As far as I know, Creator in the SDK is built with MinGW, which does not harm, as it can happily compile using the Visual Studio tool chain. In principle, the two DLLs should be enough. I copied them into the very same directory where my exe lives.

  • Big thanks to rutger and Volker for the inputs.

    It finally worked. When I run the application from the QtCreator the dlls are not linked. While the working path in the project's run settings is in the place where libeay32.dll and ssleay32.dll reside somehow the are not linked. When I run the application independently with the dlls next to the exe they are linked OK. Funny I have other dlls in the working directory and they are linked fine even when I run the application directly from QtCreator.

Log in to reply