Problem using RSA algorythme in QCA
-
I'm using QCA in my programme to genrate public and private keys.
But when I do write the code above:
@if(!QCA::isSupported("pkey") ||
!QCA::PKey::supportedIOTypes("pkey").contains(QCA::PKey::RSA)){ qDebug() << "RSA not supported!\n"; } else { //Génération de la clé privé //QCA::DLGroup dLGroup(1024,1024); QCA::PrivateKey seckey = QCA::KeyGenerator().createRSA(1024); }@
I have the message
"RSA not supported!\n"
Whitch is displayed.-NB-
I'm using the source code of QCA in my project.This is the list of files included:
qca_basic.h/.cpp
qca_cert.h/.cpp
qca_core.h/.cpp
qca_export.h/.cpp
qca_keystore.h/.cpp
qca_publickey.h/.cpp
qca_securelayer.h/.cpp
qca_securemessage.h/.cpp
qca_support.h/.cpp
qca_textfilter.h/.cpp
qca_tools.h/.cpp
qca_provider.h/.cpp
qca_pipe.h/.cpp
qca_default.cpp
qca_plugin.h/.cpp
qca_safeobj.h/.cppWhy the RSA is not supported??
-
Please give people a chance to answer. We are all volunteers on here, not paid support staff.
As to your problem, QCA itself provides only an interface. The actual functionality is provided by the various QCA plugins. In this case I think you need to make sure that the qca-ossl plugin is actually getting loaded by your application.
I have used code similar to the following to show info about what facilities your QCA install is able to provide:
@
QString info;
QCA::scanForPlugins();// this gives us all the plugin providers as a list QCA::ProviderList qcaProviders = QCA::providers(); for ( int i = 0; i < qcaProviders.size(); ++i ) { // each provider has a name, which we can display info += qcaProviders[i]->name() + ": "; // ... and also a list of features QStringList capabilities = qcaProviders[i]->features(); // we turn the string list back into a single string, // and display it as well info += capabilities.join(", ") + "\n"; } // Note that the default provider isn't included in // the result of QCA::providers() info += "default: "; // However it is still possible to get the features // supported by the default provider QStringList capabilities = QCA::defaultFeatures(); info += capabilities.join(", ") + "\n"; qDebug() << info;
@
-
For info, when qca-ossl is loaded you should see output like this:
@
qca-ossl: sha1, sha0, ripemd160, md4, md5, sha224, sha256, sha384, sha512, hmac(md5), hmac(sha1), hmac(sha224), hmac(sha256), hmac(sha384), hmac(sha512), hmac(ripemd160), aes128-ecb, aes128-cfb, aes128-cbc, aes128-cbc-pkcs7, aes128-ofb, aes192-ecb, aes192-cfb, aes192-cbc, aes192-cbc-pkcs7, aes192-ofb, aes256-ecb, aes256-cbc, aes256-cbc-pkcs7, aes256-cfb, aes256-ofb, blowfish-ecb, blowfish-cbc-pkcs7, blowfish-cbc, blowfish-cfb, blowfish-ofb, tripledes-ecb, tripledes-cbc, des-ecb, des-ecb-pkcs7, des-cbc, des-cbc-pkcs7, des-cfb, des-ofb, cast5-ecb, cast5-cbc, cast5-cbc-pkcs7, cast5-cfb, cast5-ofb, pbkdf1(sha1), pbkdf2(sha1), pkey, dlgroup, rsa, dsa, dh, cert, csr, crl, certcollection, pkcs12, tls, cms, ca default: random, md5, sha1, keystorelist
@ -
What platform are you on?
I'm using Fedora 14
Have you installed qca-ossl either from system packages on Linux or from source elsewhere?
qca-ossl is not installed.
I don't want to installed on the system. I want to put it in my project source as the other. What files should I add to my sources for this plugin is loaded in my applicationEdit: removed code tags [ZapB]
-
I'm not sure you can do that easily. QCA is designed around a plugin architecture. Why do you not want to simply link against QCA library and allow it to load the plugins?
If you really want to include this in your project directly then you'll need to download the source code for qca-ossl and hack it into submission. I do not know exactly which files you'll need but from memory it consists of a small number of files.
-
I want my application to be supported by other systems of exploitation such as Mac OS, Windows.
If the method that you can offer me that the application can be compiled on other OS without installing qca-ssl, how can make the connection? IHow can I link against QCA library and allow it to load the plugins?
-
So you just ship the QCA lib and qca-ossl plugin (and openssl of course) with your application on those platforms. We do it with out any problems on Linux and Windows.
You can put the qca2.dll and the OpenSSL dll's (libeay32.dll, ssleay32.dll, libssl32.dll) into the install dir next to your application. The qca-ossl is a plugin and should be put into a subdir called crypto in order for the plugin system to be able to find it at runtime.
I would not bother trying to compile qca and qca-ossl directly into your application.
HTH
-
I joined the sources of qca-ossl in my project, but there are files of openssl that are imported in the file qca-ossl.cpp, but the application does not see them. Do I have to integrate the sources of openssl in my project?
At the instruction: INSTALL (TARGETS qca-ossl LIBRARY DESTINATION $ {qca_PLUGINSDIR} ) I changed by putting: INSTALL (TARGETS qca-ossl LIBRARY DESTINATION / usr / share / monRep). Because he could not find the directory $ {qca_PLUGINSDIR}
This is the CMakeList.txt of the qca-ossl:
@########################################################################################
########################################################################################CMAKE PROJECT
########################################################################################
########################################################################################
PROJECT (QCA_OSSL)cmake_minimum_required( VERSION 2.6 )
SET(QCA_OSSL_SOURCES qca-ossl.cpp)
#MY_AUTOMOC( QCA_OSSL_SOURCES )
ADD_LIBRARY(qca-ossl SHARED ${QCA_OSSL_SOURCES})
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(qca-ossl ${QT_QTCORE_LIBRARY})
TARGET_LINK_LIBRARIES(qca-ossl qca)
TARGET_LINK_LIBRARIES(qca-ossl ${OPENSSL_LIBRARIES})
if(APPLE)
TARGET_LINK_LIBRARIES(qca-ossl crypto)
endif(APPLE)
IF (WIN32)
ADD_DEFINITIONS(-DOSSL_097)
TARGET_LINK_LIBRARIES(qca-ossl gdi32)
TARGET_LINK_LIBRARIES(qca-ossl wsock32)
TARGET_LINK_LIBRARIES(qca-ossl ${OPENSSL_EAY_LIBRARIES})
ENDIF (WIN32)INSTALL(TARGETS qca-ossl LIBRARY DESTINATION ${qca_PLUGINSDIR})@
When I execute my application I have the error message
@[ 98%] Building CXX object composants/qca-ossl-0.1/CMakeFiles/qca-ossl.dir/qca-ossl.cpp.o
In file included from /usr/include/QtCrypto/qca.h:36:0,
from /usr/include/QtCrypto/QtCrypto:1,
from /home/sfaye/Qt/in-tactick/int-tactic/xsimul/trunk/sources/composants/qca-ossl-0.1/qca-ossl.cpp:21:
/usr/include/QtCrypto/qca_core.h:45:19: erreur fatale: QString : Aucun fichier ou dossier de ce type
compilation terminée.
make[2]: *** [composants/qca-ossl-0.1/CMakeFiles/qca-ossl.dir/qca-ossl.cpp.o] Erreur 1
make[1]: *** [composants/qca-ossl-0.1/CMakeFiles/qca-ossl.dir/all] Erreur 2
make: *** [all] Erreur 2
Le processus "/usr/bin/make" s'est terminé avec le code 2.@
Help please. -
Once again, please be patient. 1 hour is not enough time for people to see your question and get a response. Please wait longer before bumping a thread.
Why do you not just try it the way we suggested? ie Build qca and qca-ossl normally then ship them with your executable?
As for your specific question, of course qca-ossl requires headers form openssl. It is wrapping the openssl functionality. So you will need to have the openssl headers in a path searched by the compiler. You will still need to deploy the openssl libs anyway - unless you plan on integrating those into your project too?!?!
-
-
I'll leave Volker to answer for the Mac side of things but on Windows I use NSIS to build an installer. I've already told you how to structure your installation dir on Windows but here it is again:
@
$INSTALLDIR
$INSTALLDIR/application.exe
$INSTALLDIR/$QTLIBS
$INSTALLDIR/{libeay32.dll, ssleay32.dll, libssl32.dll}
$INSTALLDIR/qca2.dll
$INSTALLDIR/crypto/qca-ossl.dll
@This really is much less work than trying to compile all of these projects into your application.