-
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
The description of the LoadFromStoreCert method says:
Exact subject match is loaded if present, otherwise best matching certificate with the subject name that contains supplied subject. Subject comparison is case-insensitive. But it is not, the certificate with the exact value of the subject is not loaded.
The certificate.GetNameInfo(X509NameType.SimpleName, true) method returns the name of the issuer and not the subject of the certificate.
For the GetNameInfo method to return the full name of the certificate subject, you need to call the method with parameters: nameType: X509NameType.SimpleName, forIssuer: false. => certificate.GetNameInfo(X509NameType.SimpleName, false).
aspnetcore/src/Servers/Kestrel/Core/src/CertificateLoader.cs
Lines 51 to 55 in c1f7320
| if (certificate.GetNameInfo(X509NameType.SimpleName, true).Equals(subject, StringComparison.InvariantCultureIgnoreCase)) | |
| { | |
| foundCertificate = certificate; | |
| break; | |
| } |
Expected Behavior
Load a certificate with an exact subject match if such a certificate exists.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
7.0.302
Anything else?
No response