Skip to main content
CertificateEnrollmentManager.CreateRequestAsync | createRequestAsync method

Asynchronously creates a PKCS #10 certificate request based on properties specified in a CertificateRequestProperties object.

Syntax


Windows.Security.Cryptography.Certificates.CertificateEnrollmentManager.createRequestAsync(request).done( /* Your success and error handlers */ );

public static IAsyncOperation<string> CreateRequestAsync(
  CertificateRequestProperties request
)

Public Shared Function CreateRequestAsync(
  request As CertificateRequestProperties 
) As IAsyncOperation(Of String)

public:
static IAsyncOperation<String^>^ CreateRequestAsync(
  CertificateRequestProperties^ request
)

Parameters

request

Type: CertificateRequestProperties

A CertificateRequestProperties object that contains the property values used to create the certificate request.

Return value

Type: IAsyncOperation<String>

This method returns a string that contains the base64 encoded PKCS #10 certificate request.

Remarks

Certificate enrollment can be performed in an app container. We recommend that you use the following request objects to submit the request:

The CertificateRequestProperties object contains 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

 

While the CreateRequestAsync method creates the certificate request, you will need to submit the request to an http enrollment end point. You can then take the response from the http enrollment end point and then call the InstallCertificateAsync method to install the response.

Note  You must include the Signing value in the KeyUsages property in any CertificateRequestProperties object that you use in a call to CreateRequestAsync. If you wish to set KeyUsages to Decryption or KeyAgreement, you must also OR in Signing. Otherwise, the call to CreateRequestAsync will fail.

Examples


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

Requirements ( device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Security.Cryptography.Certificates
Windows::Security::Cryptography::Certificates [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.Security.Cryptography.Certificates
Windows::Security::Cryptography::Certificates [C++]

Metadata

Windows.winmd

See also

CertificateEnrollmentManager