Secure settings refactoring
This commit is contained in:
parent
1e85b25438
commit
585de53148
7 changed files with 122 additions and 73 deletions
|
|
@ -4,6 +4,9 @@
|
|||
#include <QSettings>
|
||||
#include <QObject>
|
||||
|
||||
constexpr const char* settingsKeyTag = "settingsKeyTag";
|
||||
constexpr const char* settingsIvTag = "settingsIvTag";
|
||||
|
||||
class SecureQSettings : public QObject
|
||||
{
|
||||
public:
|
||||
|
|
@ -17,13 +20,21 @@ public:
|
|||
QByteArray backupAppConfig() const;
|
||||
void restoreAppConfig(const QByteArray &base64Cfg);
|
||||
|
||||
QByteArray encryptText(const QByteArray &value) const;
|
||||
QByteArray decryptText(const QByteArray& ba) const;
|
||||
|
||||
bool encryptionRequired() const;
|
||||
|
||||
private:
|
||||
QSettings m_setting;
|
||||
bool encrypted {false};
|
||||
|
||||
mutable QMap<QString, QVariant> m_cache;
|
||||
|
||||
QStringList encryptedKeys; // encode only key listed here
|
||||
|
||||
QByteArray key;
|
||||
QByteArray iv;
|
||||
int iv_len {16};
|
||||
};
|
||||
|
||||
#endif // SECUREQSETTINGS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue