<PackageReference Include="System.Security.Cryptography.Cng" Version="5.0.0-preview.2.20160.6" />

System.Security.Cryptography.ECDiffieHellmanCng

public sealed class ECDiffieHellmanCng : ECDiffieHellman
Provides a Cryptography Next Generation (CNG) implementation of the Elliptic Curve Diffie-Hellman (ECDH) algorithm. This class is used to perform cryptographic operations.
public CngAlgorithm HashAlgorithm { get; set; }

Gets or sets the hash algorithm to use when generating key material.

public byte[] HmacKey { get; set; }

Gets or sets the Hash-based Message Authentication Code (HMAC) key to use when deriving key material.

public CngKey Key { get; }

Specifies the CngKey that is used by the current object for cryptographic operations.

Gets or sets the key derivation function for the ECDiffieHellmanCng class.

public byte[] Label { get; set; }

Gets or sets the label value that is used for key derivation.

public byte[] SecretAppend { get; set; }

Gets or sets a value that will be appended to the secret agreement when generating key material.

public byte[] SecretPrepend { get; set; }

Gets or sets a value that will be added to the beginning of the secret agreement when deriving key material.

public byte[] Seed { get; set; }

Gets or sets the seed value that will be used when deriving key material.

public bool UseSecretAgreementAsHmacKey { get; }

Gets a value that indicates whether the secret agreement is used as a Hash-based Message Authentication Code (HMAC) key to derive key material.

Initializes a new instance of the ECDiffieHellmanCng class with a random key pair.

public ECDiffieHellmanCng(int keySize)

Initializes a new instance of the ECDiffieHellmanCng class with a random key pair, using the specified key size.

Initializes a new instance of the ECDiffieHellmanCng class by using the specified CngKey object.

Creates a new instance of the ECDiffieHellmanCng class whose public/private key pair is generated over the specified curve.

public byte[] DeriveKeyMaterial(CngKey otherPartyPublicKey)

Derives the key material that is generated from the secret agreement between two parties, given a CngKey object that contains the second party's public key.

Gets a handle to the secret agreement generated between two parties, given a CngKey object that contains the second party's public key.

Gets a handle to the secret agreement generated between two parties, given an ECDiffieHellmanPublicKey object that contains the second party's public key.

public void FromXmlString(string xml, ECKeyXmlFormat format)

Deserializes the key information from an XML string by using the specified format.

public string ToXmlString(ECKeyXmlFormat format)

Serializes the key information to an XML string by using the specified format.