RSACng 构造函数

定义

初始化 RSACng 类的新实例。

重载

RSACng()

使用随机的 2,048 位密钥对初始化 RSACng 类的新实例。

RSACng(Int32)

使用具有指定大小的随机生成密钥初始化 RSACng 类的新实例。

RSACng(CngKey)

使用指定的密钥初始化 RSACng 类的新实例。

RSACng()

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

使用随机的 2,048 位密钥对初始化 RSACng 类的新实例。

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

注解

此构造函数不会立即生成新的公钥/私钥对。 此构造函数将 KeySize 属性设置为 2048,当需要密钥时,将使用 属性值生成一个键。 如果通过 ImportParameters 方法或其他密钥导入方法加载密钥,则此构造函数中的密钥大小没有意义。

适用于

RSACng(Int32)

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

使用具有指定大小的随机生成密钥初始化 RSACng 类的新实例。

public:
 RSACng(int keySize);
public RSACng (int keySize);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public RSACng (int keySize);
new System.Security.Cryptography.RSACng : int -> System.Security.Cryptography.RSACng
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
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)

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

使用指定的密钥初始化 RSACng 类的新实例。

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

参数

key
CngKey

要用于 RSA 操作的密钥。

属性

例外

key 不是有效的 RSA 密钥。

keynull

注解

CngKey.AlgorithmGroupkey 必须为 CngAlgorithmGroup.Rsa

此构造函数创建密钥的副本。 即使 key 已释放,RSA 中此密钥对象的副本仍保持活动状态。

适用于