Beispiel #1
0
        protected bool CheckCertificate()
        {
            bool ok = false;
            List <CertificateExpiration> certs = GetCertificateExpirationDates();

            CertificateExpiration cert = certs.SingleOrDefault(c => c.Subject == websiteName);

#if TESTING
            if (cert != null)
            {
                // Testing an existing cert for 30 days remaining.
                cert.ExpirationDate = DateTime.Now.AddDays(-(DAYS_BEFORE_EXPIRATION + 1));
            }
#endif

            if (cert == null || Expiring(cert))
            {
                Renew();
            }

            return(ok);
        }
Beispiel #2
0
 protected bool Expiring(CertificateExpiration cert)
 {
     return(DateTime.Now.AddDays(DAYS_BEFORE_EXPIRATION) > cert.ExpirationDate);
 }