CSharp examples for System.Security.Cryptography:Certificate
Read in a certificate File
using System.Security.Permissions; using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography; using System.IO;/*w ww . j a v a 2 s . c o m*/ using System.Diagnostics; using System.Threading; using System.Resources; using System.Reflection.Emit; using System.Reflection; using System.Text; using System.Linq; using System.Collections.Generic; using System; public class Main{ /// <summary> /// Read in a certificate /// </summary> /// <param name="FileName"></param> /// <returns></returns> public static X509Certificate2 LoadCert(string FileName) { // Read in the certificate X509Certificate2 cert = null; if (File.Exists(FileName)) { try { byte[] rawCert = File.ReadAllBytes(FileName); cert = new X509Certificate2(rawCert); } catch { } } return cert; } }