diff --git a/.idea/misc.xml b/.idea/misc.xml index 53a3fb16..635999df 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -24,7 +24,7 @@ - + diff --git a/app/src/main/java/me/impy/aegis/crypto/CryptoUtils.java b/app/src/main/java/me/impy/aegis/crypto/CryptoUtils.java index 5bbc9260..37eb361e 100644 --- a/app/src/main/java/me/impy/aegis/crypto/CryptoUtils.java +++ b/app/src/main/java/me/impy/aegis/crypto/CryptoUtils.java @@ -39,8 +39,7 @@ public class CryptoUtils { public static final int CRYPTO_SCRYPT_r = 8; public static final int CRYPTO_SCRYPT_p = 1; - public static SecretKey deriveKey(char[] password, byte[] salt, int n, int r, int p) - throws NoSuchAlgorithmException, InvalidKeySpecException { + public static SecretKey deriveKey(char[] password, byte[] salt, int n, int r, int p) { byte[] bytes = toBytes(password); byte[] keyBytes = SCrypt.generate(bytes, salt, n, r, p, CRYPTO_KEY_SIZE); return new SecretKeySpec(keyBytes, 0, keyBytes.length, "AES"); diff --git a/app/src/main/java/me/impy/aegis/db/slots/PasswordSlot.java b/app/src/main/java/me/impy/aegis/db/slots/PasswordSlot.java index f193a74d..c3a67941 100644 --- a/app/src/main/java/me/impy/aegis/db/slots/PasswordSlot.java +++ b/app/src/main/java/me/impy/aegis/db/slots/PasswordSlot.java @@ -49,25 +49,17 @@ public class PasswordSlot extends RawSlot { } } - public SecretKey deriveKey(char[] password, byte[] salt, int n, int r, int p) throws SlotException { - try { - SecretKey key = CryptoUtils.deriveKey(password, salt, n, r, p); - _n = n; - _r = r; - _p = p; - _salt = salt; - return key; - } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { - throw new SlotException(e); - } + public SecretKey deriveKey(char[] password, byte[] salt, int n, int r, int p) { + SecretKey key = CryptoUtils.deriveKey(password, salt, n, r, p); + _n = n; + _r = r; + _p = p; + _salt = salt; + return key; } - public SecretKey deriveKey(char[] password) throws SlotException { - try { - return CryptoUtils.deriveKey(password, _salt, _n, _r, _p); - } catch (InvalidKeySpecException | NoSuchAlgorithmException e) { - throw new SlotException(e); - } + public SecretKey deriveKey(char[] password) { + return CryptoUtils.deriveKey(password, _salt, _n, _r, _p); } @Override diff --git a/app/src/main/java/me/impy/aegis/ui/PreferencesActivity.java b/app/src/main/java/me/impy/aegis/ui/PreferencesActivity.java index 59e2b0b5..7b2d9cf5 100644 --- a/app/src/main/java/me/impy/aegis/ui/PreferencesActivity.java +++ b/app/src/main/java/me/impy/aegis/ui/PreferencesActivity.java @@ -26,7 +26,7 @@ public class PreferencesActivity extends AegisActivity implements PasswordDialog } @Override - protected final void onRestoreInstanceState(final Bundle inState) { + protected void onRestoreInstanceState(final Bundle inState) { // pass the stored result intent back to the fragment if (inState.containsKey("result")) { _fragment.setResult(inState.getParcelable("result")); @@ -35,7 +35,7 @@ public class PreferencesActivity extends AegisActivity implements PasswordDialog } @Override - protected final void onSaveInstanceState(final Bundle outState) { + protected void onSaveInstanceState(final Bundle outState) { // save the result intent of the fragment // this is done so we don't lose anything if the fragment calls recreate on this activity outState.putParcelable("result", _fragment.getResult()); diff --git a/app/src/main/java/me/impy/aegis/ui/tasks/DerivationTask.java b/app/src/main/java/me/impy/aegis/ui/tasks/DerivationTask.java index 3e25dfe4..7b7600a7 100644 --- a/app/src/main/java/me/impy/aegis/ui/tasks/DerivationTask.java +++ b/app/src/main/java/me/impy/aegis/ui/tasks/DerivationTask.java @@ -21,12 +21,8 @@ public class DerivationTask extends ProgressDialogTask