ECDiffieHellmanCng Constructors

Definition

Initializes a new instance of the ECDiffieHellmanCng class.

Overloads

ECDiffieHellmanCng()

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

ECDiffieHellmanCng(Int32)

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

ECDiffieHellmanCng(CngKey)

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

ECDiffieHellmanCng(ECCurve)

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

ECDiffieHellmanCng()

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

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

C#
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public ECDiffieHellmanCng();
C#
public ECDiffieHellmanCng();
Attributes

Remarks

The random key pair has a default public key length of 521 bits.

Applies to

.NET 10 and other versions
Product Versions
.NET 6, 7, 8, 9, 10
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5

ECDiffieHellmanCng(Int32)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

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

C#
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public ECDiffieHellmanCng(int keySize);
C#
public ECDiffieHellmanCng(int keySize);
C#
[System.Security.SecurityCritical]
public ECDiffieHellmanCng(int keySize);

Parameters

keySize
Int32

The size of the key. Valid key sizes are 256, 384, and 521 bits.

Attributes

Exceptions

keySize specifies an invalid length.

Cryptography Next Generation (CNG) classes are not supported on this system.

Remarks

The random key pair will have the public key length defined by the keySize parameter.

Applies to

.NET 10 and other versions
Product Versions
.NET 6, 7, 8, 9, 10
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5

ECDiffieHellmanCng(CngKey)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

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

C#
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public ECDiffieHellmanCng(System.Security.Cryptography.CngKey key);
C#
public ECDiffieHellmanCng(System.Security.Cryptography.CngKey key);
C#
[System.Security.SecurityCritical]
public ECDiffieHellmanCng(System.Security.Cryptography.CngKey key);

Parameters

key
CngKey

The key that will be used as input to the cryptographic operations performed by the current object.

Attributes

Exceptions

key is null.

key does not specify an Elliptic Curve Diffie-Hellman (ECDH) algorithm group.

Cryptography Next Generation (CNG) classes are not supported on this system.

Applies to

.NET 10 and other versions
Product Versions
.NET 6, 7, 8, 9, 10
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5

ECDiffieHellmanCng(ECCurve)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

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

C#
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public ECDiffieHellmanCng(System.Security.Cryptography.ECCurve curve);
C#
public ECDiffieHellmanCng(System.Security.Cryptography.ECCurve curve);

Parameters

curve
ECCurve

The curve used to generate the public/private key pair.

Attributes

Exceptions

curve does not validate.

Remarks

curve must validate (that is, it must return true) when passed to the ECCurve.Validate method and must be either a named or explicit prime.

Applies to

.NET 10 and other versions
Product Versions
.NET 6, 7, 8, 9, 10
.NET Framework 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5