This is not indicated in the manual, but some Googling have returned pages from the end of the decade (for example, this ), suggesting that at least this was the case. We have a code like this:
var privateKeyAuthenticationMethod =
new PrivateKeyAuthenticationMethod(userName, new PrivateKeyFile(privateKeyLocation));
var connInfo =
new ConnectionInfo(
ftpSettings.HostAddress, ftpSettings.UserName, privateKeyAuthenticationMethod);
using (var client = new SftpClient(connInfo))
{
client.Connect();
client.UploadFile(memStreamData, destination);
}
This intercepts the private key that we successfully used through SCP2 (Secure Copy 2, as described in detail here ) - this is the 2048 DSA, which is listed as valid in the SSH.NET documentation. The key uses the ssh.com format, for example:
---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----
Subject: <FID name>
Comment: "2048-bit dsa, <FID name>@<Server name>, Mon Apr 24 201\
7 15:49:36 +0100"
<ENCRYPTED KEY>
---- END SSH2 ENCRYPTED PRIVATE KEY ----
However, in the part of processing the SSH.NET secret key, there is Regexone that does not match our private key and therefore throws an exception:
ERROR 2017-05-10 15:31:43 UTC [T: 474] – Invalid private key file.
ERROR 2017-05-10 15:31:43 UTC [T: 474] – at Renci.SshNet.PrivateKeyFile.Open(Stream privateKey, String passPhrase)
, OpenSSH, , , - .
- , Private Key SSH.NET, ? , , SSH.NET - SFTP, .