#include <QtCrypto>
#include <cstdio>
#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("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());
}
return 0;
}
General class for cipher (encryption / decryption) algorithms.
Definition qca_basic.h:582
@ CBC
operate in Cipher Block Chaining mode
Definition qca_basic.h:593
void setup(Direction dir, const SymmetricKey &key, const InitializationVector &iv=InitializationVector())
Reset / reconfigure the Cipher.
MemoryRegion update(const MemoryRegion &a) override
pass in a byte array of data, which will be encrypted or decrypted (according to the Direction that w...
bool ok() const override
Test if an update() or final() call succeeded.
MemoryRegion final() override
complete the block of data, padding as required, and returning the completed block
@ DefaultPadding
Default for cipher-mode.
Definition qca_basic.h:610
MemoryRegion process(const MemoryRegion &a)
Perform an "all in one" update, returning the result.
Container for initialisation vectors and nonces.
Definition qca_core.h:1310
Convenience method for initialising and cleaning up QCA.
Definition qca_core.h:660
Secure array of bytes.
Definition qca_tools.h:317
char * data()
Pointer to the data in the secure array.
QByteArray toByteArray() const
Copy the contents of the secure array out to a standard QByteArray.
SecureArray & append(const SecureArray &a)
Append a secure byte array to the end of this array.
Container for keys for symmetric encryption algorithms.
Definition qca_core.h:1264
QCA_EXPORT QString arrayToHex(const QByteArray &array)
Convert a byte array to printable hexadecimal representation.
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Test if a capability (algorithm) is available.
@ Encode
Operate in the "forward" direction; for example, encrypting.
Definition qca_core.h:142
@ Decode
Operate in the "reverse" direction; for example, decrypting.
Definition qca_core.h:143