Create an Exportable User Request Using a Specific CSP

Applies To: Windows Server 2008

To make an exportable request, the private key export policy needs to be set to allow export of the private key as follows:

C#:
request.PrivateKey.ExportPolicy = X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_EXPORT_FLAG;

The ExportPolicy can also be set to one of the following values.

Flag Value Description

XCN_NCRYPT_ALLOW_ARCHIVING_FLAG

4

Allows newly generated keys to be exported upon creation for archiving or key recovery.

XCN_NCRYPT_ALLOW_EXPORT_FLAG

1

Allows keys to be exported.

XCN_NCRYPT_ALLOW_EXPORT_NONE

0

Prevents keys from being exported (default).