How to use SimlpeCrypt in qt c++
-
I save my password in a text file. I need to save the string by encrypting it during recording. I think I can solve this with SimpleCrypt, but since I started c++ a few days ago, I couldn't use simplecrypt. Can you teach me how to do this?
void SecondWindow::on_pushButton_8_clicked() { QFile file(passLocation + "/test/password.txt"); QFile tmpFile(passLocation + "/test/passwordtemp.txt"); if (!file.open(QIODevice::ReadOnly | QIODevice::Text) || !tmpFile.open(QIODevice::WriteOnly | QIODevice::Text)) return; QTextStream in(&file); QString line = in.readLine(); qDebug()<< line; if (line == ui->oldPassBox->text() && ui->confirmPass->text() == ui->newPassBox->text()) { QTextStream tmp(&tmpFile); tmp << ui->newPassBox->text(); } else { QMessageBox::warning(this, "error","Error" ); QTextStream tmp(&tmpFile); tmp << line ; } file.close(); tmpFile.close(); QFile::remove(passLocation + "/test/password.txt"); QFile::rename(passLocation + "/test/passwordtemp.txt", passLocation + "/test/password.txt" ); }
I referenced this link for SimpleCrypt [SımpleCrypt]https://wiki.qt.io/Simple_encryption_with_SimpleCrypt) And examples from this link examples
-
Your first link contains all the code which is needed for this task.