Show / Hide Table of Contents

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
ECParameters publicKey

The other party's public key.

ReadOnlySpan<byte> privateValue

Your private key value that was generated based on the same curve as the other party's public key.

Returns

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.

In this article
Back to top Generated by DocFX