Skip to content

Commit f50629f

Browse files
authored
check for encoded pw (#280)
1 parent cb12d64 commit f50629f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/src/main/java/com/m2049r/xmrwallet/util/KeyStoreHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ public static String getCrazyPass(Context context, String password) {
7070
try {
7171
KeyStoreHelper.createKeys(context, RSA_ALIAS);
7272
sig = KeyStoreHelper.signData(RSA_ALIAS, data);
73+
return CrazyPassEncoder.encode(cnSlowHash(sig));
7374
} catch (NoSuchProviderException | NoSuchAlgorithmException |
7475
InvalidAlgorithmParameterException | KeyStoreException |
7576
InvalidKeyException | SignatureException ex) {
7677
throw new IllegalStateException(ex);
7778
}
78-
return CrazyPassEncoder.encode(cnSlowHash(sig));
7979
}
8080

8181
public static boolean saveWalletUserPass(@NonNull Context context, String wallet, String password) {
@@ -110,6 +110,7 @@ public static String loadWalletUserPass(@NonNull Context context, String wallet)
110110
String walletKeyAlias = SecurityConstants.WALLET_PASS_KEY_PREFIX + wallet;
111111
String encoded = context.getSharedPreferences(SecurityConstants.WALLET_PASS_PREFS_NAME, Context.MODE_PRIVATE)
112112
.getString(wallet, "");
113+
if (encoded.isEmpty()) throw new BrokenPasswordStoreException();
113114
byte[] data = Base64.decode(encoded, Base64.DEFAULT);
114115
byte[] decrypted = KeyStoreHelper.decrypt(walletKeyAlias, data);
115116
if (decrypted == null) throw new BrokenPasswordStoreException();

0 commit comments

Comments
 (0)