This commit is contained in:
parent
3f808160dd
commit
a2effc56e0
|
|
@ -29,6 +29,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
||||||
foundCertificate = foundCertificates
|
foundCertificate = foundCertificates
|
||||||
.OfType<X509Certificate2>()
|
.OfType<X509Certificate2>()
|
||||||
.Where(IsCertificateAllowedForServerAuth)
|
.Where(IsCertificateAllowedForServerAuth)
|
||||||
|
.Where(DoesCertificateHaveAnAccessiblePrivateKey)
|
||||||
.OrderByDescending(certificate => certificate.NotAfter)
|
.OrderByDescending(certificate => certificate.NotAfter)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
|
@ -80,6 +81,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
||||||
return !hasEkuExtension;
|
return !hasEkuExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool DoesCertificateHaveAnAccessiblePrivateKey(X509Certificate2 certificate)
|
||||||
|
=> certificate.HasPrivateKey;
|
||||||
|
|
||||||
private static void DisposeCertificates(X509Certificate2Collection certificates, X509Certificate2 except)
|
private static void DisposeCertificates(X509Certificate2Collection certificates, X509Certificate2 except)
|
||||||
{
|
{
|
||||||
if (certificates != null)
|
if (certificates != null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue