Skip to content

Commit e3e3061

Browse files
authored
Update CertificateLoader.cs
The check for exact match to certificate subject fails as the `forIssuer` flag is set to true. This returns the `issuer` and not the `subject` this means that if two certificates have a partial match, it will just select the first one that has the search value in the name. [https://github.com/dotnet/aspnetcore/issues/49062](https://github.com/dotnet/aspnetcore/issues/49062)
1 parent 21c81d3 commit e3e3061

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Servers/Kestrel/Core/src/CertificateLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static X509Certificate2 LoadFromStoreCert(string subject, string storeNam
4848
// Pick the first one if there's no exact match as a fallback to substring default.
4949
foundCertificate ??= certificate;
5050

51-
if (certificate.GetNameInfo(X509NameType.SimpleName, true).Equals(subject, StringComparison.InvariantCultureIgnoreCase))
51+
if (certificate.GetNameInfo(X509NameType.SimpleName, false).Equals(subject, StringComparison.InvariantCultureIgnoreCase))
5252
{
5353
foundCertificate = certificate;
5454
break;

0 commit comments

Comments
 (0)