Skip to content

Commit 842b3da

Browse files
author
Bob Pokorny
committed
Fixed formatting of private SSH key when creating a temp file when using ssh.
1 parent 02f3f26 commit 842b3da

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
2.6.4
22
* Fixed an issue with SSL Flags greater than 3 were not being applied correctly to newer IIS servers.
3+
* Fixed an issue when formatting private RSA keys when connecting using the ssh protocol.
4+
35
2.6.3
46
* Fixed re-enrollment or ODKG job when RDN Components contained escaped commas.
57
* Updated renewal job for IIS Certs to delete the old cert if not bound or used by other web sites.

IISU/PSHelper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,10 @@ private string createPrivateKeyFile()
635635

636636
private static string formatPrivateKey(string privateKey)
637637
{
638-
String keyType = privateKey.Contains("OPENSSH PRIVATE KEY") ? "OPENSSH" : "RSA";
638+
string header = privateKey.Substring(0, privateKey.IndexOf("KEY-----") + 8);
639+
string footer = privateKey.Substring(privateKey.IndexOf("-----END"));
639640

640-
return privateKey.Replace($" {keyType} PRIVATE ", "^^^").Replace(" ", System.Environment.NewLine).Replace("^^^", $" {keyType} PRIVATE ") + System.Environment.NewLine;
641+
return privateKey.Replace(header, "HEADER").Replace(footer, "FOOTER").Replace(" ", Environment.NewLine).Replace("HEADER", header).Replace("FOOTER", footer) + Environment.NewLine;
641642
}
642643
}
643644
}

0 commit comments

Comments
 (0)