I'm able to connect using SFTP but when I send login credentials I am receiving an error? Any ideas?
The Log:
2010-09-01 11:08:21.687 Opening log file.
2010-09-01 11:08:21.875 ERROR Sftp(5) Info: Rebex.Net.SshException: Received invalid packet.
at wWGvS.AIchsYZ.AcUJKJ(Byte[] )
at Rebex.Net.SshSession.AePCoRZ(Byte[]& )
at Rebex.Net.SshSession.cDtmAOZ(Int64& , Boolean )
at Rebex.Net.SshSession.CFLiXJ(ANiLIV )
at Rebex.Net.SshSession.CgoKrJZ()
at Rebex.Net.SshSession.cCIjvV(String , String , SshPrivateKey , SshGssApiCredentials )
at Rebex.Net.SshSession.Authenticate(String userName, String password, SshPrivateKey privateKey)
at Rebex.Net.Sftp.Login(String userName, String password, SshPrivateKey privateKey)
2010-09-01 11:10:50.046 Opening log file.
2010-09-01 11:10:50.046 INFO Sftp(7) Info: Connecting to www.xyz.com:22 using Sftp 2.0.3854.0 (trial version).
2010-09-01 11:10:50.265 DEBUG Sftp(7) SSH: Server is 'SSH-2.0-OpenSSH_4.3'.
2010-09-01 11:10:50.265 DEBUG Sftp(7) SSH: Negotiation started.
2010-09-01 11:10:50.328 DEBUG Sftp(7) SSH: Group exchange.
2010-09-01 11:10:50.406 DEBUG Sftp(7) SSH: Negotiating key.
2010-09-01 11:10:51.343 DEBUG Sftp(7) SSH: Validating signature.
2010-09-01 11:10:51.359 DEBUG Sftp(7) SSH: Negotiation finished.
2010-09-01 11:10:51.359 INFO Sftp(7) Info: Server: SSH-2.0-OpenSSH_4.3
2010-09-01 11:10:51.359 INFO Sftp(7) Info: Fingerprint: d7:f3:65:20:ad:9c:3c:23:0e:cd:d4:d3:32:a9:42:c3
2010-09-01 11:10:51.359 INFO Sftp(7) Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, aes256-ctr/aes256-ctr, SHA1/SHA1
The Code:
Sftp client = new Sftp();
client.LogWriter = new Rebex.FileLogWriter(@"c:\work\log2.txt", Rebex.LogLevel.Debug);
// Create an instance of SshParameters class
// to specify desired arguments.
SshParameters par = new SshParameters();
// Disable transfer compression
par.Compression = false;
// Any key exchange method is acceptable.
par.KeyExchangeAlgorithms = SshKeyExchangeAlgorithm.DiffieHellmanGroupExchangeSHA1;
// Only allow AES and 3DES encryption methods.
par.EncryptionAlgorithms = SshEncryptionAlgorithm.AES | SshEncryptionAlgorithm.TripleDES;
// Connect to the server.
// The third argument refers to the parameters class.
client.Connect(FTPHost, Sftp.DefaultPort, par);
// verify the server's fingerprint (client.Fingerprint)
SshPrivateKey privateKey = new SshPrivateKey(@"c://work/key_rsa.pem", "password");
// authenticate
client.Login(FTPUser, privateKey);
client.Disconnect();