Closed ArchNemSyS closed 2 weeks ago
More coffee required, sorry
helps if you supply AES128 with a 128-bit key !
#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
#include <QPasswordDigestor>
#include <QtAES/QAESEncryption>
int main(int argc, char *argv[])
{
//QApplication a(argc, argv);
//MainWindow w;
//w.show();
auto iterations = 600000;
auto keyLen = 16;
auto res = QPasswordDigestor::deriveKeyPbkdf2(QCryptographicHash::Algorithm::Sha256,
QString("password").toUtf8(),
QString("saltsaltsalt").toUtf8(),
iterations,
keyLen);
auto key = res;
QByteArray plainText("top secret");
qDebug() << key.toHex();
QAESEncryption encryption(QAESEncryption::AES_128, QAESEncryption::ECB);
QByteArray encodedText = encryption.encode(plainText, key);
qDebug() << "encodedText : " << QString(encodedText);
QByteArray decodedText = encryption.decode(encodedText, key);
qDebug() << "decodedText : " << QString(decodedText);
//return a.exec();
}
works perfectly, just got to remember to terminate my strings
I have built QtAES (linux cmake gcc) and all of the tests passed.
Upon integrating it into my project as a library I copied the 128bit key in ECB mode sample into main as below :
Concise Client main.cpp GitLab project link
I receive no errors compiling or running the code, However the variable encodedText is empty ?
I did get a cryptic linker message on a clean rebuild :
Any ideas where I have gone wrong ?