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 |
---|---|
Empty string |
|
KeyAlgorithmNames.RSA |
|
KeySize.RSA2048 |
|
Empty String |
|
HashAlgorithmNames.Sha256 |
|
ExportOption.NotExportable |
|
EnrollKeyUsage.Signing |
|
KeyProtectionLevel.NoConsent |
|
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;
}