QFile file(filePath);
if (!file.open(QIODevice::ReadOnly))
{
QMessageBox::warning(this, qApp->applicationName(), "Cannot open the file");
return;
}
CryptFileDevice cryptFileDevice;
cryptFileDevice.setFileName(filePath + ".e");
cryptFileDevice.setPassword(QByteArrayLiteral("databasepass")); //Here is a problem with password!!!!
cryptFileDevice.setSalt(QByteArrayLiteral("salt"));
if(!cryptFileDevice.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
QMessageBox::warning(this, qApp->applicationName(), "Cannot encrypt file");
return;
}
cryptFileDevice.write(file.readAll());
file.close();
cryptFileDevice.close();
Hello!
I am using the cryptFileDevice class and the code below to encrypt a file. Please tell me how to decrypt the received file using cryptFileDevice?