Beispiel #1
0
        private bool disposedValue = false; // Dient zur Erkennung redundanter Aufrufe.

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (TemporaryCertificate != null)
                    {
                        CertificateStore.RemoveCert(TemporaryCertificate.Thumbprint);
                    }
                }
                disposedValue = true;
            }
        }
        public void CleanupCertsOfIssuerDistinguishedName()
        {
            DoInLocalMachineCertStores(certStore => {
                var certs = certStore.Certificates.Find(X509FindType.FindByIssuerDistinguishedName, IssuerDistinguishedName, false);

                //remove all endpoints from all found certs thumbprints
                foreach (X509Certificate2 cert in certs)
                {
                    var CertificateStore = new CertificateStoreUtil();
                    CertificateStore.RemoveCert(cert.Thumbprint);
                }

                //remove all certs
                certStore.RemoveRange(certs);
            });
        }