Corrected the way alternate names from a certificate is extracted and used
This commit is contained in:
parent
eb9b311bba
commit
14a1a06dd1
1 changed files with 6 additions and 3 deletions
|
@ -281,12 +281,15 @@ namespace WebsitePanel.Providers.Web.Iis
|
||||||
|
|
||||||
if (!dedicatedIp)
|
if (!dedicatedIp)
|
||||||
{
|
{
|
||||||
hostNames.AddRange(from extension in certificate.Extensions.Cast<X509Extension>() where extension.Oid.FriendlyName == "Subject Alternative Name" select extension.Format(true));
|
hostNames.AddRange(certificate.Extensions.Cast<X509Extension>()
|
||||||
|
.Where(e => e.Oid.FriendlyName == "Subject Alternative Name")
|
||||||
|
.Select(e => e.Format(true).Replace("DNS Name=", "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hostNames.Any())
|
var simpleName = certificate.GetNameInfo(X509NameType.SimpleName, false);
|
||||||
|
if (hostNames.All(h => h != simpleName))
|
||||||
{
|
{
|
||||||
hostNames.Add(certificate.GetNameInfo(X509NameType.SimpleName, false));
|
hostNames.Add(simpleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For every hostname (only one if using old school dedicated IP binding)
|
// For every hostname (only one if using old school dedicated IP binding)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue