mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 13:37:24 +00:00
Option to decrypt private keys and seed on the fly if printing a wallet dump of an encrypted wallet.
This commit is contained in:
@@ -1447,7 +1447,21 @@ public class WalletTool {
|
||||
// there just for the dump case.
|
||||
if (chainFileName.exists())
|
||||
setup();
|
||||
System.out.println(wallet.toString(options.has("dump-privkeys"), true, true, chain));
|
||||
|
||||
final boolean dumpPrivkeys = options.has("dump-privkeys");
|
||||
if (dumpPrivkeys && wallet.isEncrypted()) {
|
||||
if (password != null) {
|
||||
final KeyParameter aesKey = passwordToKey(true);
|
||||
if (aesKey == null)
|
||||
return; // Error message already printed.
|
||||
System.out.println(wallet.toString(true, aesKey, true, true, chain));
|
||||
} else {
|
||||
System.err.println("Can't dump privkeys, wallet is encrypted.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
System.out.println(wallet.toString(dumpPrivkeys, null, true, true, chain));
|
||||
}
|
||||
}
|
||||
|
||||
private static void setCreationTime() {
|
||||
|
||||
@@ -4,8 +4,9 @@ Usage: wallet-tool --flags action-name
|
||||
wallet-tool action-name --flags
|
||||
|
||||
>>> ACTIONS
|
||||
dump Loads and prints the given wallet in textual form to stdout. Private keys are only printed
|
||||
if --dump-privkeys is specified.
|
||||
dump Loads and prints the given wallet in textual form to stdout. Private keys and seed are only
|
||||
printed if --dump-privkeys is specified. If the wallet is encrypted, also specify the --password
|
||||
option to dump the private keys and seed.
|
||||
raw-dump Prints the wallet as a raw protobuf with no parsing or sanity checking applied.
|
||||
create Makes a new wallet in the file specified by --wallet.
|
||||
Will complain and require --force if the wallet already exists.
|
||||
|
||||
Reference in New Issue
Block a user