signrpc: add DeriveSharedKey

This commit is contained in:
Oliver Gugger committed 2019-12-20 09:25:52 +01:00
1 parent 6fef37cc06
commit 33e8077181
3 files changed
+255 -44

No files matched your search

+20
View File
@@ -151,6 +151,16 @@ message VerifyMessageResp {
bool valid = 1;
}
message SharedKeyRequest {
// The ephemeral public key to use for the DH key derivation.
bytes ephemeral_pubkey = 1;
}
message SharedKeyResponse {
// The shared public key, hashed with sha256.
bytes shared_key = 1;
}
service Signer {
/**
SignOutputRaw is a method that can be used to generated a signature for a
@@ -195,4 +205,14 @@ service Signer {
used to sign the message does not have to be a node known to the network.
*/
rpc VerifyMessage (VerifyMessageReq) returns (VerifyMessageResp);
/*
DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key
derivation between the ephemeral public key in the request and the node's
identity private key:
P_shared = privKeyNodeID * ephemeralPubkey
The resulting shared public key is serialized in the compressed format and
hashed with sha256, resulting in the final key length of 256bit.
*/
rpc DeriveSharedKey (SharedKeyRequest) returns (SharedKeyResponse);
}