I am trying to upload files via SFTP using SSH.NET . SFTPClient.Connect()throws an SshConnectionException with the message "Bad packet length 1302334341." This is my code:
static void Main()
{
try
{
SftpClient sftp = new SftpClient(server, 22, userID, password);
sftp.Connect();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
I saw in another discussion that this is probably related to encryption. I am using AES and I have a host key. However, I do not understand how to enter encryption. Based on this discussion, I played with this:
ConnectionInfo connectionInfo = new PasswordConnectionInfo(server, 22, userID, password);
connectionInfo.Encryptions.Clear();
connectionInfo.Encryptions.Add("aes","ssh-rsa 2048 11:22:34:d4:56:d6:78:90:01:22:6b:46:34:54:55:8a")
I know that the correct set of arguments for accessing Encryptions.Add () is not correct, but I got a little lost in using this library; can you help me figure out how to set the encryption correctly (assuming that the problem)?
sigil source
share