mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 05:27:17 +00:00
Add isPubKeyOnly and isEncrypted to both ECKey.toString() and DeterministicKey.toString().
This commit is contained in:
@@ -1174,6 +1174,7 @@ public class ECKey implements EncryptableItem, Serializable {
|
|||||||
if (includePrivate)
|
if (includePrivate)
|
||||||
helper.add("encryptedPrivateKey", encryptedPrivateKey);
|
helper.add("encryptedPrivateKey", encryptedPrivateKey);
|
||||||
helper.add("isEncrypted", isEncrypted());
|
helper.add("isEncrypted", isEncrypted());
|
||||||
|
helper.add("isPubKeyOnly", isPubKeyOnly());
|
||||||
return helper.toString();
|
return helper.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -485,6 +485,8 @@ public class DeterministicKey extends ECKey {
|
|||||||
helper.add("path", getPathAsString());
|
helper.add("path", getPathAsString());
|
||||||
if (creationTimeSeconds > 0)
|
if (creationTimeSeconds > 0)
|
||||||
helper.add("creationTimeSeconds", creationTimeSeconds);
|
helper.add("creationTimeSeconds", creationTimeSeconds);
|
||||||
|
helper.add("isEncrypted", isEncrypted());
|
||||||
|
helper.add("isPubKeyOnly", isPubKeyOnly());
|
||||||
return helper.toString();
|
return helper.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -318,8 +318,8 @@ public class ECKeyTest {
|
|||||||
public void testToString() throws Exception {
|
public void testToString() throws Exception {
|
||||||
ECKey key = ECKey.fromPrivate(BigInteger.TEN).decompress(); // An example private key.
|
ECKey key = ECKey.fromPrivate(BigInteger.TEN).decompress(); // An example private key.
|
||||||
NetworkParameters params = MainNetParams.get();
|
NetworkParameters params = MainNetParams.get();
|
||||||
assertEquals("ECKey{pub HEX=04a0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7, isEncrypted=false}", key.toString());
|
assertEquals("ECKey{pub HEX=04a0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7, isEncrypted=false, isPubKeyOnly=false}", key.toString());
|
||||||
assertEquals("ECKey{pub HEX=04a0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7, priv HEX=000000000000000000000000000000000000000000000000000000000000000a, priv WIF=5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreBoNWTw6, isEncrypted=false}", key.toStringWithPrivate(params));
|
assertEquals("ECKey{pub HEX=04a0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7, priv HEX=000000000000000000000000000000000000000000000000000000000000000a, priv WIF=5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreBoNWTw6, isEncrypted=false, isPubKeyOnly=false}", key.toStringWithPrivate(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user