From feb85a13d3bb6b092705b377ecb126c1cd1ed370 Mon Sep 17 00:00:00 2001 From: Miron Cuperman Date: Wed, 29 Feb 2012 14:50:57 -0800 Subject: [PATCH] Remove private key from ECKey.toString and put it in toStringWithPrivate --- src/com/google/bitcoin/core/ECKey.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/google/bitcoin/core/ECKey.java b/src/com/google/bitcoin/core/ECKey.java index 81af7f72..be9ad483 100644 --- a/src/com/google/bitcoin/core/ECKey.java +++ b/src/com/google/bitcoin/core/ECKey.java @@ -181,15 +181,21 @@ public class ECKey implements Serializable { public String toString() { StringBuffer b = new StringBuffer(); b.append("pub:").append(Utils.bytesToHexString(pub)); - if (priv != null) { - b.append(" priv:").append(Utils.bytesToHexString(priv.toByteArray())); - } if (creationTimeSeconds != 0) { b.append(" timestamp:" + creationTimeSeconds); } return b.toString(); } + public String toStringWithPrivate() { + StringBuffer b = new StringBuffer(); + b.append(toString()); + if (priv != null) { + b.append(" priv:").append(Utils.bytesToHexString(priv.toByteArray())); + } + return b.toString(); + } + /** * Returns the address that corresponds to the public part of this ECKey. Note that an address is derived from * the RIPEMD-160 hash of the public key and is not the public key itself (which is too large to be convenient).