net.bither.bitherj.crypto.PasswordSeed Java Examples

The following examples show how to use net.bither.bitherj.crypto.PasswordSeed. 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: HotAdvanceActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
/**
 * end
 */

private void callPassword() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (PasswordSeed.hasPasswordSeed()) {
                DialogPassword dialogPassword = new DialogPassword(HotAdvanceActivity.this,
                        new IDialogPasswordListener() {
                            @Override
                            public void onPasswordEntered(SecureCharSequence password) {
                                AddressManager addressManager = AddressManager.getInstance();
                                if (addressManager.hasHDAccountHot()) {
                                    addressManager.getHDAccountHot().addSegwitPub(password);
                                }
                                resetTx();
                            }
                        });
                dialogPassword.show();
            } else {
                resetTx();
            }
        }
    });
}
 
Example #2
Source File: AddressProvider.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
@Override
public void addAddress(final Address address) {
    try {

        this.mDb.getConn().setAutoCommit(false);
        String[] params = new String[]{address.getAddress(), address.hasPrivKey() ? address.getEncryptPrivKeyOfDb() : null, Base58.encode(address.getPubKey()),
                Integer.toString(address.isFromXRandom() ? 1 : 0), Integer.toString(address.isSyncComplete() ? 1 : 0), Integer.toString(address.isTrashed() ? 1 : 0), Long.toString(address.getSortTime())};
        PreparedStatement stmt = this.mDb.getConn().prepareStatement(insertAddressSql);
        if (params != null) {
            for (int i = 0; i < params.length; i++) {
                stmt.setString(i + 1, params[i]);
            }
        }
        stmt.executeUpdate();
        if (address.hasPrivKey()) {
            if (!hasPasswordSeed(this.mDb.getConn())) {
                PasswordSeed passwordSeed = new PasswordSeed(address.getAddress(), address.getFullEncryptPrivKeyOfDb());
                addPasswordSeed(this.mDb.getConn(), passwordSeed);
            }
        }
        this.mDb.getConn().commit();
        stmt.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
Example #3
Source File: AdvancePanel.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private void callPassword() {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (PasswordSeed.hasPasswordSeed()) {
                closePanel();
                PasswordPanel dialogPassword = new PasswordPanel(new IDialogPasswordListener() {
                    @Override
                    public void onPasswordEntered(SecureCharSequence password) {
                        resetTx();

                    }
                });
                dialogPassword.showPanel();

            } else {
                resetTx();
            }
        }
    });
}
 
Example #4
Source File: AdvancePanel.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private void callPassword() {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (PasswordSeed.hasPasswordSeed()) {
                closePanel();
                PasswordPanel dialogPassword = new PasswordPanel(new IDialogPasswordListener() {
                    @Override
                    public void onPasswordEntered(SecureCharSequence password) {
                        resetTx();

                    }
                });
                dialogPassword.showPanel();

            } else {
                resetTx();
            }
        }
    });
}
 
Example #5
Source File: AddressProvider.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
@Override
public void addAddress(final Address address) {
    try {

        this.mDb.getConn().setAutoCommit(false);
        String[] params = new String[]{address.getAddress(), address.hasPrivKey() ? address.getEncryptPrivKeyOfDb() : null, Base58.encode(address.getPubKey()),
                Integer.toString(address.isFromXRandom() ? 1 : 0), Integer.toString(address.isSyncComplete() ? 1 : 0), Integer.toString(address.isTrashed() ? 1 : 0), Long.toString(address.getSortTime())};
        PreparedStatement stmt = this.mDb.getConn().prepareStatement(insertAddressSql);
        if (params != null) {
            for (int i = 0; i < params.length; i++) {
                stmt.setString(i + 1, params[i]);
            }
        }
        stmt.executeUpdate();
        if (address.hasPrivKey()) {
            if (!hasPasswordSeed(this.mDb.getConn())) {
                PasswordSeed passwordSeed = new PasswordSeed(address.getAddress(), address.getFullEncryptPrivKeyOfDb());
                addPasswordSeed(this.mDb.getConn(), passwordSeed);
            }
        }
        this.mDb.getConn().commit();
        stmt.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
Example #6
Source File: CheckUtil.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
public static Check initCheckForPrivateKey(
        final Address address, final SecureCharSequence password) {
    String title = String.format(LocaliserUtils.getString("check_address_private_key_title"), address
            .getShortAddress());
    Check check = new Check(title, new ICheckAction() {

        @Override
        public boolean check() {
            boolean result = new PasswordSeed(address.getAddress(), address.getFullEncryptPrivKey()).checkPassword(password);
            if (!result) {
                try {
                    ECKey eckeyFromBackup = BackupUtil.getEckeyFromBackup(
                            address.getAddress(), password);
                    if (eckeyFromBackup != null) {
                        String encryptPrivateKey = PrivateKeyUtil.getEncryptedString(eckeyFromBackup);
                        if (!Utils.isEmpty(encryptPrivateKey)) {
                            address.recoverFromBackup(encryptPrivateKey);
                            result = true;
                        }
                        eckeyFromBackup.clearPrivateKey();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    password.wipe();
                }


            }
            return result;
        }
    });
    return check;
}
 
Example #7
Source File: CheckUtil.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
public static Check initCheckForPrivateKey(
        final Address address, final SecureCharSequence password) {
    String title = String.format(LocaliserUtils.getString("check_address_private_key_title"), address
            .getShortAddress());
    Check check = new Check(title, new ICheckAction() {

        @Override
        public boolean check() {
            boolean result = new PasswordSeed(address.getAddress(), address.getFullEncryptPrivKey()).checkPassword(password);
            if (!result) {
                try {
                    ECKey eckeyFromBackup = BackupUtil.getEckeyFromBackup(
                            address.getAddress(), password);
                    if (eckeyFromBackup != null) {
                        String encryptPrivateKey = PrivateKeyUtil.getEncryptedString(eckeyFromBackup);
                        if (!Utils.isEmpty(encryptPrivateKey)) {
                            address.recoverFromBackup(encryptPrivateKey);
                            result = true;
                        }
                        eckeyFromBackup.clearPrivateKey();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    password.wipe();
                }


            }
            return result;
        }
    });
    return check;
}
 
Example #8
Source File: AbstractAddressProvider.java    From bitherj with Apache License 2.0 5 votes vote down vote up
@Override
public PasswordSeed getPasswordSeed() {
    final PasswordSeed[] passwordSeed = {null};
    String sql = "select password_seed from password_seed limit 1";
    this.execQueryOneRecord(sql, null, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            passwordSeed[0] = applyPasswordSeed(c);
            return null;
        }
    });
    return passwordSeed[0];
}
 
Example #9
Source File: AbstractAddressProvider.java    From bitherj with Apache License 2.0 5 votes vote down vote up
@Override
public int addHDKey(String encryptedMnemonicSeed, String encryptHdSeed, String firstAddress, boolean isXrandom, String addressOfPS) {
    IDb db = this.getWriteDb();
    db.beginTransaction();
    int seedId = this.insertHDKeyToDb(db, encryptedMnemonicSeed, encryptHdSeed, firstAddress, isXrandom);
    if (!hasPasswordSeed(db) && !Utils.isEmpty(addressOfPS)) {
        this.addPasswordSeed(db, new PasswordSeed(addressOfPS, encryptedMnemonicSeed));
    }
    db.endTransaction();
    return seedId;
}
 
Example #10
Source File: AbstractAddressProvider.java    From bitherj with Apache License 2.0 5 votes vote down vote up
@Override
public int addEnterpriseHDKey(String encryptedMnemonicSeed, String encryptHdSeed, String firstAddress, boolean isXrandom, String addressOfPS) {
    IDb writeDb = this.getWriteDb();
    writeDb.beginTransaction();
    int seedId = this.insertEnterpriseHDKeyToDb(writeDb, encryptedMnemonicSeed, encryptHdSeed, firstAddress, isXrandom);
    if (!hasPasswordSeed(writeDb) && !Utils.isEmpty(addressOfPS)) {
        addPasswordSeed(writeDb, new PasswordSeed(addressOfPS, encryptedMnemonicSeed));
    }
    writeDb.endTransaction();
    return seedId;
}
 
Example #11
Source File: AbstractAddressProvider.java    From bitherj with Apache License 2.0 5 votes vote down vote up
@Override
public void addAddress(Address address) {
    IDb writeDb = this.getWriteDb();
    writeDb.beginTransaction();
    this.insertAddressToDb(writeDb, address);
    if (address.hasPrivKey()) {
        if (!hasPasswordSeed(writeDb)) {
            PasswordSeed passwordSeed = new PasswordSeed(address.getAddress(), address.getFullEncryptPrivKeyOfDb());
            addPasswordSeed(writeDb, passwordSeed);
        }
    }
    writeDb.endTransaction();
}
 
Example #12
Source File: AbstractAddressProvider.java    From bitherj with Apache License 2.0 5 votes vote down vote up
public PasswordSeed applyPasswordSeed(ICursor c) {
    int idColumn = c.getColumnIndex(AbstractDb.PasswordSeedColumns.PASSWORD_SEED);
    String passwordSeed = null;
    if (idColumn != -1) {
        passwordSeed = c.getString(idColumn);
    }
    if (Utils.isEmpty(passwordSeed)) {
        return null;
    }
    return new PasswordSeed(passwordSeed);
}
 
Example #13
Source File: AbstractHDAccountProvider.java    From bitherj with Apache License 2.0 5 votes vote down vote up
@Override
    public int addHDAccount(String encryptedMnemonicSeed, String encryptSeed, String firstAddress
            , boolean isXrandom, String addressOfPS, byte[] externalPub
            , byte[] internalPub) {
        if (this.isPubExist(externalPub, internalPub)) {
            return -1;
        }
        IDb writeDb = this.getWriteDb();
        writeDb.beginTransaction();
        int hdAccountId = this.insertHDAccountToDb(writeDb, encryptedMnemonicSeed, encryptSeed
                , firstAddress, isXrandom, externalPub, internalPub);
        if (!this.hasPasswordSeed(writeDb) && !Utils.isEmpty(addressOfPS)) {
            this.addPasswordSeed(writeDb, new PasswordSeed(addressOfPS, encryptedMnemonicSeed));
        }
        writeDb.endTransaction();
        return hdAccountId;

//        SQLiteDatabase db = this.mDb.getWritableDatabase();
//        db.beginTransaction();
//        ContentValues cv = new ContentValues();
//        cv.put(AbstractDb.HDAccountColumns.ENCRYPT_SEED, encryptSeed);
//        cv.put(AbstractDb.HDAccountColumns.ENCRYPT_MNMONIC_SEED, encryptedMnemonicSeed);
//        cv.put(AbstractDb.HDAccountColumns.IS_XRANDOM, isXrandom ? 1 : 0);
//        cv.put(AbstractDb.HDAccountColumns.HD_ADDRESS, firstAddress);
//        cv.put(AbstractDb.HDAccountColumns.EXTERNAL_PUB, Base58.encode(externalPub));
//        cv.put(AbstractDb.HDAccountColumns.INTERNAL_PUB, Base58.encode(internalPub));
//        int seedId = (int) db.insert(AbstractDb.Tables.HD_ACCOUNT, null, cv);
//        if (!AddressProvider.hasPasswordSeed(db) && !Utils.isEmpty(addressOfPS)) {
//            AddressProvider.addPasswordSeed(db, new PasswordSeed(addressOfPS, encryptedMnemonicSeed));
//        }
//        db.setTransactionSuccessful();
//        db.endTransaction();
//        return seedId;
    }
 
Example #14
Source File: HDMKeychain.java    From bitherj with Apache License 2.0 5 votes vote down vote up
public PasswordSeed createPasswordSeed(CharSequence password) {
    if (isInRecovery()) {
        throw new AssertionError("HDM in recovery can not create passwordSeed");
    }
    String encrypted = AbstractDb.addressProvider.getEncryptMnemonicSeed(hdSeedId);
    byte[] priv = new EncryptedData(encrypted).decrypt(password);
    ECKey k = new ECKey(priv, null);
    String address = k.toAddress();
    Utils.wipeBytes(priv);
    k.clearPrivateKey();
    return new PasswordSeed(address, encrypted);
}
 
Example #15
Source File: ImportPrivateKey.java    From bitherj with Apache License 2.0 5 votes vote down vote up
private Address addECKey(ECKey ecKey) {
    String encryptedPrivateString;
    if (importPrivateKeyType == ImportPrivateKeyType.BitherQrcode) {
        encryptedPrivateString = QRCodeUtil.getNewVersionEncryptPrivKey(content);
    } else {
        ecKey = PrivateKeyUtil.encrypt(ecKey, password);
        encryptedPrivateString = PrivateKeyUtil.getEncryptedString(ecKey);
    }
    Address address = new Address(ecKey.toAddress(), ecKey.getPubKey(), encryptedPrivateString
            , false, ecKey.isFromXRandom());
    if (AddressManager.getInstance().getWatchOnlyAddresses().contains(address)) {
        password.wipe();
        importError(CAN_NOT_IMPORT_BITHER_COLD_PRIVATE_KEY);
        return null;
    } else if (AddressManager.getInstance().getPrivKeyAddresses().contains(address)) {
        password.wipe();
        importError(PRIVATE_KEY_ALREADY_EXISTS);
        return null;

    } else {
        if (importPrivateKeyType == ImportPrivateKeyType.BitherQrcode) {
            PasswordSeed passwordSeed = PasswordSeed.getPasswordSeed();
            if (passwordSeed != null && !passwordSeed.checkPassword(password)) {
                password.wipe();
                importError(PASSWORD_IS_DIFFEREND_LOCAL);
                return null;
            }
        } else {
            password.wipe();
        }
        return address;


    }

}
 
Example #16
Source File: AddressProvider.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
@Override
public int addHDKey(final String encryptedMnemonicSeed, final String encryptHdSeed, final String firstAddress, final boolean isXrandom, final String addressOfPS) {
    int result = 0;
    try {
        this.mDb.getConn().setAutoCommit(false);
        String[] params = new String[]{encryptedMnemonicSeed, encryptHdSeed, Integer.toString(isXrandom ? 1 : 0), firstAddress};
        PreparedStatement stmt = this.mDb.getConn().prepareStatement(insertHDSeedSql);
        if (params != null) {
            for (int i = 0; i < params.length; i++) {
                stmt.setString(i + 1, params[i]);
            }
        }
        stmt.executeUpdate();
        stmt.close();
        if (!hasPasswordSeed(this.mDb.getConn()) && !Utils.isEmpty(addressOfPS)) {
            addPasswordSeed(this.mDb.getConn(), new PasswordSeed(addressOfPS, encryptedMnemonicSeed));
        }
        this.mDb.getConn().commit();
        PreparedStatement statement = this.mDb.getPreparedStatement("select hd_seed_id from hd_seeds where encrypt_seed=? and encrypt_hd_seed=? and is_xrandom=? and hdm_address=?"
                , new String[]{encryptedMnemonicSeed, encryptHdSeed, Integer.toString(isXrandom ? 1 : 0), firstAddress});
        ResultSet cursor = statement.executeQuery();

        if (cursor.next()) {
            int idColumn = cursor.findColumn(AbstractDb.HDSeedsColumns.HD_SEED_ID);
            if (idColumn != -1) {
                result = cursor.getInt(idColumn);
            }

        }
        cursor.close();
        statement.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return result;
}
 
Example #17
Source File: AdvancePanel.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
private void reloadTx() {

        if (Bither.canReloadTx()) {
            Runnable confirmRunnable = new Runnable() {
                @Override
                public void run() {
                    Bither.reloadTxTime = System.currentTimeMillis();
                    PasswordSeed passwordSeed = PasswordSeed.getPasswordSeed();
                    if (passwordSeed == null) {
                        resetTx();
                    } else {
                        callPassword();
                    }
                }
            };
            DialogConfirmTask dialogConfirmTask = new DialogConfirmTask(
                    LocaliserUtils.getString("reload_tx_need_too_much_time"), confirmRunnable
            );
            dialogConfirmTask.pack();
            dialogConfirmTask.setVisible(true);
        } else {
            new MessageDialog(LocaliserUtils.getString("tx_cannot_reloding")).showMsg();

        }


    }
 
Example #18
Source File: PasswordPanel.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
@Override
public void initialiseContent(JPanel panel) {

    panel.setLayout(new MigLayout(
            Panels.migXYLayout(),
            "[]", // Column constraints
            "[][]" // Row constraints
    ));


    panel.add(progressPanel, "align center,shrink,wrap");

    panel.add(newPasswordPanel, "wrap");

    if (PasswordSeed.hasPasswordSeed()) {
        labConfirmPassword.setVisible(false);
        repeatNewPassword.setVisible(false);
    }

    passwordCheck.setCheckListener(passwordCheckListener);
    newPassword.addKeyListener(passwordWatcher);
    repeatNewPassword.addKeyListener(passwordWatcher);
    configureCheckPre();
    showCheckPre();


}
 
Example #19
Source File: UserPreference.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
private PasswordSeed getPasswordSeed() {
    String str = getString(PASSWORD_SEED, "");
    if (Utils.isEmpty(str)) {
        return null;
    }
    return new PasswordSeed(str);
}
 
Example #20
Source File: HotAdvanceActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {

    if (BitherApplication.canReloadTx()) {
        final Runnable confirmRunnable = new Runnable() {
            @Override
            public void run() {
                BitherApplication.reloadTxTime = System.currentTimeMillis();
                PasswordSeed passwordSeed = PasswordSeed.getPasswordSeed();
                if (passwordSeed == null) {
                    // TODO: the dialog determine the web type
                    // showSelectedDialog();

                    resetTx();

                } else {
                    callPassword();
                }
            }

        };

        DialogConfirmTask dialogConfirmTask = new DialogConfirmTask(HotAdvanceActivity
                .this, getString(R.string.reload_tx_need_too_much_time), confirmRunnable);
        dialogConfirmTask.show();

    } else {
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,
                R.string.tx_cannot_reloding);
    }


}
 
Example #21
Source File: AddressProvider.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
@Override
public int addHDKey(final String encryptedMnemonicSeed, final String encryptHdSeed, final String firstAddress, final boolean isXrandom, final String addressOfPS) {
    int result = 0;
    try {
        this.mDb.getConn().setAutoCommit(false);
        String[] params = new String[]{encryptedMnemonicSeed, encryptHdSeed, Integer.toString(isXrandom ? 1 : 0), firstAddress};
        PreparedStatement stmt = this.mDb.getConn().prepareStatement(insertHDSeedSql);
        if (params != null) {
            for (int i = 0; i < params.length; i++) {
                stmt.setString(i + 1, params[i]);
            }
        }
        stmt.executeUpdate();
        stmt.close();
        if (!hasPasswordSeed(this.mDb.getConn()) && !Utils.isEmpty(addressOfPS)) {
            addPasswordSeed(this.mDb.getConn(), new PasswordSeed(addressOfPS, encryptedMnemonicSeed));
        }
        this.mDb.getConn().commit();
        PreparedStatement statement = this.mDb.getPreparedStatement("select hd_seed_id from hd_seeds where encrypt_seed=? and encrypt_hd_seed=? and is_xrandom=? and hdm_address=?"
                , new String[]{encryptedMnemonicSeed, encryptHdSeed, Integer.toString(isXrandom ? 1 : 0), firstAddress});
        ResultSet cursor = statement.executeQuery();

        if (cursor.next()) {
            int idColumn = cursor.findColumn(AbstractDb.HDSeedsColumns.HD_SEED_ID);
            if (idColumn != -1) {
                result = cursor.getInt(idColumn);
            }

        }
        cursor.close();
        statement.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return result;
}
 
Example #22
Source File: AdvancePanel.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
private void reloadTx() {

        if (Bither.canReloadTx()) {
            Runnable confirmRunnable = new Runnable() {
                @Override
                public void run() {
                    Bither.reloadTxTime = System.currentTimeMillis();
                    PasswordSeed passwordSeed = PasswordSeed.getPasswordSeed();
                    if (passwordSeed == null) {
                        resetTx();
                    } else {
                        callPassword();
                    }
                }
            };
            DialogConfirmTask dialogConfirmTask = new DialogConfirmTask(
                    LocaliserUtils.getString("reload_tx_need_too_much_time"), confirmRunnable
            );
            dialogConfirmTask.pack();
            dialogConfirmTask.setVisible(true);
        } else {
            new MessageDialog(LocaliserUtils.getString("tx_cannot_reloding")).showMsg();

        }


    }
 
Example #23
Source File: PasswordPanel.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
@Override
public void initialiseContent(JPanel panel) {

    panel.setLayout(new MigLayout(
            Panels.migXYLayout(),
            "[]", // Column constraints
            "[][]" // Row constraints
    ));


    panel.add(progressPanel, "align center,shrink,wrap");

    panel.add(newPasswordPanel, "wrap");

    if (PasswordSeed.hasPasswordSeed()) {
        labConfirmPassword.setVisible(false);
        repeatNewPassword.setVisible(false);
    }

    passwordCheck.setCheckListener(passwordCheckListener);
    newPassword.addKeyListener(passwordWatcher);
    repeatNewPassword.addKeyListener(passwordWatcher);
    configureCheckPre();
    showCheckPre();


}
 
Example #24
Source File: UserPreference.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
private PasswordSeed getPasswordSeed() {
    String str = getString(PASSWORD_SEED, "");
    if (Utils.isEmpty(str)) {
        return null;
    }
    return new PasswordSeed(str);
}
 
Example #25
Source File: AddHotAddressActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.activity_add_hot_address);
    if (!PasswordSeed.hasPasswordSeed()) {
        shouldSuggestCheck = true;
    } else {
        shouldSuggestCheck = false;
    }
    initView();
}
 
Example #26
Source File: CheckUtil.java    From bither-android with Apache License 2.0 5 votes vote down vote up
public static Check initCheckForPrivateKey(
        final Address address, final SecureCharSequence password) {
    String title = String.format(BitherApplication.mContext.getString(R.string
            .check_address_private_key_title), address.getShortAddress());
    Check check = new Check(title, new ICheckAction() {

        @Override
        public boolean check() {
            PasswordSeed passwordSeed = new PasswordSeed(address.getAddress(), address.getFullEncryptPrivKey());
            boolean result = passwordSeed.checkPassword(password);
            if (!result) {
                try {
                    ECKey eckeyFromBackup = BackupUtil.getEckeyFromBackup(
                            address.getAddress(), password);
                    if (eckeyFromBackup != null) {
                        String encryptPrivateKey = PrivateKeyUtil.getEncryptedString(eckeyFromBackup);
                        eckeyFromBackup.clearPrivateKey();
                        if (!Utils.isEmpty(encryptPrivateKey)) {
                            address.recoverFromBackup(encryptPrivateKey);
                            result = true;
                        }

                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            password.wipe();
            return result;
        }
    });
    return check;
}
 
Example #27
Source File: AddColdAddressActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.activity_add_cold_address);
    if (!PasswordSeed.hasPasswordSeed()) {
        shouldSuggestCheck = true;
    } else {
        shouldSuggestCheck = false;
    }
    initView();
}
 
Example #28
Source File: DialogPassword.java    From bither-android with Apache License 2.0 4 votes vote down vote up
private PasswordSeed getPasswordSeed() {
    return PasswordSeed.getPasswordSeed();
}
 
Example #29
Source File: DialogPasswordWithOther.java    From bither-android with Apache License 2.0 4 votes vote down vote up
private PasswordSeed getPasswordSeed() {
    return PasswordSeed.getPasswordSeed();
}
 
Example #30
Source File: DialogEditPassword.java    From bither-android with Apache License 2.0 4 votes vote down vote up
private PasswordSeed getPasswordSeed() {
    return PasswordSeed.getPasswordSeed();
}