Hello
It is the first time I programmed the WinSCP client in .NET. We have hundreds of Siemens 840D sl CNC controllers where the OS is Linux. We want to read some files of these controllers from our Windows server where our C# app is running. I have used your sample code.
One info in advance!
We can connect to all the machines with the WinSCP GUI without any problem. We are just getting a warning message like
"The first key-exchange algorithm supported by the server is diffie-hellman-group1-sha1, which is below the warning treshold. Do you want to continue with the connection?" If we sey yes then connection is established.
- First I tried without any security
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "10.92.XXX.XXX",
UserName = "user",
Password = "XXXXX",
PortNumber = 22,
GiveUpSecurityAndAcceptAnySshHostKey = true,
};
I got the Error:
The key-exchange algorithm diffie-hellman-group1-sha1 was not verified!
- I added fingerprint as following. (I didn't know what the fingerprint was. I connected with the WinSCP GUI to the same machine and took the fingerprint from the function "Generate Transfer Code"
//GiveUpSecurityAndAcceptAnySshHostKey=true,
SshHostKeyFingerprint = "ssh-dss 1024 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=",
I got again the Error: The key-exchange algorithm diffie-hellman-group1-sha1 was not verified!
- I finally tried to add following KEX setting
sessionOptions.AddRawSettings("KEX", "ecdh,dh-gex-sha1,dh-group14-sha1,rsa,dh-group1-sha1,WARN");
The the Error changed to "Connection has been unexpectedly closed. Server sent command exit status 2". I am totally confused. How should I proceed?
Finally we need a solution where we can connect to all the machines without entering any fingerprints just like the WinSCP GUI. I mean with the WinSCP GUI its possible without doing any additional setting on the GUI (With default settings). Why isn't working with the .NET code?