aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/KeyStoreUtil.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/KeyStoreUtil.java b/app/src/main/java/github/daneren2005/dsub/util/KeyStoreUtil.java
index 057ac833..8ff9ec69 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/KeyStoreUtil.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/KeyStoreUtil.java
@@ -97,9 +97,14 @@ public class KeyStoreUtil {
outputStream.write(cipher.doFinal(plainTextString.getBytes(KEYSTORE_BYTE_ENCODING)));
// Encode the return full stream for storage
- Log.d(TAG, "Password encryption successful");
- return Base64.encodeToString(outputStream.toByteArray(), Base64.NO_WRAP);
+ String encryptedPassword = Base64.encodeToString(outputStream.toByteArray(), Base64.NO_WRAP);
+ if(decrypt((encryptedPassword)) == null) {
+ Log.e(TAG, "We couldn't decrypt the password we just encypted!");
+ return null;
+ }
+ Log.d(TAG, "Password encryption successful");
+ return encryptedPassword;
} catch (Exception e) {
Log.w(TAG, "Password encryption failed");
Log.d(TAG, Log.getStackTraceString(e));