2019-09-01 14:07:58 +02:00
|
|
|
|
#ifndef KEYSTRENGTHENER_H
|
|
|
|
|
|
#define KEYSTRENGTHENER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <botan/pwdhash.h>
|
|
|
|
|
|
#include <botan/secmem.h>
|
|
|
|
|
|
#include <memory>
|
2025-02-22 19:59:24 +01:00
|
|
|
|
#include "sqlite/SQLiteConnection.h"
|
2019-09-01 14:07:58 +02:00
|
|
|
|
|
|
|
|
|
|
class KeyStrengthener {
|
|
|
|
|
|
public:
|
|
|
|
|
|
KeyStrengthener() = default;
|
|
|
|
|
|
KeyStrengthener(std::unique_ptr<Botan::PasswordHash> hasher, Botan::secure_vector<uint8_t> salt, size_t keysize);
|
|
|
|
|
|
|
|
|
|
|
|
KeyStrengthener(const KeyStrengthener&) = delete;
|
|
|
|
|
|
KeyStrengthener& operator=(const KeyStrengthener &) = delete;
|
|
|
|
|
|
|
|
|
|
|
|
KeyStrengthener(KeyStrengthener &&rhs);
|
|
|
|
|
|
|
|
|
|
|
|
KeyStrengthener& operator=(KeyStrengthener &&rhs);
|
|
|
|
|
|
|
|
|
|
|
|
Botan::secure_vector<uint8_t> derive(const std::string &passphrase);
|
2025-02-22 19:59:24 +01:00
|
|
|
|
void saveParams(SQLiteConnection &db, const QString &table_name);
|
2019-09-01 14:07:58 +02:00
|
|
|
|
private:
|
|
|
|
|
|
std::unique_ptr<Botan::PasswordHash> m_hasher;
|
|
|
|
|
|
Botan::secure_vector<uint8_t> m_salt;
|
|
|
|
|
|
size_t m_keySize;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // KEYSTRENGTHENER_H
|