Exemple #1
0
 public void AddChallengeCert(X509Certificate2 certificate)
 {
     foreach (var dnsName in X509CertificateHelpers.GetAllDnsNames(certificate))
     {
         AddWithDomainName(_challengeCerts, dnsName, certificate);
     }
 }
Exemple #2
0
        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()));
        }
Exemple #3
0
 public virtual void Add(X509Certificate2 certificate)
 {
     foreach (var dnsName in X509CertificateHelpers.GetAllDnsNames(certificate))
     {
         AddWithDomainName(_certs, dnsName, certificate);
     }
 }
        public virtual void Add(X509Certificate2 certificate)
        {
            var commonName = certificate.GetNameInfo(X509NameType.SimpleName, false);

            AddWithDomainName(commonName, certificate);

            foreach (var subjectAltName in X509CertificateHelpers.GetDnsFromExtensions(certificate))
            {
                AddWithDomainName(subjectAltName, certificate);
            }
        }