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/how-to-export-our-enrolled-certificates-programmatically/
Post name: How to export our enrolled certificates programmatically
Original author: Alejandro Campos Magencio
Posting date: 2011-11-07T08:23:50+00:00


Hi all,

If you are creating certificate requests to enroll certificates programmatically and using a code like the following: How to create a certificate request with CertEnroll and .NET (C#), you may need to export the enrolled certificate after you get the response from the Certificate Authority.

You may export the certificate and its private key to a .PFX file by using this mehod:

IX509Enrollment::CreatePFX method

Or if you don't need the private key and you would like to get a .CER file instead, you may use this property:

IX509Enrollment::Certificate property

You may get that property as Base64 or Binary string (by using the appropriate EncodingType enumerator), and write it to a file with .CER extension.

Regards,

Alex (Alejandro Campos Magencio)


Share this article:

Comments:

Comments are closed.