aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2020-12-29 20:43:39 -0800
committerScott Jackson <daneren2005@gmail.com>2020-12-29 20:43:39 -0800
commitee1f43d98d7e2265d9c6154ae094098dc169a21f (patch)
tree6a2273fd4f088241a32f2e09b09300d5da96314b /app
parent76098a0a1219ad3c3f23e43b1fe068e547e9a628 (diff)
downloaddsub-ee1f43d98d7e2265d9c6154ae094098dc169a21f.tar.gz
dsub-ee1f43d98d7e2265d9c6154ae094098dc169a21f.tar.bz2
dsub-ee1f43d98d7e2265d9c6154ae094098dc169a21f.zip
#1033: Some devices can't decrypt a password they just made
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));