<PackageReference Include="BouncyCastle.Cryptography" Version="2.8.0-beta.349" />

Org.BouncyCastle.Crypto.Agreement.X25519Agreement

public sealed class X25519Agreement : IRawAgreement
X25519 (RFC 7748) Diffie-Hellman raw agreement. Init takes the local X25519PrivateKeyParameters; CalculateAgreement writes the 32-byte shared secret derived against the peer's X25519PublicKeyParameters.
public int AgreementSize { get; }

Length in bytes of the shared secret produced by the agreement (32).

public X25519Agreement()

public void CalculateAgreement(ICipherParameters publicKey, byte[] buf, int off)

Perform the agreement against publicKey and write the shared secret into buf starting at off.

public void CalculateAgreement(ICipherParameters publicKey, Span<byte> buf)

Span-based overload of CalculateAgreement.

public void Init(ICipherParameters parameters)

Capture the local private key used for subsequent agreements.