From 44ca3c02c59eef0c2d2d60f4d8eb64cfb987c75a Mon Sep 17 00:00:00 2001 From: Joshua Soberg Date: Fri, 29 Jan 2021 18:23:43 -0500 Subject: [PATCH] Move method to be in expected call order --- .../andotp/Tasks/AuthenticationTask.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Tasks/AuthenticationTask.java b/app/src/main/java/org/shadowice/flocke/andotp/Tasks/AuthenticationTask.java index e156edc0..e06e6454 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Tasks/AuthenticationTask.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Tasks/AuthenticationTask.java @@ -49,22 +49,6 @@ public class AuthenticationTask extends AsyncTask { } } - @NonNull - private Result confirmAuthentication() { - try { - PBKDF2Credentials credentials = EncryptionHelper.generatePBKDF2Credentials(plainPassword, settings.getSalt(), settings.getIterations()); - byte[] passwordArray = Base64.decode(existingAuthCredentials, Base64.URL_SAFE); - - if (Arrays.equals(passwordArray, credentials.password)) { - return Result.success(credentials.key); - } - return Result.failure(); - } catch (NoSuchAlgorithmException | InvalidKeySpecException | IllegalArgumentException e) { - Log.e("DecodePasswordTask", "Problem decoding password", e); - return Result.failure(); - } - } - @NonNull private Result upgradeAuthentication() { String hashedPassword = new String(Hex.encodeHex(DigestUtils.sha256(plainPassword))); @@ -85,6 +69,22 @@ public class AuthenticationTask extends AsyncTask { return Result.success(key); } + @NonNull + private Result confirmAuthentication() { + try { + PBKDF2Credentials credentials = EncryptionHelper.generatePBKDF2Credentials(plainPassword, settings.getSalt(), settings.getIterations()); + byte[] passwordArray = Base64.decode(existingAuthCredentials, Base64.URL_SAFE); + + if (Arrays.equals(passwordArray, credentials.password)) { + return Result.success(credentials.key); + } + return Result.failure(); + } catch (NoSuchAlgorithmException | InvalidKeySpecException | IllegalArgumentException e) { + Log.e("DecodePasswordTask", "Problem decoding password", e); + return Result.failure(); + } + } + @Override protected void onPostExecute(Result result) { callback.onComplete(result);