PDA

View Full Version : QCA (on Windows): trouble using qca-ossl when creating a public key



pocketchange
9th March 2011, 22:26
I’m having a hard time determining where to submit bugs or find help using the QCA. I’m building on Windows using Mingw and I get a segfault at the line:


k->createPublic(n, e);

in the method:


RSAPublicKey::RSAPublicKey(const BigInteger &n, const BigInteger &e, const QString &provider)

All my unit tests pass but I don’t see a particular unit test for creating a public key directly from the modulus and exponent (one of the few examples I found online):


QString eee("22640209");//exp: got from server
QString mmm("95033496681677513042303794296510796923484007896833 482880191206334940729008671");
QCA::BigInteger exp11(eee);
QCA::BigInteger mod11(mmm);
QCA::PublicKey *public_key;
public_key = new QCA::RSAPublicKey(mod11,exp11,"qca-ossl");

What might I be doing wrong when building in windows? Is the provider not loading? If I run "qcatool2 plugins" I get

C:\workspace\qtcreator-build>qcatool2 plugins
Qt Library Paths:
C:/QtSDK/Desktop/Qt/4.7.2/mingw/plugins
C:/QtSDK/Desktop/Qt/4.7.2/mingw/bin
Available Providers:
qca-logger
qca-ossl
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com)
qca-softstore

Added after 4 minutes:

It's also worth mentioning that I have the code wrapped like so:


if (!QCA::isSupported("pkey", "qca-ossl") ||
!QCA::PKey::supportedTypes("qca-ossl").contains(QCA::PKey::RSA) ||
!QCA::PKey::supportedIOTypes("qca-ossl").contains(QCA::PKey::RSA)) {
qDebug() << "RSA not supported!";
} else {
QString eee("22640209");//exp: got from server
QString mmm("95033496681677513042303794296510796923484007896833 482880191206334940729008671");
QCA::BigInteger exp11(eee);
QCA::BigInteger mod11(mmm);
QCA::PublicKey *public_key;
public_key = new QCA::RSAPublicKey(mod11,exp11,"qca-ossl");
}


And I do initialize the QCA in main.cpp.

pocketchange
10th March 2011, 20:59
Ok, I (soft of) solved this. The probably only exists in the qcad2.dll, so if I like to the non-debug version, it seems to work just fine. I just modified my crypto.prf file and modified the line



windows:LINKAGE = -lqcad


to


windows:LINKAGE = -lqca


That let me continue with my application (although I'm unable to debug QCA, but I haven't had to yet).

MagicR
2nd November 2011, 03:08
You can try the tutorial in http://www.essentialunix.org/index.php?option=com_content&view=article&id=48:qcatutorial&catid=34:qttutorials&Itemid=53

And then you build the source of QCA in "Desktop release" and "Desktop Debug". It will generate the lib in rel and deb folder and possible to use it. I can do encry and decry on Desktop now. (Windows 7 + qca + qca-ossl with aes 256)

Btw, i can't make use of it on Symbian Platform. Seem i'm using "OpenSSL for desktop". Do you have any idea?

Thanks.