Skip to content

Commit

Permalink
check for encoded pw (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2049r authored May 10, 2018
1 parent cb12d64 commit f50629f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public static String getCrazyPass(Context context, String password) {
try {
KeyStoreHelper.createKeys(context, RSA_ALIAS);
sig = KeyStoreHelper.signData(RSA_ALIAS, data);
return CrazyPassEncoder.encode(cnSlowHash(sig));
} catch (NoSuchProviderException | NoSuchAlgorithmException |
InvalidAlgorithmParameterException | KeyStoreException |
InvalidKeyException | SignatureException ex) {
throw new IllegalStateException(ex);
}
return CrazyPassEncoder.encode(cnSlowHash(sig));
}

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

0 comments on commit f50629f

Please sign in to comment.