mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Run CodeFormatter for Security module (#9399)
This commit is contained in:
3 files changed
+16
-17
No files matched your search
@@ -1591,7 +1591,6 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
}
|
||||
#endif // !UNIX
|
||||
|
||||
}
|
||||
|
||||
#pragma warning restore 56506
|
||||
|
||||
@@ -140,22 +140,22 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -3155,7 +3155,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
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)
|
||||
@@ -3204,21 +3204,21 @@ 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.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);
|
||||
}
|
||||
|
||||
@@ -3228,26 +3228,26 @@ namespace Microsoft.PowerShell.Commands
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user