示例#1
0
 public static void removeSDVPGeneratedCerts(bool bRemoveRoot)
 {
     if (oCertProvider is ICertificateProvider2)
     {
         (oCertProvider as ICertificateProvider2).ClearCertificateCache(bRemoveRoot);
     }
     else
     {
         oCertProvider.ClearCertificateCache();
     }
 }
示例#2
0
 internal static void removeFiddlerGeneratedCerts()
 {
     if (oCertProvider != null)
     {
         oCertProvider.ClearCertificateCache();
     }
     else
     {
         lock (oRootCertCreationLock)
         {
             string sFullSubject = string.Format("CN={0}{1}", CONFIG.sMakeCertRootCN, CONFIG.sMakeCertSubjectO);
             X509Certificate2Collection certificates = FindCertsBySubject(StoreName.Root, StoreLocation.CurrentUser, sFullSubject);
             if (certificates.Count > 0)
             {
                 X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
                 store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
                 try
                 {
                     store.RemoveRange(certificates);
                 }
                 catch
                 {
                 }
                 store.Close();
             }
             certificates = FindCertsByIssuer(StoreName.My, sFullSubject);
             if (certificates.Count > 0)
             {
                 X509Store store2 = new X509Store(StoreName.My, StoreLocation.CurrentUser);
                 store2.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
                 try
                 {
                     store2.RemoveRange(certificates);
                 }
                 catch
                 {
                 }
                 store2.Close();
             }
         }
     }
 }