best way to use AES Encryption in QT
-
Then you should link to botan and not botand.
-
@SGaist said in best way to use AES Encryption in QT:
Then you should link to botan and not botand.
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../Botan/lib/ -lbotan else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../Botan/lib/ -lbotand INCLUDEPATH += $$PWD/../../../../../Botan/include DEPENDPATH += $$PWD/../../../../../Botan/include
when i add lib on qt this line add in pro file
also when i deleteelse:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../Botan/lib/ -lbotand
i got more error
everything seems good until i try to compile -
Either you need to also build botan in debug mode so you have the two versions of the library or you change the .pro file to always link to the version you have built.
-
@SGaist said in best way to use AES Encryption in QT:
Either you need to also build botan in debug mode so you have the two versions of the library or you change the .pro file to always link to the version you have built.
when i edit pro file and remove other one its give me more error
how can i build debug version of botan? -
Because you removed the line trying to link to botand -and you likely have now a lot of undefined symbols.
Just use:
LIBS += -L$$PWD/../../../../../Botan/lib/ -lbotan
As for building botan in debug mode, tell cmake you want a Debug build.
-
@SGaist said in best way to use AES Encryption in QT:
LIBS += -L$$PWD/../../../../../Botan/lib/ -lbotan
I test what you say
this time i get even more error
my .pro
LIBS += -L$$PWD/../../../../../Botan/lib/ -lbotan INCLUDEPATH += $$PWD/../../../../../Botan/include DEPENDPATH += $$PWD/../../../../../Botan/include
my full code:
#include "mainwindow2.h" #include "ui_mainwindow2.h" #include "botan/botan.h" #include "botan/pipe.h" #include "botan/aes.h" #include "botan/filters.h" MainWindow2::MainWindow2(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow2) { ui->setupUi(this); Botan::InitializationVector init; } MainWindow2::~MainWindow2() { delete ui; } void MainWindow2::on_pushButton_clicked() { Botan::AutoSeeded_RNG rng; Botan::SymmetricKey key(rng,32); Botan::InitializationVector IV(rng,16); Botan::Pipe pipe(Botan::get_cipher("AES-256/CBC",key,IV,Botan::ENCRYPTION),new Botan::Hex_Encoder); pipe.process_msg(ui->textEdit_input->toPlainText().toStdString()); std::string m1=pipe.read_all_as_string(0); ui->textEdit_output_E->setText(QString::fromStdString(m1)); }
-
Are you sure that the library was built for thé same architecture as the Qt version you are using ?
-
@SGaist said in best way to use AES Encryption in QT:
Are you sure that the library was built for thé same architecture as the Qt version you are using ?
i see a video in yotube use botan 1.10.8 on QT 4.8.5
you think its not support new verson of qt? -
You should use the latest version of botan for security reasons.
In any case, it's completely unrelated to my question: aare the architectures of your botan build and Qt the same ?
-
@SGaist said in best way to use AES Encryption in QT:
You should use the latest version of botan for security reasons.
In any case, it's completely unrelated to my question: aare the architectures of your botan build and Qt the same ?
sorry for this question, but how i cant found out (im new at c++ and qt)
-
You can use dumpbin as explained here
-
@SGaist said in best way to use AES Encryption in QT:
You can use dumpbin as explained here
-
Did you also compile botan with MinGW ?
-
@SGaist said in best way to use AES Encryption in QT:
Did you also compile botan with MinGW ?
no i compile it with nmake
i need to compile it with MiniGW? -
If you used nmake, it means that in fact you used Visual Studio to build botan. So there's your issue. You can't mix C++ code built with MinGW with C++ code built with Visual Studio.
Tow options here:
- rebuild botan using MinGW
- change your Qt version and use the one that matches your Visual Studio version
-
@SGaist said in best way to use AES Encryption in QT:
If you used nmake, it means that in fact you used Visual Studio to build botan. So there's your issue. You can't mix C++ code built with MinGW with C++ code built with Visual Studio.
Tow options here:
- rebuild botan using MinGW
- change your Qt version and use the one that matches your Visual Studio version
you recommend what version of qt for this?
i think its beter to compile botan again.. -
As I said: the one matching your current version of Visual Studio.
-
@SGaist said in best way to use AES Encryption in QT:
As I said: the one matching your current version of Visual Studio.
sorry i made a mistake
I mean, which version of mingw do you recommend? -
Use the one from your Qt installation.
-
@SGaist said in best way to use AES Encryption in QT:
Use the one from your Qt installation.
ok i start make with mingw32-make.exe located in Qt\Tools\mingw810_64\bin
15/26