wownero
/
wownerujo
Archived
4
0
Fork 0

check for encoded pw (#280)

upstream
m2049r 6 years ago committed by GitHub
parent cb12d64e5f
commit f50629ff81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -70,12 +70,12 @@ public class KeyStoreHelper {
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) {
@ -110,6 +110,7 @@ public class KeyStoreHelper {
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();