Skip to content

libsodium.PKI.SharedSecret.DeriveSharedSecret

Andrew Lambert edited this page Jan 5, 2017 · 13 revisions

libsodium.PKI.SharedSecret.DeriveSharedSecret

##Method Signatures

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

##Return value The raw shared key 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 call the Constructor.

Clone this wiki locally