I am writing an automated process to do connect to an SFTP site for downloading files. I am evaluating a trial version of Rebex SFTP for this. Using Visual Studio 2008, Visual Basic, I created a simple program that does this:
Dim mysftp As New Rebex.Net.Sftp()
mysftp.LogWriter = New Rebex.FileLogWriter("c:\temp\log.txt", Rebex.LogLevel.Debug)
mysftp.Connect("ftp.devonway.com", Sftp.DefaultPort)
I can successfully connect to this SFTP site using Filezilla, answering Yes to the trust question. When I run my program, I get message "Key exchanged failed" on the connect command. I was kind of expecting to get a popup of some kind that asked me the same type of trust question that Filezila did, so that the key could be cached and re-used. I talked to the owner of the SFTP site. They sent me their public key and said I may need to load it on my PC and reference it in my application. But I don't know how to do this. I'd appreciate any help in getting this to work.
Here's the log file.
2011-07-19 19:47:09.954 Opening log file.
2011-07-19 19:47:10.032 INFO Sftp(1) Info: Connecting to ftp.devonway.com:22 using Sftp 2.0.4086.0 (trial version).
2011-07-19 19:47:10.235 DEBUG Sftp(1) SSH: Server is 'SSH-2.0-2.0'.
2011-07-19 19:47:10.235 INFO Sftp(1) SSH: Negotiation started.
2011-07-19 19:47:10.470 DEBUG Sftp(1) SSH: Negotiating key.
2011-07-19 19:47:11.548 DEBUG Sftp(1) SSH: Validating signature.
2011-07-19 19:47:11.579 DEBUG Sftp(1) SSH: Negotiation failed: Rebex.Net.SshException: Key exchange failed. ---> System.Security.Cryptography.CryptographicException: Invalid key size (4096).
at Rebex.Security.Cryptography.DSAManaged.ImportParameters(DSAParameters param)
at wWGvS.cqWBxP.Validate(SshHostKeyAlgorithm hostKeyAlgorithm, Byte[] hash, Byte[] signature, BLveTR serverKex)
at wWGvS.miMck.ArwjUr(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
at Rebex.Net.SshSession.ArwjUr(Byte[] )
--- End of inner exception stack trace ---
at Rebex.Net.SshSession.ArwjUr(Byte[] )
2011-07-19 19:47:11.595 ERROR Sftp(1) SSH: Rebex.Net.SshException: Key exchange failed. ---> System.Security.Cryptography.CryptographicException: Invalid key size (4096).
at Rebex.Security.Cryptography.DSAManaged.ImportParameters(DSAParameters param)
at wWGvS.cqWBxP.Validate(SshHostKeyAlgorithm hostKeyAlgorithm, Byte[] hash, Byte[] signature, BLveTR serverKex)
at wWGvS.miMck.ArwjUr(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
at Rebex.Net.SshSession.ArwjUr(Byte[] )
--- End of inner exception stack trace ---
at Rebex.Net.SshSession.ArwjUr(Byte[] )
at Rebex.Net.SshSession.bOtYJuZ()
at Rebex.Net.SshSession.Negotiate()
2011-07-19 19:47:11.610 ERROR Sftp(1) Info: Rebex.Net.SshException: Key exchange failed. ---> System.Security.Cryptography.CryptographicException: Invalid key size (4096).
at Rebex.Security.Cryptography.DSAManaged.ImportParameters(DSAParameters param)
at wWGvS.cqWBxP.Validate(SshHostKeyAlgorithm hostKeyAlgorithm, Byte[] hash, Byte[] signature, BLveTR serverKex)
at wWGvS.miMck.ArwjUr(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
at Rebex.Net.SshSession.ArwjUr(Byte[] )
--- End of inner exception stack trace ---
at Rebex.Net.SshSession.ArwjUr(Byte[] )
at Rebex.Net.SshSession.bOtYJuZ()
at Rebex.Net.SshSession.Negotiate()
at Rebex.Net.Sftp.Connect(String serverName, Int32 serverPort, SshParameters parameters)