lightningd/hsm_control.c: Implement getsharedsecret.

ChangeLog-Added: New `getsharedsecret` command, which lets you compute a shared secret with this node knowing only a public point. This implements the BOLT standard of hashing the ECDH point, and is incompatible with ECIES.
This commit is contained in:
ZmnSCPxj jxPCSnmZ
2020-02-04 13:53:17 +08:00
committed by Rusty Russell
parent 1b0807444b
commit d9b2482415
10 changed files with 284 additions and 2 deletions

View File

@@ -1126,3 +1126,15 @@ class LightningRpc(UnixDomainSocketRpc):
"pubkey": pubkey,
}
return self.call("checkmessage", payload)
def getsharedsecret(self, point, **kwargs):
"""
Compute the hash of the Elliptic Curve Diffie Hellman shared
secret point from this node private key and an
input {point}.
"""
payload = {
"point": point
}
payload.update({k: v for k, v in kwargs.items()})
return self.call("getsharedsecret", payload)