Skip to content

libsodium.PKI.SharedSecret.DeriveSharedSecret

Andrew Lambert edited this page Mar 15, 2017 · 13 revisions

libsodium.PKI.SharedSecret.DeriveSharedSecret

Method Signatures

  Shared Function DeriveSharedSecret(RecipientPublicKey As MemoryBlock, SenderPrivateKey As libsodium.PKI.EncryptionKey) As MemoryBlock

Parameters

Name Type Comment
RecipientPublicKey MemoryBlock The public half of the recipient's key pair..
SenderPrivateKey EncryptionKey The sender's key pair.

Return value

The shared secret data.

Remarks

Computes a shared secret (NOT a key) given a SenderPrivateKey and RecipientPublicKey.

The return value represents the X coordinate of a point on the curve. As a result, the number of possible keys is limited to the group size (≈2^252), and the key distribution is not uniform.

For this reason, instead of directly using the return value as a shared key, it is recommended to use:

  GenericHash(return value + RecipientPublicKey + SenderPrivateKey)

Or just use the Constructor method.

Clone this wiki locally