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