-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have 2 certificates NAME and NAMEB (actual cert names changed for obvious reasons). I am trying to configure Kestrel to use the NAMEB cert but the NAME cert is always being chosen. These certs are not self-signed.
As part of #34582 the Microsoft.AspNetCore.Server.Kestrel.Https.CertificateLoader was changed to support exact subject name match but it appears the certificate's issuer SimpleName is being used instead of the certificate's SimpleName. The certificate.GetNameInfo(X509NameType.SimpleName, true) should be certificate.GetNameInfo(X509NameType.SimpleName, false)
It should be noted that the NAME cert expires after the NAMEB cert which is why it is being chosen as the the first found cert.
Expected Behavior
I would expect the exact match logic to work and the NAME cert is chosen.
Steps To Reproduce
Kestrel config:
"Kestrel": {
"Endpoints": {
"HttpsInlineCertStore": {
"Url": "https://NAME:7286",
"Certificate": {
"Subject": "NAME",
"Store": "MY",
"Location": "LocalMachine"
}
}
}
}
With the following 2 certs in the cert store:
NAME- Expires after
NAMEB
- Expires after
NAMEB
Exceptions (if any)
No response
.NET Version
7.0.304
Anything else?
No response