diff --git a/tools/src/main/java/com/google/bitcoin/tools/WalletTool.java b/tools/src/main/java/com/google/bitcoin/tools/WalletTool.java index 7b72b4d5d..130af465c 100644 --- a/tools/src/main/java/com/google/bitcoin/tools/WalletTool.java +++ b/tools/src/main/java/com/google/bitcoin/tools/WalletTool.java @@ -630,12 +630,23 @@ public class WalletTool { } if (options.has("privkey")) { String data = (String) options.valueOf("privkey"); - byte[] decode = Utils.parseAsHexOrBase58(data); - if (decode == null) { - System.err.println("Could not understand --privkey as either hex or base58: " + data); - return; + if (data.charAt(0) == 'L') { + DumpedPrivateKey dpk; + try { + dpk = new DumpedPrivateKey(params, data); + } catch (AddressFormatException e) { + System.err.println("Could not parse dumped private key " + data); + return; + } + key = dpk.getKey(); + } else { + byte[] decode = Utils.parseAsHexOrBase58(data); + if (decode == null) { + System.err.println("Could not understand --privkey as either hex or base58: " + data); + return; + } + key = new ECKey(new BigInteger(1, decode)); } - key = new ECKey(new BigInteger(1, decode)); if (options.has("pubkey")) { // Give the user a hint. System.out.println("You don't have to specify --pubkey when a private key is supplied.");