mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-10 02:25:38 -04:00
Integrate KeePass2RandomStream into KeePass2 reader and writer classes.
This hopefully completes support for reading/writing kdbx <= 2.14 files. Also fix a bug in KeePass2XmlWriter so it sets Protected="True" in the Value tag instead of Key.
This commit is contained in:
parent
58e048be96
commit
a299dd9715
12 changed files with 200 additions and 45 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "core/Database.h"
|
||||
#include "crypto/CryptoHash.h"
|
||||
#include "format/KeePass2.h"
|
||||
#include "format/KeePass2RandomStream.h"
|
||||
#include "format/KeePass2XmlReader.h"
|
||||
#include "streams/HashedBlockStream.h"
|
||||
#include "streams/QtIOCompressor"
|
||||
|
@ -102,10 +103,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||
xmlDevice = ioCompressor.data();
|
||||
}
|
||||
|
||||
QByteArray protectedStreamKey = CryptoHash::hash(m_protectedStreamKey, CryptoHash::Sha256);
|
||||
|
||||
SymmetricCipher protectedStream(SymmetricCipher::Salsa20, SymmetricCipher::Stream, SymmetricCipher::Decrypt,
|
||||
protectedStreamKey, KeePass2::INNER_STREAM_SALSA20_IV);
|
||||
KeePass2RandomStream randomStream(m_protectedStreamKey);
|
||||
|
||||
QScopedPointer<QBuffer> buffer;
|
||||
|
||||
|
@ -117,7 +115,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||
}
|
||||
|
||||
KeePass2XmlReader xmlReader;
|
||||
xmlReader.readDatabase(xmlDevice, m_db, &protectedStream);
|
||||
xmlReader.readDatabase(xmlDevice, m_db, &randomStream);
|
||||
// TODO forward error messages from xmlReader
|
||||
return m_db;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue