public void AddChallengeCert(X509Certificate2 certificate) { foreach (var dnsName in X509CertificateHelpers.GetAllDnsNames(certificate)) { AddWithDomainName(_challengeCerts, dnsName, certificate); } }
public Task <IEnumerable <X509Certificate2> > GetCertificatesAsync(CancellationToken cancellationToken) { var domainNames = new HashSet <string>(_options.Value.DomainNames); var result = new List <X509Certificate2>(); var certs = _store.Certificates.Find(X509FindType.FindByTimeValid, DateTime.Now, validOnly: !AllowInvalidCerts); foreach (var cert in certs) { if (!cert.HasPrivateKey) { continue; } foreach (var dnsName in X509CertificateHelpers.GetAllDnsNames(cert)) { if (domainNames.Contains(dnsName)) { result.Add(cert); break; } } } return(Task.FromResult(result.AsEnumerable())); }
public virtual void Add(X509Certificate2 certificate) { PreloadIntermediateCertificates(certificate); foreach (var dnsName in X509CertificateHelpers.GetAllDnsNames(certificate)) { AddWithDomainName(_certs, dnsName, certificate); } }