CertificateRequestProperties.KeySize 属性

定义

获取或设置要生成的私钥的大小(以位为单位)。

public:
 property unsigned int KeySize { unsigned int get(); void set(unsigned int value); };
uint32_t KeySize();

void KeySize(uint32_t value);
public uint KeySize { get; set; }
var uInt32 = certificateRequestProperties.keySize;
certificateRequestProperties.keySize = uInt32;
Public Property KeySize As UInteger

属性值

UInt32

unsigned int

uint32_t

私钥的大小(以位为单位)。

示例

public UInt32 GetSetKeySize(UInt32 sizeIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();

    // The default value is 2048 bits.
    UInt32 uDefaultSize = reqProperties.KeySize;

    // If the input option does not equal the default option, reset the property value.
    if (SizeIn != uDefaultSize)
    {
        reqProperties.KeySize = SizeIn;
    }

    // Return the key size.
    return reqProperties.KeySize;
}

注解

RSA 和 DSA 算法的默认密钥大小为 2048 位。 如果在 KeyAlgorithmName 属性中指定了 ECC) 算法的椭圆曲线 (加密,则忽略密钥大小。

适用于