Make sure we have initialized QCA before using it

QCA::isSupported uses a private global object that is 0 if
QCA::Initializer is not instanciated.
This commit is contained in:
Àlex Fiestas 2014-09-12 23:32:19 +02:00
parent 994057af0e
commit a0ff36625d

View file

@ -91,6 +91,7 @@ void NetworkPackageTests::networkPackageIdentityTest()
void NetworkPackageTests::networkPackageEncryptionTest()
{
QCA::Initializer init;
if(!QCA::isSupported("rsa")) {
QFAIL("RSA isn't supported by your QCA. ");
return;
@ -105,7 +106,6 @@ void NetworkPackageTests::networkPackageEncryptionTest()
NetworkPackage decrypted("");
QCA::Initializer init;
QCA::PrivateKey privateKey = QCA::KeyGenerator().createRSA(2048);
QVERIFY(!privateKey.isNull());
QCA::PublicKey publicKey = privateKey.toPublicKey();