get wif from eckey

This commit is contained in:
Craig Raw 2022-01-12 15:42:44 +02:00
parent 3a557e3af8
commit 34bd72d87a

View file

@ -326,6 +326,17 @@ public class ECKey {
return priv;
}
/**
* Exports the private key in the form used by Bitcoin Core's "dumpprivkey" and "importprivkey" commands. Use
* the {@link DumpedPrivateKey#toString()} method to get the string.
*
* @return Private key bytes as a {@link DumpedPrivateKey}.
* @throws IllegalStateException if the private key is not available.
*/
public DumpedPrivateKey getPrivateKeyEncoded() {
return new DumpedPrivateKey(getPrivKeyBytes(), isCompressed());
}
/**
* Returns whether this key is using the compressed form or not. Compressed pubkeys are only 33 bytes, not 64.
*/