Using QCA Encrypt Library with Qt >5



  • Hello,

    currently I'm trying to include the QCA-Libs (ver 2.1.3) into my program. I want to use the RSA Encryption and base64/sha algotithms.
    The Qt-Versions I'm using are 5.11.2 for the 32-bit version, and 5.12.1 for the 64-bit version.

    I've downloaded QCA from GitHub, and opened the CmakeLists with Qt-Creator.
    Running the rsatest , I'm getting follwing output:

    RSA not supported!
    

    Running the rsaunittest, I'm getting following output:

    ********* Start testing of RSAUnitTest *********
    Config: Using QtTest library 5.11.2, Qt 5.11.2 (i386-little_endian-ilp32 shared (dynamic) release build; by GCC 5.3.0)
    PASS   : RSAUnitTest::initTestCase()
    WARNING: RSAUnitTest::testrsa() RSA not supported for qca-ossl
    C:\Users\user\Downloads\qca-2.1.3\unittest\rsaunittest\rsaunittest.cpp(67) : failure location
    PASS   : RSAUnitTest::testrsa()
    WARNING: RSAUnitTest::testAsymmetricEncryption() RSA not supported
    C:\Users\user\Downloads\qca-2.1.3\unittest\rsaunittest\rsaunittest.cpp(157) : failure location
    SKIP   : RSAUnitTest::testAsymmetricEncryption() RSA not supported. skipping
    C:\Users\user\Downloads\qca-2.1.3\unittest\rsaunittest\rsaunittest.cpp(159) : failure location
    PASS   : RSAUnitTest::cleanupTestCase()
    Totals: 3 passed, 0 failed, 1 skipped, 0 blacklisted, 2ms
    ********* Finished testing of RSAUnitTest *********
    

    Does QCA run with QT>5? The readme says it's portet to Qt5.
    I'dont now if, but maybe the installation failed:
    within the CMakeLists file the install path is set to: C:\Qt\5.11.2\mingw53_32*, but the files are only located in the build folder of the project.

    Thank's for help in advance ;)

    Edit:

    at the /unittest/rsaunittest/rsaunittest.cpp is following defined:

    #if QT_VERSION >= 0x050000
    	    QSKIP("RSA not supported. skipping");
    #else
    	    QSKIP("RSA not supported. skipping",SkipAll);
    #endif
    

    So i guess it's not completely portet to Qt5?



  • ok, openSSL include path was missing, and because of that, the setup skipped compiling the "qca-ossl" plugin wich is nessesary for the RSA Encryption.

    Now i'm trying to include openssl... but i'm struggling at

    # include <openssl/opensslconf.h>
    

    the opensslconf.h is a architectur specific file and normally the file is generated while the compilation of openSSL.
    But I don't understand why it's not generated by the compiler in my case.


  • Lifetime Qt Champion

    Hi and welcome to devnet.

    Which version of OpenSSL are you using to build QCA ?



  • Hi ;)

    i'v tryed multiple versions:

    • 1.1.1b
    • current master branch of the git repo
    • 1.1.0k

  • Lifetime Qt Champion

    Just to be sure, I would check against the latest version of the 1.0 series.



  • So, finally I build openSSL(1.1.1b) with minGW and got the corresponding headers.

    At the QCA CMakeList there is the macro: "OPENSSL_INCLUDE_DIR" i've set the path and it's working.
    But how can I link/set the Path to the openSSL lib?
    Somehow it's not compiling qca-ossl.cpp because of the missing lib.

    best



  • ok, tried it with openSSL 1.0.2r, finally i'm getting ONLY one error while compiling qca-ossl.cpp:

    line 5810 :

    sessInfo.isCompressed = (0 != SSL_SESSION_get_compress_id(ssl->session));
    

    undefined reference to SSL_SESSION_get_compress_id


  • Lifetime Qt Champion

    @Hoehli said in Using QCA Encrypt Library with Qt >5:

    SSL_SESSION_get_compress_id

    Strange, that method is supposed to be available since 1.0.1...

    Can you find it in the headers of your installed OpenSSL version ?



  • Yes, it's defined in ssh.h which is included.

    I also have trouble to include the 64bit build of openSSL: while compiling qca-ossl.cpp i'll get a alot of undefined reference errors.. using the same mingw64 compiler


  • Lifetime Qt Champion

    Might be a silly question, but are you sure you are linking to the right version of OpenSSL ?

    You might be hitting a cmake cache entry.



  • @SGaist said in Using QCA Encrypt Library with Qt >5:

    Might be a silly question, but are you sure you are linking to the right version of OpenSSL ?

    Yes, think so :D. I included C:/openSSL32 for 32-bit, and C:/openSSL64 for 64-bit, that's the path I put my compiled openSSL.

    To compile openSSL (version 1.0.2r) I used MSYS2 and followed this discription. The minGW compiler I used was the one, shipped with QT at: c:/Qt/Tools/mingw530_32 for 32-bit and C:/Qt/Tools/mingw730_64.

    Configured the openSSL with the perl script with this options:

    ./Configure mingw shared no-idea no-mdc2 no-rc5 --prefix=/c/openSSL32
    

    and for 64-bit:

    ./Configure mingw64 shared no-idea no-mdc2 no-rc5 --prefix=/c/openSSL64
    

    Between those two steps I restarted MSYS2 and reconfigured the PATH variables to the corresponding minGW compiler.

    I also tried the mingw-w64 compiler (he didn't made it).

    You might be hitting a cmake cache entry.

    32-bit version: https://pastebin.com/2VYa47f0
    64-bit version: https://pastebin.com/4x0Sn5Xm

    If I'm comment the line 5810 (of qca-ossl.cpp - Version 2.1.3 of the QCA) out, the dll's are build and it's working (somehow but probably unstable).
    Thanks for the support! I appreciate.

    Edit:

    I had a deeper look into the CMakeCache files:
    at the 64bit-version i changed the Value for LIB_EAY from C:\Program Files (x86)\Intel\iCLS Client\libeay32.dll, to C:\Program Files\Intel\iCLS Client\ssleay32.dll.

    This reduced the undefined reference errors, now I only get the same error as for the 32-bit version at line 5810.
    YAY -> one step away :D

    man, that's pain on windows... on Arch Linux QCA compiled "out of the box"...

    Edit2:
    tried the current master branch of openSSL (1.0.2s) still the same error.



  • no more ideas?


  • Lifetime Qt Champion

    Rather than replacing the library, did you try link them both ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.