mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Fix algorithm and kdf function for database V3 and add small trad
This commit is contained in:
1 parent
7bcc289518
commit
92eeccf84e
4 files changed
+15
-4
No files matched your search
@@ -360,11 +360,14 @@ public class Database {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean allowEncryptionAlgorithmModification() {
|
||||
return getAvailableEncryptionAlgorithms().size() > 1;
|
||||
}
|
||||
|
||||
public void assignEncryptionAlgorithm(PwEncryptionAlgorithm algorithm) {
|
||||
switch (getPwDatabase().getVersion()) {
|
||||
case V4:
|
||||
((PwDatabaseV4) getPwDatabase()).setEncryptionAlgorithm(algorithm);
|
||||
// TODO Simplify
|
||||
((PwDatabaseV4) getPwDatabase()).setDataEngine(algorithm.getCipherEngine());
|
||||
((PwDatabaseV4) getPwDatabase()).setDataCipher(algorithm.getDataCipher());
|
||||
}
|
||||
@@ -384,6 +387,10 @@ public class Database {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean allowKdfModification() {
|
||||
return getAvailableKdfEngines().size() > 1;
|
||||
}
|
||||
|
||||
public KdfEngine getKdfEngine() {
|
||||
return getPwDatabase().getKdfEngine();
|
||||
}
|
||||
|
||||
+2
-1
@@ -66,7 +66,8 @@ public class DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat extends D
|
||||
|
||||
@Override
|
||||
public void onDialogClosed(boolean positiveResult) {
|
||||
if ( positiveResult ) {
|
||||
if ( positiveResult
|
||||
&& database.allowEncryptionAlgorithmModification()) {
|
||||
assert getContext() != null;
|
||||
|
||||
if (algorithmSelected != null) {
|
||||
|
||||
+2
-1
@@ -70,7 +70,8 @@ public class DatabaseKeyDerivationPreferenceDialogFragmentCompat extends Databas
|
||||
|
||||
@Override
|
||||
public void onDialogClosed(boolean positiveResult) {
|
||||
if ( positiveResult ) {
|
||||
if ( positiveResult
|
||||
&& database.allowKdfModification()) {
|
||||
assert getContext() != null;
|
||||
|
||||
if (kdfEngineSelected != null) {
|
||||
|
||||
Reference in new issue
Block a user