CertificateRequestProperties CertificateRequestProperties CertificateRequestProperties CertificateRequestProperties Class

Definition

Represents the properties of a certificate request.

public : sealed class CertificateRequestProperties : ICertificateRequestProperties, ICertificateRequestProperties2, ICertificateRequestProperties3, ICertificateRequestProperties4
public sealed class CertificateRequestProperties : ICertificateRequestProperties, ICertificateRequestProperties2, ICertificateRequestProperties3, ICertificateRequestProperties4
Public NotInheritable Class CertificateRequestProperties Implements ICertificateRequestProperties, ICertificateRequestProperties2, ICertificateRequestProperties3, ICertificateRequestProperties4
var certificateRequestProperties = new certificateRequestProperties();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Constructors

CertificateRequestProperties() CertificateRequestProperties() CertificateRequestProperties() CertificateRequestProperties()

Creates and initializes a new instance of the CertificateRequestProperties.

public : CertificateRequestProperties()
public CertificateRequestProperties()
Public Sub New()
var certificateRequestProperties = new certificateRequestProperties();

Remarks

This method sets the following default values.

PropertyDefault value
Subject Empty string
KeyAlgorithmName RSA
KeySize 2048 bits
FriendlyName Empty String
HashAlgorithmName SHA256
Exportable Not Exportable
KeyUsages Signing
KeyProtectionLevel NoConsent
KeyStorageProviderName Microsoft Software Key Storage Provider

Properties

AttestationCredentialCertificate AttestationCredentialCertificate AttestationCredentialCertificate AttestationCredentialCertificate

Gets or sets the CA exchange certificate that is used to encrypt a key attestation certificate request.

public : Certificate AttestationCredentialCertificate { get; set; }
public Certificate AttestationCredentialCertificate { get; set; }
Public ReadWrite Property AttestationCredentialCertificate As Certificate
var certificate = certificateRequestProperties.attestationCredentialCertificate;
certificateRequestProperties.attestationCredentialCertificate = certificate;
Value
Certificate Certificate Certificate Certificate

The CA exchange certificate that is used to encrypt a key attestation certificate request.

ContainerName ContainerName ContainerName ContainerName

Gets or sets the container name.

public : Platform::String ContainerName { get; set; }
public string ContainerName { get; set; }
Public ReadWrite Property ContainerName As string
var string = certificateRequestProperties.containerName;
certificateRequestProperties.containerName = string;
Value
Platform::String string string string

The container name.

ContainerNamePrefix ContainerNamePrefix ContainerNamePrefix ContainerNamePrefix

Gets or sets the prefix of the container name.

public : Platform::String ContainerNamePrefix { get; set; }
public string ContainerNamePrefix { get; set; }
Public ReadWrite Property ContainerNamePrefix As string
var string = certificateRequestProperties.containerNamePrefix;
certificateRequestProperties.containerNamePrefix = string;
Value
Platform::String string string string

The prefix of the container name.

CurveName CurveName CurveName CurveName

Gets or sets the name of the elliptic curve.

public : Platform::String CurveName { get; set; }
public string CurveName { get; set; }
Public ReadWrite Property CurveName As string
var string = certificateRequestProperties.curveName;
certificateRequestProperties.curveName = string;
Value
Platform::String string string string

The name of the elliptic curve.

CurveParameters CurveParameters CurveParameters CurveParameters

Gets or sets the parameters of the elliptic curve.

public : byte[] CurveParameters { get; set; }
public byte[] CurveParameters { get; set; }
Public ReadWrite Property CurveParameters As byte[]
var byte[] = certificateRequestProperties.curveParameters;
certificateRequestProperties.curveParameters = byte[];
Value
byte[] byte[] byte[] byte[]

The parameters of the elliptic curve.

Exportable Exportable Exportable Exportable

Gets or sets a value that specifies whether the private key created for the request can be exported.

public : ExportOption Exportable { get; set; }
public ExportOption Exportable { get; set; }
Public ReadWrite Property Exportable As ExportOption
var exportOption = certificateRequestProperties.exportable;
certificateRequestProperties.exportable = exportOption;
Value
ExportOption ExportOption ExportOption ExportOption

Specifies whether the key can be exported.

Examples

public ExportOption GetSetExportable(ExportOption inputOption)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();
    
    // The default value is ExportOption.NotExportable
    ExportOption defaultOption = reqProperties.Exportable;

    // If the input option does not equal the default option, reset the property value.
    if (inputOption != defaultOption)
    {
        reqProperties.Exportable = inputOption;
    }

    // Return the option value.
    return reqProperties.Exportable;
}

Remarks

By default, the private key is not exportable.

Extensions Extensions Extensions Extensions

Gets a vector of certificate extensions.

public : IVector<CertificateExtension> Extensions { get; }
public IList<CertificateExtension> Extensions { get; }
Public ReadOnly Property Extensions As IList<CertificateExtension>
var iList = certificateRequestProperties.extensions;
Value
IVector<CertificateExtension> IList<CertificateExtension> IList<CertificateExtension> IList<CertificateExtension>

A vector of certificate extensions.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

FriendlyName FriendlyName FriendlyName FriendlyName

Gets or sets the display name of the enrolled certificate.

public : Platform::String FriendlyName { get; set; }
public string FriendlyName { get; set; }
Public ReadWrite Property FriendlyName As string
var string = certificateRequestProperties.friendlyName;
certificateRequestProperties.friendlyName = string;
Value
Platform::String string string string

The display name.

Examples

public String GetSetDisplayName(String strDisplayNameIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();
    
    // The default value is an empty string.
    String defaultName = reqProperties.FriendlyName;

    // If the input option does not equal the default option, reset the property value.
    if (strDisplayNameIn != defaultName)
    {
        reqProperties.FriendlyName = strDisplayNameIn;
    }

    // Return the display name.
    return reqProperties.FriendlyName;

}

Remarks

By default, this value is an empty string. FriendlyName

HashAlgorithmName HashAlgorithmName HashAlgorithmName HashAlgorithmName

Gets or sets the hash algorithm used when creating the certificate request signature.

public : Platform::String HashAlgorithmName { get; set; }
public string HashAlgorithmName { get; set; }
Public ReadWrite Property HashAlgorithmName As string
var string = certificateRequestProperties.hashAlgorithmName;
certificateRequestProperties.hashAlgorithmName = string;
Value
Platform::String string string string

Hash algorithm.

Examples

public String GetSetHashAlgorithm(String strAlgNameIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();

    // The default value is SHA256.
    String strDefaultAlgName = reqProperties.HashAlgorithmName;

    // If the input option does not equal the default option, reset the property value.
    if (strAlgNameIn != strDefaultAlgName)
    {
        reqProperties.HashAlgorithmName = strAlgNameIn;
    }

    // Return the algorithm name.
    return reqProperties.HashAlgorithmName;
}

Remarks

The default value is SHA256.

KeyAlgorithmName KeyAlgorithmName KeyAlgorithmName KeyAlgorithmName

Gets or sets the public key algorithm.

public : Platform::String KeyAlgorithmName { get; set; }
public string KeyAlgorithmName { get; set; }
Public ReadWrite Property KeyAlgorithmName As string
var string = certificateRequestProperties.keyAlgorithmName;
certificateRequestProperties.keyAlgorithmName = string;
Value
Platform::String string string string

Algorithm name.

Examples

public String GetSetPublicKeyAlgorithm(String strAlgNameIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();

    // The default value is RSA.
    String strDefaultAlgName = reqProperties.KeyAlgorithmName;

    // If the input option does not equal the default option, reset the property value.
    if (strAlgNameIn != strDefaultAlgName)
    {
        reqProperties.KeyAlgorithmName = strAlgNameIn;
    }

    // Return the algorithm name.
    return reqProperties.KeyAlgorithmName;
}

Remarks

The default value is "RSA". You can use properties on the KeyAlgorithmNames class to specify error-free names or to compare the name retrieved by this property with a known string.

KeyProtectionLevel KeyProtectionLevel KeyProtectionLevel KeyProtectionLevel

Gets or sets the level of strong key protection.

public : KeyProtectionLevel KeyProtectionLevel { get; set; }
public KeyProtectionLevel KeyProtectionLevel { get; set; }
Public ReadWrite Property KeyProtectionLevel As KeyProtectionLevel
var keyProtectionLevel = certificateRequestProperties.keyProtectionLevel;
certificateRequestProperties.keyProtectionLevel = keyProtectionLevel;

Examples

public KeyProtectionLevel GetSetKeyProtectionLevel(KeyProtectionLevel levelIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();

    // The default value is NoConsent.
    KeyProtectionLevel defaultLevel = reqProperties.KeyProtectionLevel;

    // If the input option does not equal the default option, reset the property value.
    if (levelIn != defaultLevel)
    {
        reqProperties.KeyProtectionLevel = levelIn;
    }

    // return the key protection level.
    return reqProperties.KeyProtectionLevel;
}

Remarks

The default KeyProtectionLevel value is NoConsent. By default, therefore, strong key protection is not specified.

KeySize KeySize KeySize KeySize

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

public : unsigned int KeySize { get; set; }
public uint KeySize { get; set; }
Public ReadWrite Property KeySize As uint
var uint = certificateRequestProperties.keySize;
certificateRequestProperties.keySize = uint;
Value
unsigned int uint uint uint

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.

KeyStorageProviderName KeyStorageProviderName KeyStorageProviderName KeyStorageProviderName

Gets or sets the name of the key storage provider (KSP) that will be used to generate the private key.

public : Platform::String KeyStorageProviderName { get; set; }
public string KeyStorageProviderName { get; set; }
Public ReadWrite Property KeyStorageProviderName As string
var string = certificateRequestProperties.keyStorageProviderName;
certificateRequestProperties.keyStorageProviderName = string;
Value
Platform::String string string string

The KSP name. The default value is "Microsoft Software Key Storage Provider".

Examples

public String GetSetKspName(String strNameIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();

    // The default value is Microsoft Software Key Storage Provider.
    String strDefaultName = reqProperties.KeyStorageProviderName;

    // If the input option does not equal the default option, reset the property value.
    if (strNameIn != strDefaultName)
    {
        reqProperties.KeyStorageProviderName = strNameIn;
    }

    // Return the KSP name.
    return reqProperties.KeyStorageProviderName;
}

Remarks

The name of a cryptographic service provider (CSP) cannot be used.

KeyUsages KeyUsages KeyUsages KeyUsages

Gets or sets the operation that can be performed by the private key created for this certificate request. The default value is Signing.

public : EnrollKeyUsages KeyUsages { get; set; }
public EnrollKeyUsages KeyUsages { get; set; }
Public ReadWrite Property KeyUsages As EnrollKeyUsages
var enrollKeyUsages = certificateRequestProperties.keyUsages;
certificateRequestProperties.keyUsages = enrollKeyUsages;

Examples

public EnrollKeyUsages GetSetKeyUsage(EnrollKeyUsages keyUseIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();

    // The default value is signing.
    EnrollKeyUsages defaultKeyUse = reqProperties.KeyUsages;

    // If the input option does not equal the default option, reset the property value.
    if (keyUseIn != defaultKeyUse)
    {
        reqProperties.KeyUsages = keyUseIn;
    }

    // Return the value.
    return reqProperties.KeyUsages;
}

Remarks

The default key usage value is Signing.

SigningCertificate SigningCertificate SigningCertificate SigningCertificate

Gets or sets the certificate used to sign the certificate request.

public : Certificate SigningCertificate { get; set; }
public Certificate SigningCertificate { get; set; }
Public ReadWrite Property SigningCertificate As Certificate
var certificate = certificateRequestProperties.signingCertificate;
certificateRequestProperties.signingCertificate = certificate;
Value
Certificate Certificate Certificate Certificate

The certificate used to sign the certificate request.

Remarks

The output of a signed request is a PKCS7 X509 certificate request.

SmartcardReaderName SmartcardReaderName SmartcardReaderName SmartcardReaderName

Gets or sets the name of the smart card reader used to create the certificate request.

public : Platform::String SmartcardReaderName { get; set; }
public string SmartcardReaderName { get; set; }
Public ReadWrite Property SmartcardReaderName As string
var string = certificateRequestProperties.smartcardReaderName;
certificateRequestProperties.smartcardReaderName = string;
Value
Platform::String string string string

The name of the smart card reader used to create the certificate request.

Subject Subject Subject Subject

Gets or sets the subject name.

public : Platform::String Subject { get; set; }
public string Subject { get; set; }
Public ReadWrite Property Subject As string
var string = certificateRequestProperties.subject;
certificateRequestProperties.subject = string;
Value
Platform::String string string string

The X.500 distinguished name (DN).

Examples

public String GetSetSubjectName(String strNameIn)
{
    // Create a new CertificateRequestProperties object.
    CertificateRequestProperties reqProperties = new CertificateRequestProperties();

    // The default value is an empty string.
    String strDefaultName = reqProperties.Subject;

    // If the input option does not equal the default option, reset the property value.
    if (strNameIn != strDefaultName)
    {
        reqProperties.Subject = strNameIn;
    }

    // Return the subject name.
    return reqProperties.Subject;
}

Remarks

This value is an X.500 distinguished name (DN). This can be a full DN string that contains one or more relative distinguished names (RDNs) in the format of "CN=;OU=,..", or the subject name can be a simple string that contains the common name (CN) component of the full DN.

SubjectAlternativeName SubjectAlternativeName SubjectAlternativeName SubjectAlternativeName

Gets the subject alternative name.

public : SubjectAlternativeNameInfo SubjectAlternativeName { get; }
public SubjectAlternativeNameInfo SubjectAlternativeName { get; }
Public ReadOnly Property SubjectAlternativeName As SubjectAlternativeNameInfo
var subjectAlternativeNameInfo = certificateRequestProperties.subjectAlternativeName;
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

SuppressedDefaults SuppressedDefaults SuppressedDefaults SuppressedDefaults

Gets a vector of suppressed defaults.

public : IVector<Platform::String> SuppressedDefaults { get; }
public IList<string> SuppressedDefaults { get; }
Public ReadOnly Property SuppressedDefaults As IList<string>
var iList = certificateRequestProperties.suppressedDefaults;
Value
IVector<Platform::String> IList<string> IList<string> IList<string>

A vector of suppressed defaults.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

UseExistingKey UseExistingKey UseExistingKey UseExistingKey

Gets or sets whether to use the existing key.

public : Platform::Boolean UseExistingKey { get; set; }
public bool UseExistingKey { get; set; }
Public ReadWrite Property UseExistingKey As bool
var bool = certificateRequestProperties.useExistingKey;
certificateRequestProperties.useExistingKey = bool;
Value
Platform::Boolean bool bool bool

True if using the existing key; otherwise, false.