mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-04 17:05:23 -05:00
Regenerate key in Database::setTransformRounds().
Merge Database::updateKey() into Database::setTransformRounds() and regenerate the key if the database already has a key. Closes #34
This commit is contained in:
parent
2b694bab16
commit
66422437d3
@ -189,7 +189,15 @@ void Database::setCompressionAlgo(Database::CompressionAlgorithm algo)
|
|||||||
|
|
||||||
void Database::setTransformRounds(quint64 rounds)
|
void Database::setTransformRounds(quint64 rounds)
|
||||||
{
|
{
|
||||||
|
if (m_transformRounds != rounds) {
|
||||||
m_transformRounds = rounds;
|
m_transformRounds = rounds;
|
||||||
|
|
||||||
|
if (m_hasKey) {
|
||||||
|
m_transformedMasterKey = m_key.transform(m_transformSeed, m_transformRounds);
|
||||||
|
m_metadata->setMasterKeyChanged(Tools::currentDateTimeUtc());
|
||||||
|
Q_EMIT modifiedImmediate();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::setKey(const CompositeKey& key, const QByteArray& transformSeed, bool updateChangedTime)
|
void Database::setKey(const CompositeKey& key, const QByteArray& transformSeed, bool updateChangedTime)
|
||||||
@ -209,16 +217,6 @@ void Database::setKey(const CompositeKey& key)
|
|||||||
setKey(key, Random::randomArray(32));
|
setKey(key, Random::randomArray(32));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::updateKey(quint64 rounds)
|
|
||||||
{
|
|
||||||
if (m_transformRounds != rounds) {
|
|
||||||
m_transformRounds = rounds;
|
|
||||||
m_transformedMasterKey = m_key.transform(m_transformSeed, transformRounds());
|
|
||||||
m_metadata->setMasterKeyChanged(Tools::currentDateTimeUtc());
|
|
||||||
Q_EMIT modifiedImmediate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Database::hasKey()
|
bool Database::hasKey()
|
||||||
{
|
{
|
||||||
return m_hasKey;
|
return m_hasKey;
|
||||||
|
@ -86,7 +86,6 @@ public:
|
|||||||
* Sets the database key and generates a random transform seed.
|
* Sets the database key and generates a random transform seed.
|
||||||
*/
|
*/
|
||||||
void setKey(const CompositeKey& key);
|
void setKey(const CompositeKey& key);
|
||||||
void updateKey(quint64 rounds);
|
|
||||||
bool hasKey();
|
bool hasKey();
|
||||||
void recycleEntry(Entry* entry);
|
void recycleEntry(Entry* entry);
|
||||||
void recycleGroup(Group* group);
|
void recycleGroup(Group* group);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user