D
D
Dmitry15552020-11-25 00:22:39
Qt
Dmitry1555, 2020-11-25 00:22:39

Error in QT error: no member named 'LibraryInitializer' in namespace 'Botan'. twofish algorithm through botan how to solve?

I implement the Twofish encryption algorithm through the Botan-2.17.2 crypto library. Doesn't recognize Botan::LibraryInitializer init. Help solve
the listing

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "botan/botan.h"
#include "botan/pipe.h"





MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    Botan::LibraryInitializer init;
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_EncryptDecrypt_clicked()
{
    Botan::AutoSeeded_RNG rng;
    //key 256 bit
    Botan::SymmetricKey key (rng,32);
    //iv 128 bit
    Botan::InitializationVector iv (rng,16);
    Botan::Pipe pipe(Botan::get_cipher("Twofish/CBC",key, iv ,Botan::ENCRYPTION), new Botan::Hex_Encoder);
    //input
    pipe.process_msg(ui->textEdit_Input->toPlainText().toStdString());
    std::string cipcherText=pipe.read_all_as_string();
    ui->textEdit_OutputEncrypt->setText(QString::fromStdString(cipcherText));

    //Decrypt
    Botan::Pipe pipe1(new Botan::Hex_Decoder,Botan::get_cipher("Twofish/CBC",key, iv,Botan::DECRYPTION));
    pipe1.process_msg(ui->textEdit_OutputEncrypt->toPlainText().toStdString());
    std::string plaintext=pipe1.read_all_as_string();
    ui->textEdit_OutputDecrypt->setText(QString::fromStdString(plaintext));

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question