mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
format: Add challenge response result to final key hash
* The challengeMasterSeed() function return empty if not present maintaining backwards compatability. * This commit is where the challenge response result is computed into the final key used to encrypt or decrypt the database. Signed-off-by: Kyle Manna <kyle@kylemanna.com>
This commit is contained in:
parent
e354a0ee0e
commit
add4846d79
@ -115,6 +115,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
|
|
||||||
CryptoHash hash(CryptoHash::Sha256);
|
CryptoHash hash(CryptoHash::Sha256);
|
||||||
hash.addData(m_masterSeed);
|
hash.addData(m_masterSeed);
|
||||||
|
hash.addData(m_db->challengeMasterSeed(m_masterSeed));
|
||||||
hash.addData(m_db->transformedMasterKey());
|
hash.addData(m_db->transformedMasterKey());
|
||||||
QByteArray finalKey = hash.result();
|
QByteArray finalKey = hash.result();
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ void KeePass2Writer::writeDatabase(QIODevice* device, Database* db)
|
|||||||
|
|
||||||
CryptoHash hash(CryptoHash::Sha256);
|
CryptoHash hash(CryptoHash::Sha256);
|
||||||
hash.addData(masterSeed);
|
hash.addData(masterSeed);
|
||||||
|
hash.addData(db->challengeMasterSeed(masterSeed));
|
||||||
Q_ASSERT(!db->transformedMasterKey().isEmpty());
|
Q_ASSERT(!db->transformedMasterKey().isEmpty());
|
||||||
hash.addData(db->transformedMasterKey());
|
hash.addData(db->transformedMasterKey());
|
||||||
QByteArray finalKey = hash.result();
|
QByteArray finalKey = hash.result();
|
||||||
|
Loading…
Reference in New Issue
Block a user