Dynamic creation of KdfEngine, reorganise code

This commit is contained in:
J-Jamet committed 2018-05-09 15:17:55 +02:00
1 parent c72aa0e97d
commit fea7af6910
16 files changed
+148 -270

No files matched your search

@@ -45,12 +45,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
package com.kunzisoft.keepass.database;
import android.content.res.Resources;
import com.kunzisoft.keepass.crypto.finalkey.FinalKey;
import com.kunzisoft.keepass.crypto.finalkey.FinalKeyFactory;
import com.kunzisoft.keepass.crypto.keyDerivation.AesKdf;
import com.kunzisoft.keepass.crypto.keyDerivation.KdfEngine;
import com.kunzisoft.keepass.crypto.keyDerivation.KdfFactory;
import com.kunzisoft.keepass.database.exception.InvalidKeyFileException;
import com.kunzisoft.keepass.stream.NullOutputStream;
@@ -71,7 +69,6 @@ import java.util.Random;
public class PwDatabaseV3 extends PwDatabase<PwGroupV3, PwEntryV3> {
private static final int DEFAULT_ENCRYPTION_ROUNDS = 300;
private KdfEngine kdfEngine = new AesKdf(); // Always the same
// all entries
private List<PwEntryV3> entries = new ArrayList<>();
@@ -107,19 +104,7 @@ public class PwDatabaseV3 extends PwDatabase<PwGroupV3, PwEntryV3> {
@Override
public KdfEngine getKdfEngine() {
return kdfEngine;
}
@Override
public List<KdfEngine> getAvailableKdfEngines() {
List<KdfEngine> list = new ArrayList<>();
list.add(kdfEngine);
return list;
}
@Override
public String getKeyDerivationName(Resources resources) {
return kdfEngine.getName(resources);
return KdfFactory.aesKdf;
}
@Override
@@ -346,7 +331,6 @@ public class PwDatabaseV3 extends PwDatabase<PwGroupV3, PwEntryV3> {
// Add tree to root groups
groups.add(newGroup);
}
@Override