mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Pick the right root node to parse.
This commit is contained in:
@@ -93,7 +93,7 @@ public class PwDatabaseV4 extends PwDatabase {
|
|||||||
throw new InconsistentDBException("Missing root node");
|
throw new InconsistentDBException("Missing root node");
|
||||||
}
|
}
|
||||||
|
|
||||||
Node root = list.item(1);
|
Node root = list.item(0);
|
||||||
|
|
||||||
rootGroup = new PwGroupV4(root);
|
rootGroup = new PwGroupV4(root);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,14 +67,11 @@ public class ImporterV4 extends Importer {
|
|||||||
InvalidKeyFileException, InvalidPasswordException,
|
InvalidKeyFileException, InvalidPasswordException,
|
||||||
InvalidDBSignatureException, InvalidDBVersionException {
|
InvalidDBSignatureException, InvalidDBVersionException {
|
||||||
|
|
||||||
// TODO: Measure whether this buffer is better or worse for performance
|
|
||||||
BufferedInputStream bis = new BufferedInputStream(inStream);
|
|
||||||
|
|
||||||
PwDatabaseV4 db = new PwDatabaseV4();
|
PwDatabaseV4 db = new PwDatabaseV4();
|
||||||
|
|
||||||
PwDbHeaderV4 header = new PwDbHeaderV4(db);
|
PwDbHeaderV4 header = new PwDbHeaderV4(db);
|
||||||
|
|
||||||
header.loadFromFile(bis);
|
header.loadFromFile(inStream);
|
||||||
|
|
||||||
db.setMasterKey(password, keyfile);
|
db.setMasterKey(password, keyfile);
|
||||||
db.makeFinalKey(header.masterSeed, header.transformSeed, (int)db.numKeyEncRounds);
|
db.makeFinalKey(header.masterSeed, header.transformSeed, (int)db.numKeyEncRounds);
|
||||||
@@ -93,7 +90,7 @@ public class ImporterV4 extends Importer {
|
|||||||
throw new IOException("Invalid algorithm.");
|
throw new IOException("Invalid algorithm.");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream decrypted = new BetterCipherInputStream(bis, cipher, 50 * 1024);
|
InputStream decrypted = new BetterCipherInputStream(inStream, cipher, 50 * 1024);
|
||||||
LEDataInputStream dataDecrypted = new LEDataInputStream(decrypted);
|
LEDataInputStream dataDecrypted = new LEDataInputStream(decrypted);
|
||||||
byte[] storedStartBytes = dataDecrypted.readBytes(32);
|
byte[] storedStartBytes = dataDecrypted.readBytes(32);
|
||||||
if ( storedStartBytes == null || storedStartBytes.length != 32 ) {
|
if ( storedStartBytes == null || storedStartBytes.length != 32 ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user