語言

RSACng 建構函式

定義

初始化 RSACng 類別的新執行個體。

多載

名稱 Description
RSACng()

初始化類別的新實例 RSACng ,使用隨機的 2,048 位元金鑰對。

RSACng(Int32)

初始化類別的新實例 RSACng ,使用指定大小的隨機生成鍵。

RSACng(CngKey)

初始化一個新的類別實例 RSACng ,使用指定的鍵值。

RSACng()

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs

初始化類別的新實例 RSACng ,使用隨機的 2,048 位元金鑰對。

public:
 RSACng();
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public RSACng();
public RSACng();
Public Sub New ()
屬性

備註

此構造子不會立即產生新的公私鑰對。 此建構子將屬性設定 KeySize 為 2048,當需要鍵時,會利用屬性值產生鍵值。 如果是透過該 ImportParameters 方法或其他金鑰匯入方法載入金鑰,這個建構子的金鑰大小就沒有意義。

適用於

RSACng(Int32)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs

初始化類別的新實例 RSACng ,使用指定大小的隨機生成鍵。

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

參數

keySize
Int32

金鑰的大小以位元為單位產生。

屬性

例外狀況

keySize 不成立。

備註

有效金鑰大小範圍為 384 至 16,384 位元,每 8 個為單位。 我們建議所有金鑰的最小大小應為 2,048 位元。

此構造子不會立即產生新的公私鑰對。 此建構子將屬性設定 KeySize 為 , keySize 當需要鍵時,會利用屬性值產生鍵。 如果是透過該 ImportParameters 方法或其他金鑰匯入方法載入金鑰,這個建構子的金鑰大小就沒有意義。

適用於

RSACng(CngKey)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs

初始化一個新的類別實例 RSACng ,使用指定的鍵值。

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

參數

key
CngKey

RSA 操作的關鍵。

屬性

例外狀況

key 不是有效的 RSA 金鑰。

key 是 null。

備註

CngKey.AlgorithmGroup的 key 必須是 CngAlgorithmGroup.Rsa。

此建構子會建立金鑰的副本。 即使 key 被丟棄,RSA 中這個金鑰物件的副本仍然存活。

適用於