Read buffer helper

This commit is contained in:
M66B
2020-09-16 20:30:40 +02:00
parent 1c0101b43e
commit 571ed13f0b
2 changed files with 12 additions and 4 deletions

View File

@@ -717,10 +717,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
else {
byte[] salt = new byte[16];
byte[] prefix = new byte[16];
if (raw.read(salt) != salt.length)
throw new IOException("Invalid file size");
if (raw.read(prefix) != prefix.length)
throw new IOException("Invalid file size");
Helper.readBuffer(raw, salt);
Helper.readBuffer(raw, prefix);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt, KEY_ITERATIONS, KEY_LENGTH);