A Qt-Wrapper for the AES-implementation kokke/tiny-AES128-C

version 3.0.0

To install:

❯ qpm install de.skycoder42.qtinyaes


A Qt-Wrapper for the AES-implementation kokke/tiny-AES-C (supports AES128/192/256)

This class is simply a wrapper for It allows to use the simple AES-implementation inside Qt and with Qt's QByteArray class. Thanks to recent updates, allowing keys of size 128, 192 and 256.


  • It's a C++-class instead of just C-functions
  • Easy integration with Qt-Projects thanks to the use of QByteArray
  • Allows plain-texts of any size - #PKCS7 Padding is added automatically
  • Supports all common AES keysizes (compile-time switch)
  • Currently supports CTR, CBC and ECB as modes


The package is providet as qpm package, de.skycoder42.qtinyaes. To install:

  1. Install qpm (See GitHub - Installing, for windows see below)
  2. In your projects root directory, run qpm install de.skycoder42.qtinyaes
  3. Include qpm to your project by adding include(vendor/vendor.pri) to your .pro file

Check their GitHub - Usage for App Developers to learn more about qpm.

Important for Windows users: QPM Version 0.10.0 (the one you can download on the website) is currently broken on windows! It's already fixed in master, but not released yet. Until a newer versions gets released, you can download the latest dev build from here:


QTinyAes aes;

aes.setKey("randomkey_256bit");// QTinyAes::KeySize (256 bit key by default)
//or with Qt 5.10
aes.setIv("random_iv_128bit");// QTinyAes::BlockSize (128 iv vector)

QByteArray plain = "Hello World";
qDebug() << "plain:" << plain
QByteArray cipher = aes.encrypt(plain);
qDebug() << "cipher:" << cipher;
QByteArray result = aes.decrypt(cipher);
qDebug() << "result:" << result;

Changing the key size

By default, your keys must be 256 bit keys. However, you can change this size to 192 or 128 if you need to. This can be done via a qmake variable, as the keysize as a compile time switch (due to limitations of kokke/tiny-AES-C).

To change the size, set the TINYAES_KEYSIZE qmake variable to the desired keysize before including vendor.pri/add the qpmx code. Note that for qpmx this only works on source builds, not on compile builds:

TINYAES_KEYSIZE = 128 #or 192 or the default, 256

include(vendor/vendor.pri) #or qpmx stuff


View on Github

License: BSD_3_CLAUSE

Today 3
This week 3
This month 12
This year 493
Total 493