Problem installing QCA-OSSL (part of the Qt-cryptographic architecture) in Windows 7

I have been trying to use QCA ( Link ) on my Windows PC for several days, it works fine on my Linux box, I just can't get it to work with Windows.

So, I followed all the QCA installation instructions and then the ossl plugin for QCA. QCA works fine, but for some reason the plugin does not appear in my Qt Creator, and I cannot use some of the functions in the plugin.

I used qcatool2.exe that comes with QCA to test my plugins with

qcatool2 plugins --debug 

and get this error message:

plugin: qca-ossl2.dll: failed to load: The plugin 'C:/Qt/2010.05/qt/plugins/crypto/qca-ossl2.dll' uses incompatible Qt library. Expected build key "Windows mingw debug full-config", got "Windows mingw release full-config"

Now it seems to me that qt requires the plugin to be compiled in debug mode (how to make the build key contain debug, not release), so I added

 CONFIG += debug 

into my plugin project file and ran qmake and mingw32-make as usual, but that didn't seem to affect it.

My project file for the plugin now:

 TEMPLATE = lib CONFIG += plugin QT -= gui DESTDIR = lib VERSION = 2.0.0 unix:include(conf.pri) windows:CONFIG += crypto windows:include(conf_win.pri) CONFIG += create_prl SOURCES = qca-ossl.cpp windows:{ load(winlocal.prf) isEmpty(WINLOCAL_PREFIX) { error("WINLOCAL_PREFIX not found. See http://delta.affinix.com/platform/#winlocal") } OPENSSL_PREFIX = $$WINLOCAL_PREFIX DEFINES += OSSL_097 INCLUDEPATH += $$OPENSSL_PREFIX/include LIBS += -L$$OPENSSL_PREFIX/lib LIBS += -llibeay32 -lssleay32 LIBS += -lgdi32 -lwsock32 } !debug_and_release|build_pass { CONFIG(debug, debug|release) { mac:TARGET = $$member(TARGET, 0)_debug windows:TARGET = $$member(TARGET, 0)d } } CONFIG += debug 

Does anyone have any ideas? If you need more details, just ask, I tried to be as thorough as possible. Thanks

Tom

+4
source share
2 answers

I faced a similar situation: qca-ossl builds fine on linux and not windows at all. I just hit a breakthrough that can help you.

Versions and bug fixes

  • qtsdk-2010.05
  • KKA-2.0.3
  • qca-ossl-r1190163 (from the repository)
  • Openssl-1.0.0b

First of all, if you are using a newer version (0.9.7+, I think) of OpenSsl, you may need to use the qca-ossl version from the repository, as it fixes some incompatibilities. I also needed to comment on some lines in the new qca-ossl.cpp file regarding SHA224, SHA256, SHA384 and SHA512 to avoid build errors. I use qca-ossl for ciphers, so I don’t worry about hashing and I don’t know much about errors.

Fixation

There were a lot of problems with creating windows, but most of them are related to the untidy installation of the assembly for the version of Windows for the plugin. It's nice to have a small script configuration for the Linux side of things, but what about windows? We need to do a little extra work.

Some of these additional works are related to the fact that I chose non-standard locations for the support libraries of my application. Qca and OpenSsl exist in the project directory structure in the libraries / directory. I assume you did something similar if you were trying to cross-compile your application, but even if the following didn't help you.

Search OpenSsl

Qca-ossl will not work very well if it cannot find the library to which it should connect ... :) So let's directly indicate where it is. Comment on the lines related to winlocal.prf and the changes that arise from it in qca-ossl.pro. We will directly indicate where to find openSsl.

 TEMPLATE = lib CONFIG += plugin QT -= gui DESTDIR = lib VERSION = 2.0.0 unix:include(conf.pri) windows:CONFIG += crypto windows:include(conf_win.pri) CONFIG += create_prl SOURCES = qca-ossl.cpp windows:{ # Rather than rely on the winlocal.prf file, we will specify the location of the openssl # by hand when running qmake. # # load(winlocal.prf) # isEmpty(WINLOCAL_PREFIX) { # error("WINLOCAL_PREFIX not found. See http://delta.affinix.com/platform/#winlocal") # } # # OPENSSL_PREFIX = $$WINLOCAL_PREFIX DEFINES += OSSL_097 INCLUDEPATH += $$OPENSSL_PREFIX/include LIBS += -L$$OPENSSL_PREFIX/lib LIBS += -llibeay32 -lssleay32 LIBS += -lgdi32 -lwsock32 } !debug_and_release|build_pass { CONFIG(debug, debug|release) { mac:TARGET = $$member(TARGET, 0)_debug windows:TARGET = $$member(TARGET, 0)d } } 

We now have direct access to the $$ OPENSSL_PREFIX environment variable in the .pro file. We can install it when we call qmake by doing the following.

 qmake.exe "OPENSSL_PREFIX=C:/path/to/openssl-1.0.0b" 

You can use backslash or slash. Here I choose forward, since Qt rejects them from 4.7.

Alternatively, you can set the OPENSSL_PREFIX variable directly in the .pro file.

Search Qca

After comparing unix and windows files for qca-ossl, oddly enough, it never includes qca libraries for building or linking!?!?! This led to a "Undefined interface" error in the Q_INTERFACES (QCAPlugin) line of the opensslPlugin class definition at the end of qca-ossl.cpp.

To avoid this, we need to explicitly define the input paths and libraries manually. Expanding along the qmake line from the last section, the last qmake line looks like this.

 qmake.exe "OPENSSL_PREFIX=C:/path/to/openssl-1.0.0b" "INCLUDEPATH+=C:/path/to/qca-2.0.3/include/QtCrypto" "LIBS+=-LC:/path/to/qca-2.0.3/lib -lqca2" 

"Installation" Qca-ossl

After running the qmake line above and starting a simple ol-make, you need to install Qca-ossl. You can copy the resulting dll from the lib / directory to the Qt plugins directory, which if you use my default versions is C: \ Qt \ 2010.05 \ qt \ plugins \ crypto. Alternatively, you can move it to the crypto directory, which is at the root level of the structure of your project, for example, C: \ path \ to \ my \ project \ crypto.

Hope this helps!

+5
source

Actually, you can try this QCA + OpenSSL tutorial in a window . It works well.

By the way, I can use QCA with AES 256 on Window. But I can not use it on Symbian. Any idea to do this?

Linked post

0
source

Source: https://habr.com/ru/post/1334432/


All Articles