Skip to content

Commit

Permalink
Fix KDBX3 -> 4 upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
bpellin committed Jun 9, 2021
1 parent fd574d2 commit 69cbca7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Fix KDBX3 -> 4 upgrade

KeePassDroid (2.5.16.1)
* Fix minimum db version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class KdfParameters extends VariantDictionary {

public KdfParameters(UUID uuid) {
kdfUUID = uuid;
this.setByteArray(ParamUUID, Types.UUIDtoBytes(uuid));
}

public static KdfParameters deserialize(byte[] data) throws IOException {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/keepassdroid/database/PwDbHeaderV4.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public HeaderAndHash (byte[] header, byte[] hash) {
public long version;

public PwDbHeaderV4(PwDatabaseV4 d) {
db = d;
version = d.getMinKdbxVersion();
masterSeed = new byte[32];
db = d;
version = 0;
masterSeed = new byte[32];
}

/** Assumes the input stream is at the beginning of the .kdbx file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ protected SecureRandom setIVs(PwDbHeader header) throws PwDbOutputException {
@Override
public PwDbHeader outputHeader(OutputStream os) throws PwDbOutputException {
PwDbHeaderV4 header = new PwDbHeaderV4(mPM);
header.version = mPM.getMinKdbxVersion();
setIVs(header);

PwDbHeaderOutputV4 pho = new PwDbHeaderOutputV4(mPM, header, os);
Expand Down

0 comments on commit 69cbca7

Please sign in to comment.