Creating a certificate request (XAML)

To create a certificate request, you must first create a CertificateRequestProperties object and define the properties your certificate should have. By default, the constructor sets the following properties.

Property Default value

Subject

Empty string

KeyAlgorithmName

KeyAlgorithmNames.RSA

KeySize

KeySize.RSA2048

FriendlyName

Empty String

HashAlgorithmName

HashAlgorithmNames.Sha256

Exportable

ExportOption.NotExportable

KeyUsages

EnrollKeyUsage.Signing

KeyProtectionLevel

KeyProtectionLevel.NoConsent

KeyStorageProviderName

KeystorageProviderNames.SoftwareKeyStorageProvider

This is the "Microsoft Software Key Storage Provider"

To create the request, call the CreateRequestAsync method. This is shown by the following example.

public async Task<String>SampleCreateRequest()
{
    // Create a CertificateRequestProperties object.
    CertificateRequestProperties requestProp = new CertificateRequestProperties();

    // Assign a subject name to the properties object.
    requestProp.Subject = "SampleRequest";

    // Create a certificate request.
    String strRequest = await CertificateEnrollmentManager.CreateRequestAsync(requestProp);

    // Return the request string.
    return strRequest;
}

Submitting a certificate request

Working with certificates