DSACng Constructors

Definition

Initializes a new instance of the DSACng class.

Overloads

DSACng()

Initializes a new instance of the DSACng class with a random 2,048-bit key pair.

DSACng(Int32)

Initializes a new instance of the DSACng class with a randomly generated key of the specified size.

DSACng(CngKey)

Initializes a new instance of the DSACng class with the specified key.

DSACng()

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

Initializes a new instance of the DSACng class with a random 2,048-bit key pair.

public:
 DSACng();
public DSACng ();
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public DSACng ();
Public Sub New ()
Attributes

Applies to

DSACng(Int32)

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

Initializes a new instance of the DSACng class with a randomly generated key of the specified size.

public:
 DSACng(int keySize);
public DSACng (int keySize);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public DSACng (int keySize);
new System.Security.Cryptography.DSACng : int -> System.Security.Cryptography.DSACng
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
new System.Security.Cryptography.DSACng : int -> System.Security.Cryptography.DSACng
Public Sub New (keySize As Integer)

Parameters

keySize
Int32

The size of the key to generate in bits.

Attributes

Exceptions

keySize is not valid.

Remarks

Valid key sizes range from 512 to 3,072 bits, in increments of 64. We recommend that a minimum size of 2,048 bits be used for all keys.

Important

The creators of the DSA algorithm have withdrawn their support for it. Consider using the RSA class or the ECDsa class instead of the DSA class. Use DSA only for compatibility with legacy applications and data.

Applies to

DSACng(CngKey)

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

Initializes a new instance of the DSACng class with the specified key.

public:
 DSACng(System::Security::Cryptography::CngKey ^ key);
public DSACng (System.Security.Cryptography.CngKey key);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public DSACng (System.Security.Cryptography.CngKey key);
new System.Security.Cryptography.DSACng : System.Security.Cryptography.CngKey -> System.Security.Cryptography.DSACng
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
new System.Security.Cryptography.DSACng : System.Security.Cryptography.CngKey -> System.Security.Cryptography.DSACng
Public Sub New (key As CngKey)

Parameters

key
CngKey

The key to use for DSA operations.

Attributes

Exceptions

key is not a valid DSA key.

key is null.

Remarks

The CngKey.AlgorithmGroup of key must be CngAlgorithmGroup.Dsa.

This constructor creates a copy of the key. Even if key is disposed, the copy of this key object in DSA remains alive.

Applies to