Error Creating SSL Context - Qt - c++

I tried everything mentioned in this Question
but nothing worked.
The binary works fine on Windows 64-bit, but almost always shows the error
Error Creating SSL Context()
on Windows 32-bit. I tried the demo http client example.

At last, I found the solution. I was downloading dll's from a dll website. You need to take these libraries
- libeay32.dll
- libssl32.dll
- ssleay32.dll
from this website here Win32 OpenSSL v1.0.2 file for 32 bit if you are using MSVC++ compiler
After installation of the above binary, copy the above three dll's in the the directory containing your binary file.

I recommend this source for OpenSSL Windows binaries. These binaries have no external dependencies and tested with 32-bit and 64-bit Qt5.
Update: OpenSSL 1.0 and 1.1 are not binary- and API-compatible. As of Qt 5.12 (certainly 5.12.4) version 1.1 seems the default OpenSSL backend in Qt, although I hear it can be configured to keep using 1.0.
I'm testing this source for Windows OpenSSL 1.1 builds, no problems so far: https://bintray.com/vszakats/generic/openssl

Related

Using BOOST_STACKTRACE_USE_BACKTRACE on Windows with MinGW64

I am building a Qt application using Windows and MinGW64. I need to use Boost Stacktrace to generate stack traces like the Linux build of the application already does.
The corresponding switch BOOST_STACKTRACE_USE_BACKTRACE (as described in https://www.boost.org/doc/libs/1_65_1/doc/html/stacktrace/configuration_and_build.html) is set and everything works fine on Linux.
However on Windows the libbacktrace library is missing. The above boost page contains two links to the sources of libbacktrace but I couldn't find a prebuilt binary for Windows/MinGW nor could I find any build instructions or usage documentation for my environment.
How can I use BOOST_STACKTRACE_USE_BACKTRACE with Windows/MinGW64?
I solved this problem (and some more issues) by switching to MSYS2 UCRT. MSYS2 provides a precompiled libbacktrace package.

How to build SRP for Win32 with Visual Studio 2017?

I need to build Secure Remote Password protocol library (SRP/libsrp) for old project from 2010. I can't figure out how to build it for Win32.
I found this link with latest source code:
http://srp.stanford.edu/download.html
Version 2.1.2 was used in project. There is link for Win32-binaries, but it's dead.
So the only way to get binaries is to compile the source code.
In Win32\README was said to put OpenSSL includes and compiled libs in related folder (include, lib, etc.).
I can't figure out what version of OpenSSL should be used. On the web page was said something about patching version 1.0.0.0, but I used the latest version of OpenSSL.
Then it was said to open "srp_openssl.dsw" file (which is VC++ 6 Workspace) and rebuild everything to get binaries.
The result is hundreds of errors related to the obsolete language and related to the OpenSSL. Also need to take into account that OpenSSL changed library names.
So, is the only way - to use OpenSSL 1.0.0.0 and VC++ 6 to build SRP? Also, are there any binaries in the internet?

QT enable cross-compiling using MinGW (precompiled)

Good day all
I have been searching for a method of cross-compiling for QT-Creator in Linux for sometime now, and I have been having alot of trouble with it.
Background info
please note: I am on a Linux machine, and would like to cross compile Windows Apps
My system:
Ubuntu Gnome 16.10
QT Creator 4.0.2 (based on QT 5.7)
I have came across a few SO links, a few blogs with broken instructions, etc and one seeming helpful but dependencies could not be found.
I have also attempted another compiler MXE and cloned and attempted to build the MXE compiler from the GIT repo, which failed (no solution for the build error - VTK build error)
I decided to download precompiled MinGW compilers (i686 and x86_x64 versions) from sourceforge
Issue:
In QT Creator, adding the compiler is done without an issue, adding the "Kit" and selecting the newly added compiler, an red exclamation gives an error
The Compiler (x86_windows_msys_pe_64bit) cannot produce code for QT version 5.7.0 GCC 64Bit (x86_linux_generic_elf_64bit)
This occurs for both 32 + 64 bit compilers.
I think that you should have a QT version that matches your compiler ABI. The error tells you that the MinGW compiler doesn't match the Linux version of QT you have used. Therefore, get a windows version of QT and use it instead (just as you've added WinGW).
You can download Qt Binaries from here.

SSL support for libcurl

At the beginning I want to tell you that I download libcurl from main site (i.e http://curl.haxx.se/download.html )
And version called:
Win64 2000/XP x86_64 zip 7.40.0 binary SSL SSH Edward LoPinto
I'm working on MSVC 2013 ultimate x64
Okey, this package seems to have SSL support (it contains ssl libs )
Program compiling fine, but when i try to run some https site I have got:
Protocol "https" not supported or disabled in libcurl.
I think that it is disabled (because this package contains ssl support).
Question is:
How to enable SSL support in libcurl ?
I solve my problem by compiling libcurl on my own hand.
It may help other people:
MSVC 2013 - 64 bit - 7.41.0 + OPENSSL
download
scan

how can I enable SSL in QT windows application?

Qt requires open ssl libraries to be installed on system. In debian / ubuntu when I install open ssl using apt everything works. But when I compile my application in windows, SSL features are not available I can verify this by executing
QSslSocket::supportsSsl()
How do I make it work in windows? I downloaded and installed open ssl from http://www.slproweb.com/products/Win32OpenSSL.html but it still returns false.
So after long time I figured what the problem is:
These 2 libraries need to be in same folder as your executable OR in windows system folder (system32 I think):
libeay32.dll
ssleay32.dll
You will find them in \bin of your OpenSSL folder, since I copied these 2 libs there it works
IMPORTANT: When deploying to client computers, it's also necessary to install vcredist package that was used to compile these .dll which may differ from vcredist package needed to run the application itself. vcredist version depends on version of the libraries.
You have to add OpenSSL lib in your project. In windows Qt doesn't come with OpenSSL lib. (I think it's a legal issue). You can find OpenSSL developer libs in URI you posted. If you are compiling against 32bit framework, what you need to download is Win32 OpenSSL v1.0.1e
This is what I have in my project.
QT += core gui network
win32{
LIBS += -LC:/OpenSSL-Win32/lib -lubsec
INCLUDEPATH += C:/OpenSSL-Win32/include
}
As you figured out already, you were missing dlls. Here is more information
Check what version of ssl you need with
QSslSocket::sslLibraryBuildVersionString();
For ssl 1.0.x (qt<5.12.4) you are likely missing libeay32.dll and ssleay32.dll.
For ssl 1.1.x (qt>=5.12.4) binary compatibility broke (qt 5.12.4 released), so you might need libssl-1_1.dll and libcrypto-1_1.dll, and its dependencies capi.dll and dasync.dll.