Пример #1
0
        public bool DestroySignedCertificates()
        {
            var myCertificates   = new X509Certificate2Collection();
            var rootCertificates = new X509Certificate2Collection();

            try
            {
                lock (MyStore)
                {
                    MyStore.Open(OpenFlags.ReadWrite);

                    var myStoreCertificates = MyStore.Certificates
                                              .Find(X509FindType.FindByIssuerName, Issuer, false);

                    myCertificates.AddRange(myStoreCertificates);
                }
                lock (RootStore)
                {
                    RootStore.Open(OpenFlags.ReadWrite);

                    var myRootCertificates = RootStore.Certificates
                                             .Find(X509FindType.FindByIssuerName, Issuer, false);

                    rootCertificates.AddRange(myRootCertificates);
                }
                return(DestroySignedCertificates(myCertificates, rootCertificates));
            }
            finally
            {
                MyStore.Close();
                RootStore.Close();
            }
        }
Пример #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         MyStore.Close();
         RootStore.Close();
     }
 }
Пример #3
0
        public void Dispose()
        {
            if (MyStore != null)
            {
                MyStore.Close();
            }

            if (RootStore != null)
            {
                RootStore.Close();
            }
        }