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(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { MyStore.Close(); RootStore.Close(); } }
public void Dispose() { if (MyStore != null) { MyStore.Close(); } if (RootStore != null) { RootStore.Close(); } }