diff --git a/src/Microsoft.PowerShell.Security/security/AclCommands.cs b/src/Microsoft.PowerShell.Security/security/AclCommands.cs index 731ff5dd7cc..5590506f4aa 100644 --- a/src/Microsoft.PowerShell.Security/security/AclCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/AclCommands.cs @@ -1591,7 +1591,6 @@ protected override void ProcessRecord() } } #endif // !UNIX - } #pragma warning restore 56506 diff --git a/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs b/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs index 938721a1c2b..89d1ab99628 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs @@ -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); diff --git a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs index 4a4bce37c2b..6165f8b862a 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs @@ -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) @@ -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); } @@ -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); }