Qt SSL support missing
Asked Answered
A

4

5

I've just downloaded Qt (LGPL - Qt SDK for Windows) and when i run some of the demos they complain about Qt not having SSL.
How can i get the Qt SDK with SSL enabled? Do i really need to compile it from source to get SSL support? Why is it missing in the version i've downloaded?

Acropolis answered 18/8, 2010 at 19:55 Comment(0)
E
10

@user261882 answer is only partially correct. He is correct in saying that Qt does not come with SSL support and that you do need to download the OpenSSL libraries.

However, the linking process after is much more simple, you do not need to rebuild Qt after downloading the SSL libraries or mess around with Microsoft Visual stuff. Qt makes it easy for you.

All that you need to do after downloading the SSL libraries is ensure that Qt can find where these openSSL libraries are located. If during your download you select the option to copy the openSSL DLL's to the Windows system directory, Qt will automatically find the openSSL binaries in that directory since the Windows system directory is always searched by Windows.

If you do not wish to install the openSSL libraries in your Windows system directory, that is fine, you just need to tell Qt where the openSSL DLL's are located. You can do this in a number of ways... one possible solution is setting adding the openSSL DLL's location to the system PATH. Another simple solution is to copy the openSSL DLL's into the directory which contains your executable. This directory is guaranteed to be searched as well.

A simple check that you can run afterwards to see if this worked is call the static function QSslSocket::supportsSsl(), if this function returns true, Qt has found the openSSL binaries that you downloaded. (Of course ensure that you add Qt += network in your .pro file before running this test)

Tested with Qt 4.8.3 binaries, using Qt Creator 2.5.2, and Win32 OpenSSL libraries v1.0.1c

Hope this saves everyone some time. Doing it this way you don't need to go and search the Visual Studio files and it is much simpler.

Executioner answered 29/9, 2012 at 0:19 Comment(0)
B
8

To enable SSL for Qt, you first must download the OpenSSL package. For that I suggest to download the binaries for OpenSSL that are availiable here. Install the binaries and read the help that comes with them.

This part is for installing OpenSSL binaries under Microsoft Visual C++(the text under is taken from the help of the binaries)

OpenSSL is designed to build easily under Microsoft Visual C++. However, the requirement that you go and obtain the 25MB Win98 DDK and have the latest service pack (SP5 is 120MB) installed can prove to be a hinderance to some people (particularly those with modems).

So, the installation of the Win32 OpenSSL binaries is a fairly simple process (similar to the Borland C++ Builder process).

The first thing to do (assuming a default installation of 'C:\OpenSSL') is to go to 'C:\OpenSSL\lib\VC' and copy all of the files to your Visual C++ 'lib' directory. This directory is sometimes located in a somewhat cryptic location such as 'C:\Program Files\Microsoft Visual Studio\VC98\lib' or 'C:\Program Files\Microsoft Visual C++\lib'.

Next, copy everything in the 'C:\OpenSSL\include' directory to your Visual C++ 'include' directory.

That's it! You are ready to go write OpenSSL-capable code!

After setting the right parameters, you are now ready to configure Qt to enable SSL support. Run configure.exe -debug-and-release -webkit -openssl -I C:\openssl\Include -L C:\openssl\Lib, and then nmake. You have enabled SSL support. Don't forget to put Qt += network in your .pro file.

That had worked for me and for my colleagues, should work for you too:).

Basting answered 24/8, 2010 at 22:19 Comment(0)
G
3

From Qt Documentation,

When building Qt from source, the configuration system checks for the presence of the openssl/opensslv.h header provided by source or developer packages of OpenSSL. Due to import and export restrictions in some parts of the world, we are unable to supply the OpenSSL Toolkit with Qt packages. Developers wishing to use SSL communication in their deployed applications should either ensure that their users have the appropriate libraries installed, or they should consult a suitably qualified legal professional to ensure that applications using code from the OpenSSL project are correctly certified for import and export in relevant regions of the world.

If you have already OpenSSL installed, try giving

Qt += network in your .pro file..

Hope it helps..

Gigolo answered 19/8, 2010 at 13:43 Comment(0)
H
1

QT 5.15:

  1. Make sure you have installed OpenSSL Toolkit using Qt Maintenance Tool
  2. Go to C:\Qt\Tools\OpenSSL\Win_x64\bin and search for "libcrypto-1_1-x64.dll" and "libssl-1_1-x64.dll
  3. Copy them into the compiler folder (C:\Qt\5.15.2\msvc2019_64\bin)

NOTE: if you compile x86 variant you have to copy DLLs from the Win_x86 folder.

I found this answer here: https://www.programmersought.com/article/71774817627/

Heikeheil answered 15/12, 2020 at 0:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.