Fix getMasterKey for V3

This commit is contained in:
J-Jamet
2018-03-10 13:15:42 +01:00
parent 19ebc40bdb
commit 30c5db92e6

View File

@@ -221,18 +221,16 @@ public class PwDatabaseV3 extends PwDatabase {
public byte[] getMasterKey(String key, InputStream keyInputStream) public byte[] getMasterKey(String key, InputStream keyInputStream)
throws InvalidKeyFileException, IOException { throws InvalidKeyFileException, IOException {
assert (key != null);
if (key.length() > 0 && keyInputStream != null) { if (key != null && key.length() > 0 && keyInputStream != null) {
return getCompositeKey(key, keyInputStream); return getCompositeKey(key, keyInputStream);
} else if (key.length() > 0) { } else if (key != null && key.length() > 0) {
return getPasswordKey(key); return getPasswordKey(key);
} else if (keyInputStream != null) { } else if (keyInputStream != null) {
return getFileKey(keyInputStream); return getFileKey(keyInputStream);
} else { } else {
throw new IllegalArgumentException("Key cannot be empty."); throw new IllegalArgumentException("Key cannot be empty.");
} }
} }
@Override @Override