Exemplo n.º 1
0
 public void AddChallengeCert(X509Certificate2 certificate)
 {
     foreach (var dnsName in X509CertificateHelpers.GetAllDnsNames(certificate))
     {
         AddWithDomainName(_challengeCerts, dnsName, certificate);
     }
 }
Exemplo n.º 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()));
        }
Exemplo n.º 3
0
 public virtual void Add(X509Certificate2 certificate)
 {
     foreach (var dnsName in X509CertificateHelpers.GetAllDnsNames(certificate))
     {
         AddWithDomainName(_certs, dnsName, certificate);
     }
 }
Exemplo n.º 4
0
        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);
            }
        }