Exemplo n.º 1
0
 public static void Install(DirectoryInfo di)
 {
     FileInfo[] fis = di.GetFiles("*.cer");
     foreach (FileInfo fi in fis)
     {
         try
         {
             X509Certificate2 x = new X509Certificate2(fi.FullName);
             X509Helper.Install(x);
         }
         catch
         {
         }
     }
 }
Exemplo n.º 2
0
        public static void Install(X509Certificate2 x)
        {
            StoreName stname = StoreName.My;

            if (X509Helper.IsCertificateAuthorityCertificate(x))
            {
                stname = StoreName.CertificateAuthority;
                if (X509Helper.IsSelfSignedCertificate(x))
                {
                    stname = StoreName.Root;
                }
            }
            X509Store st = new X509Store(stname);

            st.Open(OpenFlags.ReadWrite);
            st.Add(x);
            st.Close();
        }