Java Code Examples for net.bither.bitherj.crypto.SecureCharSequence#equals()
The following examples show how to use
net.bither.bitherj.crypto.SecureCharSequence#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogPasswordWithOther.java From bither-android with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { SecureCharSequence password = new SecureCharSequence(etPassword.getText()); SecureCharSequence passwordConfirm = new SecureCharSequence(etPasswordConfirm.getText()); if (passwordSeed == null && !password.equals(passwordConfirm) && checkPre) { password.wipe(); passwordConfirm.wipe(); tvError.setText(R.string.add_address_generate_address_password_not_same); tvError.setVisibility(View.VISIBLE); etPasswordConfirm.requestFocus(); return; } password.wipe(); passwordConfirm.wipe(); if ((passwordSeed != null && checkPre) || checkPasswordListener != null) { ArrayList<Check> checks = new ArrayList<Check>(); checks.add(passwordCheck); executor = CheckUtil.runChecks(checks, 1); } else { passwordEntered = true; dismiss(); } }
Example 2
Source File: PrivateKeyUtil.java From bitherj with Apache License 2.0 | 6 votes |
public static String getBIP38PrivateKeyString(Address address, CharSequence password) throws AddressFormatException, InterruptedException { SecureCharSequence decrypted = getDecryptPrivateKeyString(address.getFullEncryptPrivKey() , password); String bip38 = Bip38.encryptNoEcMultiply(password, decrypted.toString()); if (BitherjSettings.DEV_DEBUG) { SecureCharSequence d = Bip38.decrypt(bip38, password); if (d.equals(decrypted)) { log.info("BIP38 right"); } else { throw new RuntimeException("BIP38 wrong " + d.toString() + " , " + "" + decrypted.toString()); } } decrypted.wipe(); return bip38; }
Example 3
Source File: DialogEditPassword.java From bither-android with Apache License 2.0 | 4 votes |
@Override public void onClick(View v) { if (v.getId() == R.id.btn_ok) { SecureCharSequence oldP = new SecureCharSequence(etOldPassword.getText()); SecureCharSequence newP = new SecureCharSequence(etNewPassword.getText()); SecureCharSequence newCP = new SecureCharSequence(etNewPasswordConfirm.getText()); if (!newP.equals(newCP)) { shake(); tvError.setText(R.string.add_address_generate_address_password_not_same); tvError.setVisibility(View.VISIBLE); etNewPasswordConfirm.requestFocus(); oldP.wipe(); newP.wipe(); newCP.wipe(); return; } if (oldP.equals(newP)) { shake(); tvError.setText(R.string.edit_password_new_old_same); tvError.setVisibility(View.VISIBLE); etNewPasswordConfirm.requestFocus(); oldP.wipe(); newP.wipe(); newCP.wipe(); return; } if (AppSharedPreference.getInstance().getPasswordStrengthCheck()) { PasswordStrengthUtil.PasswordStrength strength = PasswordStrengthUtil .checkPassword(newP); oldP.wipe(); newP.wipe(); newCP.wipe(); if (!strength.passed()) { etNewPassword.requestFocus(); shakeStrength(); return; } if (strength.warning()) { new DialogConfirmTask(getContext(), String.format(getContext().getString(R .string.password_strength_warning), strength.getName()), new Runnable () { @Override public void run() { executor = CheckUtil.runChecks(Arrays.asList(new Check[]{passwordCheck}), 1); } }).show(); return; } } oldP.wipe(); newP.wipe(); newCP.wipe(); if (passwordSeed != null) { ArrayList<Check> checks = new ArrayList<Check>(); checks.add(passwordCheck); executor = CheckUtil.runChecks(checks, 1); } else { dismiss(); } } else { dismiss(); } }
Example 4
Source File: DialogPassword.java From bither-android with Apache License 2.0 | 4 votes |
@Override public void onClick(View v) { SecureCharSequence password = new SecureCharSequence(etPassword.getText()); SecureCharSequence passwordConfirm = new SecureCharSequence(etPasswordConfirm.getText()); if (passwordSeed == null && checkPre) { if (!password.equals(passwordConfirm)) { password.wipe(); passwordConfirm.wipe(); tvError.setText(R.string.add_address_generate_address_password_not_same); tvError.setVisibility(View.VISIBLE); etPasswordConfirm.requestFocus(); return; } else if (AppSharedPreference.getInstance().getPasswordStrengthCheck()) { PasswordStrengthUtil.PasswordStrength strength = PasswordStrengthUtil .checkPassword(password); password.wipe(); passwordConfirm.wipe(); if (!strength.passed()) { etPassword.requestFocus(); shakeStrength(); return; } if (strength.warning()) { new DialogConfirmTask(getContext(), String.format(getContext().getString (R.string.password_strength_warning), strength.getName()), new Runnable() { @Override public void run() { ThreadUtil.runOnMainThread(new Runnable() { @Override public void run() { passwordEntered = true; dismiss(); } }); } }).show(); return; } } } password.wipe(); passwordConfirm.wipe(); if ((passwordSeed != null && checkPre) || checkPasswordListener != null) { ArrayList<Check> checks = new ArrayList<Check>(); checks.add(passwordCheck); executor = CheckUtil.runChecks(checks, 1); } else { passwordEntered = true; dismiss(); } }