ComputeSharedSecret Method
ComputeSharedSecret(ECParameters, ReadOnlySpan<Byte>)
Computes a shared secret by producing the ECDH shared point without running it through a KDF. Only the X-coordinate is returned.
C#
byte[] ComputeSharedSecret(ECParameters publicKey, ReadOnlySpan<byte> privateValue)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.ECParameters | publicKey | The other party's public key. |
System.ReadOnlySpan<System.Byte> | privateValue | Your private key value that was generated based on the same curve as the other party's public key. |
Returns
System.Byte[]
The X-coordinate of the computed shared point.
Remarks
This function calculates the shared point - the result of the scalar-multiplication of the peer's
publicKey
and the local privateValue
. Only the X coordinate
of the shared point is returned.