Alexandru Alexandru - 1 year ago 118
C# Question

Get X509 Certificate from mage signed manifest file

I have an

file (yes, its an Outlook addin VSTO file) which contains a signed certificate, signed using mage.exe. It successfully created a
tags which contain the encoded public certificate as far as I can tell embedded within it, of this format:


How can I read this certificate back as an X509 certificate in C#? I can't seem to find a suitable X509Certificate2 constructor to make this magic happen in my C#, .NET application.

Answer Source

This string probably represents the certificate raw data encoded as base64. Use the Convert.FromBase64String method to convert this into a byte[] and then use the X509Certificate2 constructor that takes a byte[] to create the certificate object.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download