ECDiffieHellmanCng.KeySize 属性

定义

获取或设置非对称算法所用密钥模块的大小(以位为单位)。Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm.

public:
 virtual property int KeySize { int get(); void set(int value); };
public override int KeySize { get; set; }
member this.KeySize : int with get, set
Public Overrides Property KeySize As Integer

属性值

Int32

非对称算法所用密钥模块的大小(以位为单位)。The size, in bits, of the key modulus used by the asymmetric algorithm.

例外

LegalKeySizes 不允许 valuevalue is not permitted by LegalKeySizes.

注解

如果将此属性设置为其当前值,则不会产生任何效果。Setting this property to its current value has no visible effect. 如果将此属性设置为新的合法值,则将放弃当前密钥,但会推迟创建新密钥,直到需要一个密钥。Setting this property to a new legal value discards the current key, but defers creation of a new key until one is needed.

由于键大小不唯一标识椭圆曲线,因此不建议使用属性 setter。Because key sizes do not uniquely identify elliptic curves, the use of the property setter is discouraged. 若要生成特定曲线上的新键,请使用 GenerateKey 方法。To generate a new key on a specific curve, use the GenerateKey method.

适用于

另请参阅