The code below shows the normal way to use the QCA::Cipher class.
#include <QtCrypto>
#include <stdio.h>
#include <QCoreApplication>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"
#endif
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
printf("AES128-CBC not supported!\n");
else {
key, iv);
printf("Update failed\n");
}
printf("AES128 encryption of %s is [%s]\n",
printf("Final failed\n");
}
printf("Update failed\n");
}
printf("Decryption using AES128 of [0x%s] is %s\n",
plainText = cipher.
final();
printf("Final failed\n");
}
printf(
"Final decryption block using AES128 is %s\n", plainText.
data());
printf("One step decryption using AES128: %s\n",
}
return 0;
}
virtual MemoryRegion update(const MemoryRegion &a)
pass in a byte array of data, which will be encrypted or decrypted (according to the Direction that w...
virtual MemoryRegion final()
complete the block of data, padding as required, and returning the completed block
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Test if a capability (algorithm) is available.
void setup(Direction dir, const SymmetricKey &key, const InitializationVector &iv=InitializationVector())
Reset / reconfigure the Cipher.