Fix wrong comparison in CertificateProvider (#9987)

This commit is contained in:
Ilya 2019-06-24 22:24:49 +05:00 committed by Travis Plunk
parent 4967416067
commit fae03446dc

View File

@ -3204,8 +3204,8 @@ namespace Microsoft.PowerShell.Commands
// extract DNS name from subject distinguish name
// if it exists and does not contain a comma
// a comma, indicates it is not a DNS name
if (cert.Subject.StartsWith(distinguishedNamePrefix, System.StringComparison.InvariantCultureIgnoreCase) &&
cert.Subject.IndexOf(",", System.StringComparison.InvariantCulture) == -1)
if (cert.Subject.StartsWith(distinguishedNamePrefix, System.StringComparison.OrdinalIgnoreCase) &&
!cert.Subject.Contains(','))
{
name = cert.Subject.Substring(distinguishedNamePrefix.Length);
try