mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-02 10:16:44 +00:00
add helper method to multiply a public key
This commit is contained in:
parent
f8f50c0dd9
commit
acb1d767e8
2 changed files with 7 additions and 1 deletions
|
@ -575,7 +575,7 @@ public class OutputDescriptor {
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
private List<ExtendedKey> sortExtendedPubKeys(Collection<ExtendedKey> keys) {
|
||||
public List<ExtendedKey> sortExtendedPubKeys(Collection<ExtendedKey> keys) {
|
||||
List<ExtendedKey> sortedKeys = new ArrayList<>(keys);
|
||||
if(mapChildrenDerivations == null || mapChildrenDerivations.isEmpty() || mapChildrenDerivations.containsKey(null)) {
|
||||
return sortedKeys;
|
||||
|
|
|
@ -326,6 +326,12 @@ public class ECKey {
|
|||
return pub.get();
|
||||
}
|
||||
|
||||
/** Multiply the public point by the provided private key */
|
||||
public ECKey multiply(BigInteger privKey) {
|
||||
ECPoint point = pub.get().multiply(privKey);
|
||||
return ECKey.fromPublicOnly(point, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the private key in the form of an integer field element. The public key is derived by performing EC
|
||||
* point addition this number of times (i.e. point multiplying).
|
||||
|
|
Loading…
Reference in a new issue