Apply PBKDF2 to GUI lock

This commit is contained in:
Chocobo1 2018-11-21 21:40:31 +08:00
parent 05d6a29416
commit 2c8890bd06
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
4 changed files with 40 additions and 57 deletions

View file

@ -29,7 +29,6 @@
#include "preferences.h"
#include <QCryptographicHash>
#include <QDir>
#include <QLocale>
#include <QMutableListIterator>
@ -725,22 +724,14 @@ void Preferences::setDynDNSPassword(const QString &password)
}
// Advanced settings
void Preferences::clearUILockPassword()
QByteArray Preferences::getUILockPassword() const
{
setValue("Locking/password", QString());
return value("Locking/password_PBKDF2").toByteArray();
}
QString Preferences::getUILockPasswordMD5() const
void Preferences::setUILockPassword(const QByteArray &password)
{
return value("Locking/password").toString();
}
void Preferences::setUILockPassword(const QString &clearPassword)
{
QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData(clearPassword.toLocal8Bit());
QString md5Password = md5.result().toHex();
setValue("Locking/password", md5Password);
setValue("Locking/password_PBKDF2", password);
}
bool Preferences::isUILocked() const