DSACng 建構函式

定義

初始化 DSACng 類別的新執行個體。Initializes a new instance of the DSACng class.

多載

DSACng()

使用隨機 2,048 位元金鑰組,初始化 DSACng 類別的新執行個體。Initializes a new instance of the DSACng class with a random 2,048-bit key pair.

DSACng(Int32)

使用指定大小之隨機產生的金鑰,初始化 DSACng 類別的新執行個體。Initializes a new instance of the DSACng class with a randomly generated key of the specified size.

DSACng(CngKey)

使用指定的金鑰,初始化 DSACng 類別的新執行個體。Initializes a new instance of the DSACng class with the specified key.

DSACng()

使用隨機 2,048 位元金鑰組,初始化 DSACng 類別的新執行個體。Initializes a new instance of the DSACng class with a random 2,048-bit key pair.

public:
 DSACng();
public DSACng ();
Public Sub New ()

適用於

DSACng(Int32)

使用指定大小之隨機產生的金鑰,初始化 DSACng 類別的新執行個體。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);
new System.Security.Cryptography.DSACng : int -> System.Security.Cryptography.DSACng
Public Sub New (keySize As Integer)

參數

keySize
Int32

要產生的金鑰大小 (以位元為單位)。The size of the key to generate in bits.

例外狀況

keySize 無效。keySize is not valid.

備註

有效的金鑰大小範圍從512到3072位,以64的遞增。Valid key sizes range from 512 to 3,072 bits, in increments of 64. 建議您將最小大小的2048位用於所有的金鑰。We recommend that a minimum size of 2,048 bits be used for all keys.

重要

DSA 演算法的建立者已撤銷其對其支援的支援。The creators of the DSA algorithm have withdrawn their support for it. 請考慮使用 RSA 類別或類別, ECDsa 而不是 DSA 類別。Consider using the RSA class or the ECDsa class instead of the DSA class. DSA僅用於與繼承應用程式和資料的相容性。Use DSA only for compatibility with legacy applications and data.

適用於

DSACng(CngKey)

使用指定的金鑰,初始化 DSACng 類別的新執行個體。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);
new System.Security.Cryptography.DSACng : System.Security.Cryptography.CngKey -> System.Security.Cryptography.DSACng
Public Sub New (key As CngKey)

參數

key
CngKey

DSA 作業所要使用的金鑰。The key to use for DSA operations.

例外狀況

key 不是有效的 DSA 金鑰。key is not a valid DSA key.

keynullkey is null.

備註

CngKey.AlgorithmGroupkey 必須是 CngAlgorithmGroup.DsaThe CngKey.AlgorithmGroup of key must be CngAlgorithmGroup.Dsa.

這個函式會建立金鑰的複本。This constructor creates a copy of the key. 即使 key 處置了,DSA 中這個金鑰組象的複本仍保持運作。Even if key is disposed, the copy of this key object in DSA remains alive.

適用於