Fix algorithm and kdf function for database V3 and add small trad

This commit is contained in:
J-Jamet
2018-05-13 13:55:37 +02:00
parent 7bcc289518
commit 92eeccf84e
4 changed files with 15 additions and 4 deletions

View File

@@ -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();
}

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -27,7 +27,9 @@
<string name="add_entry">Ajouter une entrée</string>
<string name="add_group">Ajouter un groupe</string>
<string name="add_string">Ajouter une chaîne</string>
<string name="encryption_algorithm">Algorithme</string>
<string name="encryption">Chiffrement</string>
<string name="encryption_algorithm">Algorithme de Chiffrement</string>
<string name="key_derivation_function">Fonction de dérivation de clé</string>
<string name="app_timeout">Application timeout</string>
<string name="app_timeout_summary">Temps avant le verrouillage de la base de données lorsque l\'application est inactive.</string>
<string name="application">Application</string>