Package lighthouse.utils

Examples of lighthouse.utils.KeyDerivationTasks


        KeyCrypterScrypt scrypt = new KeyCrypterScrypt(params.realIterations);
        // Write the target time to the wallet so we can make the progress bar work when entering the password.
        WalletPasswordController.setTargetTime(params.realTargetTime);

        // Deriving the actual key runs on a background thread.
        KeyDerivationTasks tasks = new KeyDerivationTasks(scrypt, password, params.realTargetTime) {
            @Override
            protected void onFinish(KeyParameter aesKey) {
                // The actual encryption part doesn't take very long as most private keys are derived on demand.
                Main.bitcoin.wallet().encrypt(scrypt, aesKey);
                informationalAlert("Wallet encrypted",
                        "You can remove the password at any time from the settings screen.");
                overlayUI.done();
            }
        };
        progressMeter.progressProperty().bind(tasks.progress);
        tasks.start();
    }
View Full Code Here


            return;
        }

        final KeyCrypterScrypt keyCrypter = (KeyCrypterScrypt) Main.bitcoin.wallet().getKeyCrypter();
        checkNotNull(keyCrypter);   // We should never arrive at this GUI if the wallet isn't actually encrypted.
        KeyDerivationTasks tasks = new KeyDerivationTasks(keyCrypter, password, getTargetTime()) {
            @Override
            protected void onFinish(KeyParameter aesKey) {
                super.onFinish(aesKey);
                checkGuiThread();
                if (Main.bitcoin.wallet().checkAESKey(aesKey)) {
                    WalletPasswordController.this.aesKey.set(aesKey);
                } else {
                    log.warn("User entered incorrect password");
                    fadeOut(progressMeter);
                    fadeIn(widgetBox);
                    fadeIn(buttonsBox);
                    informationalAlert("Wrong password",
                            "Please try entering your password again, carefully checking for typos or spelling errors.");
                }
            }
        };
        progressMeter.progressProperty().bind(tasks.progress);
        tasks.start();

        fadeIn(progressMeter);
        fadeOut(widgetBox);
        fadeOut(buttonsBox);
    }
View Full Code Here

TOP

Related Classes of lighthouse.utils.KeyDerivationTasks

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.