Share via


CertificateRequestProperties.KeySize Property

Definition

Gets or sets the size, in bits, of the private key to be generated.

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

Property Value

UInt32

unsigned int

uint32_t

The size, in bits, of the private key.

Examples

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;
}

Remarks

The default key size for RSA and DSA algorithms is 2048 bits. If an elliptic curve cryptographic (ECC) algorithm was specified in the KeyAlgorithmName property, the key size is ignored.

Applies to