@OnClick(R.id.button_execute_password_test) void onExecutePasswordTest() { if (wallet.isEncrypted()) { showUnlockDialog(); } else { DialogBuilder.warn(getActivity(), R.string.wallet_is_not_locked_message) .setPositiveButton(R.string.button_ok, null) .create().show(); } }
private void createToAccountAndProceed() { if (destinationType == null) { Toast.makeText(getActivity(), R.string.error_generic, Toast.LENGTH_SHORT).show(); return; } ConfirmAddCoinUnlockWalletDialog.getInstance(destinationType, wallet.isEncrypted()) .show(getFragmentManager(), ADD_COIN_DIALOG_TAG); }
@Override protected Void doInBackground(Void... params) { KeyParameter key = null; exception = null; try { if (wallet.isEncrypted() && wallet.getKeyCrypter() != null) { key = wallet.getKeyCrypter().deriveKey(password); } newAccount = wallet.createAccount(type, true, key); if (description != null && !description.trim().isEmpty()) { newAccount.setDescription(description); } wallet.saveNow(); } catch (Exception e) { exception = e; } return null; }
/* package */ void decrypt(KeyParameter aesKey) { checkNotNull(aesKey, "Attemting to decrypt with a null KeyParameter"); lock.lock(); try { checkState(isEncrypted(), "Wallet is already decrypted"); if (seed != null) { checkState(seed.isEncrypted(), "Seed is already decrypted"); List<String> mnemonic = null; try { mnemonic = decodeMnemonicCode(getKeyCrypter().decrypt(seed.getEncryptedData(), aesKey)); } catch (UnreadableWalletException e) { throw new RuntimeException(e); } seed = new DeterministicSeed(new byte[16], mnemonic, 0); } masterKey = masterKey.decrypt(getKeyCrypter(), aesKey); for (WalletAccount account : accounts.values()) { if (account.isEncryptable()) { account.decrypt(aesKey); } } } finally { lock.unlock(); } }
private void showAddCoinDialog() { Dialogs.dismissAllowingStateLoss(getFM(), ADD_COIN_DIALOG_TAG); ConfirmAddCoinUnlockWalletDialog.getInstance(selectedCoin, wallet.isEncrypted()) .show(getFM(), ADD_COIN_DIALOG_TAG); }
if (isEncrypted()) { hierarchy = new DeterministicHierarchy(masterKey.decrypt(getKeyCrypter(), key)); } else { if (isEncrypted() && !newPocket.isEncrypted()) { newPocket.encrypt(getKeyCrypter(), key);
try { if (sourceAccount != null) { if (wallet.isEncrypted()) { KeyCrypter crypter = checkNotNull(wallet.getKeyCrypter()); request.aesKey = crypter.deriveKey(password);