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

version 2.1.0

To install:

❯ qpm install de.skycoder42.qtinyaes


A Qt-Wrapper for the AES-implementation kokke/tiny-AES128-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 - padding will be added automatically
  • Supports all common AES keysizes (compile-time switch)


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)
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-AES128-C).

To change the size, set the QTAES_KEYSIZE qmake variable to the desired keysize before including vendor.pri/qtinyaes.pri:

QTAES_KEYSIZE = 128 #or 192 or the default, 256

include(vendor/vendor.pri) #or qtinyaes.pri, when not using qpm


View on Github

License: BSD_3_CLAUSE

Today 3
This week 5
This month 33
This year 431
Total 431