diff options
author | Scott Jackson <daneren2005@gmail.com> | 2020-12-29 20:43:39 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2020-12-29 20:43:39 -0800 |
commit | ee1f43d98d7e2265d9c6154ae094098dc169a21f (patch) | |
tree | 6a2273fd4f088241a32f2e09b09300d5da96314b /app/src/main | |
parent | 76098a0a1219ad3c3f23e43b1fe068e547e9a628 (diff) | |
download | dsub-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/src/main')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/KeyStoreUtil.java | 9 |
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)); |