Creation of classes and prepare assignment for algorithms

This commit is contained in:
J-Jamet committed 2018-04-26 22:00:11 +02:00
1 parent 9af182e0c3
commit d6fc29ec79
16 files changed
+425 -25

No files matched your search

@@ -27,6 +27,7 @@ import android.preference.PreferenceManager;
import android.util.Log;
import com.kunzisoft.keepass.R;
import com.kunzisoft.keepass.crypto.engine.CipherEngine;
import com.kunzisoft.keepass.database.exception.ContentFileNotFoundException;
import com.kunzisoft.keepass.database.exception.InvalidDBException;
import com.kunzisoft.keepass.database.exception.InvalidPasswordException;
@@ -348,6 +349,20 @@ public class Database {
}
}
public PwEncryptionAlgorithm getEncryptionAlgorithm() {
return getPwDatabase().getEncryptionAlgorithm();
}
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());
}
}
public String getEncryptionAlgorithmName(Resources resources) {
return getPwDatabase().getEncryptionAlgorithm().getName(resources);
}