Retired Microsoft Blog disclaimer

This directory is a mirror of retired "Decrypt My World" MSDN blog and is provided as is. All posting authorship and copyrights belong to respective authors.
Original URL: https://blogs.msdn.microsoft.com/alejacma/2011/11/07/certificate-request-doesnt-allow-the-private-key-of-the-enrolled-certificate-to-be-exported/
Post name: Certificate request doesn’t allow the private key of the enrolled certificate to be exported
Original author: Alejandro Campos Magencio
Posting date: 2011-11-07T07:16:46+00:00


Hi all,

The other day a customer of mine was creating certificate requests with a code like the following: How to create a certificate request with CertEnroll and .NET (C#). After he enrolled the certificates, he realized that when he tried to export them using the Certificates console he couldn't export their private key. In their custom certificate template they had specified that private key should be exportable.

It turned out they were not setting "objPrivateKey.ExportPolicy" to "X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_EXPORT_FLAG" (IX509PrivateKey::ExportPolicy property) in their code.

I hope this helps.

Regards,

Alex (Alejandro Campos Magencio)


Share this article:

Comments:

Comments are closed.