Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Microsoft.PowerShell.Security/security/AclCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,6 @@ protected override void ProcessRecord()
}
}
#endif // !UNIX

}

#pragma warning restore 56506
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,22 @@ protected override void ProcessRecord()
}
else
{
if (Password == null && !NoPromptForPassword.IsPresent)
if (Password == null && !NoPromptForPassword.IsPresent)
{
try
try
{
cert = GetCertFromPfxFile(resolvedProviderPath, null);
WriteObject(cert);
continue;
}
catch (CryptographicException)
}
catch (CryptographicException)
{
Password = SecurityUtils.PromptForSecureString(
Host.UI,
CertificateCommands.GetPfxCertPasswordPrompt);
}
}
}

try
{
cert = GetCertFromPfxFile(resolvedProviderPath, Password);
Expand Down
20 changes: 10 additions & 10 deletions src/Microsoft.PowerShell.Security/security/CertificateProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3155,7 +3155,7 @@ public EnhancedKeyUsageProperty(X509Certificate2 cert)
if (extension.Oid.Value == "2.5.29.37")
{
X509EnhancedKeyUsageExtension ext = extension as X509EnhancedKeyUsageExtension;
if(ext != null)
if (ext != null)
{
OidCollection oids = ext.EnhancedKeyUsages;
foreach (Oid oid in oids)
Expand Down Expand Up @@ -3204,21 +3204,21 @@ public DnsNameProperty(X509Certificate2 cert)
// 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.InvariantCultureIgnoreCase) &&
cert.Subject.IndexOf(",", System.StringComparison.InvariantCulture) == -1)
{
name = cert.Subject.Substring(distinguishedNamePrefix.Length);
try
{
unicodeName = idnMapping.GetUnicode(name);
}
catch(System.ArgumentException)
catch (System.ArgumentException)
{
// The name is not valid punyCode, assume it's valid ascii.
unicodeName = name;
}

dnsName = new DnsNameRepresentation(name,unicodeName);
dnsName = new DnsNameRepresentation(name, unicodeName);
_dnsList.Add(dnsName);
}

Expand All @@ -3228,26 +3228,26 @@ public DnsNameProperty(X509Certificate2 cert)
if (extension.Oid.Value == "2.5.29.17")
{
string[] names = extension.Format(true).Split(Environment.NewLine);
foreach(string nameLine in names)
foreach (string nameLine in names)
{
// Get the part after 'DNS Name='
if(nameLine.StartsWith(dnsNamePrefix, System.StringComparison.InvariantCultureIgnoreCase))
if (nameLine.StartsWith(dnsNamePrefix, System.StringComparison.InvariantCultureIgnoreCase))
{
name = nameLine.Substring(dnsNamePrefix.Length);
try
{
unicodeName = idnMapping.GetUnicode(name);
}
catch(System.ArgumentException)
catch (System.ArgumentException)
{
// The name is not valid punyCode, assume it's valid ascii.
unicodeName = name;
}

dnsName = new DnsNameRepresentation(name,unicodeName);
dnsName = new DnsNameRepresentation(name, unicodeName);

// Only add the name if it is not the same as an existing name.
if(!_dnsList.Contains(dnsName))
if (!_dnsList.Contains(dnsName))
{
_dnsList.Add(dnsName);
}
Expand Down