aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-09-13 21:18:26 +0200
committerChristian Schneppe <christian@pix-art.de>2019-09-13 21:18:26 +0200
commit1b45c333933f9e847439adfa6220ee4cb88ea7b9 (patch)
tree0ed387b7b24edb66e3db3a97d21a266564dda48d
parentb37741a0aed3062e5dceb099b7912f6304271ba8 (diff)
catch empty password exceptions in ExportBackupService
-rw-r--r--src/main/java/de/pixart/messenger/services/ExportBackupService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ExportBackupService.java b/src/main/java/de/pixart/messenger/services/ExportBackupService.java
index 8d4cd4f2d..96ec4c6cd 100644
--- a/src/main/java/de/pixart/messenger/services/ExportBackupService.java
+++ b/src/main/java/de/pixart/messenger/services/ExportBackupService.java
@@ -257,7 +257,7 @@ public class ExportBackupService extends Service {
List<File> files;
try {
files = export();
- success = true;
+ success = files != null;
} catch (Exception e) {
success = false;
files = Collections.emptyList();
@@ -325,6 +325,10 @@ public class ExportBackupService extends Service {
final SecureRandom secureRandom = new SecureRandom();
final List<File> files = new ArrayList<>();
for (Account account : this.mAccounts) {
+ final String password = account.getPassword();
+ if (password.isEmpty() || password.equals("")) {
+ return null;
+ }
final byte[] IV = new byte[12];
final byte[] salt = new byte[16];
secureRandom.nextBytes(IV);
@@ -342,7 +346,7 @@ public class ExportBackupService extends Service {
dataOutputStream.flush();
final Cipher cipher = Compatibility.twentyEight() ? Cipher.getInstance(CIPHERMODE) : Cipher.getInstance(CIPHERMODE, PROVIDER);
- byte[] key = getKey(account.getPassword(), salt);
+ byte[] key = getKey(password, salt);
Log.d(Config.LOGTAG, backupFileHeader.toString());
SecretKeySpec keySpec = new SecretKeySpec(key, KEYTYPE);
IvParameterSpec ivSpec = new IvParameterSpec(IV);