【问题标题】:SFTP Chilkat error "Expected KEX_DH_GEX_GROUP"SFTP Chilkat 错误“预期的 KEX_DH_GEX_GROUP”
【发布时间】:2013-09-04 02:34:39
【问题描述】:

我正在尝试连接到 SFTP,但在函数 sftp.Connect(hostname, port)...中从 Chilkat 收到以下错误...

Dll日期:2010 年 12 月 22 日 解锁前缀:* 用户名: 组件:.NET 2.0 Sftp版本:0 主机名:... 端口:22 ConnectTimeoutMs:50000

调用 ConnectSocket2 这是一个 IPV4 数字地址... 使用 IPV4 连接。 ipAddress:...* 套接字句柄:0x804 ai_addrlen:16 ai_addr: 0200 0016 4B7F 64D8 0000 0000 0000 0000

myIP_3: **.***.***.***
myPort_3: *****
connect successful.
Established TCP/IP connection with SSH server
clientIdentifier: SSH-2.0-PuTTY_Local:_May_11_2009_17:22:38
initialDataFromSshServer: SSH-2.0-0.0 

serverVersion: SSH-2.0-0.0 
KeyExchangeAlgs:
  algorithm: diffie-hellman-group1-sha1
  algorithm: diffie-hellman-group-exchange-sha1
  algorithm: diffie-hellman-group14-sha1
HostKeyAlgs:
  algorithm: ssh-dss
EncCS:
  algorithm: aes256-cbc
  algorithm: aes192-cbc
  algorithm: aes128-cbc
  algorithm: twofish-cbc
  algorithm: blowfish-cbc
  algorithm: 3des-cbc
  algorithm: arcfour
EncSC:
  algorithm: aes256-cbc
  algorithm: aes192-cbc
  algorithm: aes128-cbc
  algorithm: twofish-cbc
  algorithm: blowfish-cbc
  algorithm: 3des-cbc
  algorithm: arcfour
MacCS:
  algorithm: hmac-sha1
  algorithm: hmac-sha1-96
  algorithm: hmac-md5
  algorithm: hmac-md5-96
MacSC:
  algorithm: hmac-sha1
  algorithm: hmac-sha1-96
  algorithm: hmac-md5
  algorithm: hmac-md5-96
CompCS:
  algorithm: zlib
  algorithm: none
CompSC:
  algorithm: zlib
  algorithm: none
Encryption: 256-bit AES
Encryption: 256-bit AES
MAC: HMAC-SHA1
MAC: HMAC-SHA1
Compression: none
Compression: none
Key Exchange: DH Group Exchange SHA1
Host Key Algorithm: DSS
numBits: 160
pbits: 2048

使用 GEX 组。 发送 KEX_DH_GEX_REQUEST... pbits: 2048

收到意外消息。预期为 KEX_DH_GEX_GROUP。 消息类型:1

失败。

我主要是使用这4个函数来连接SFTP

sftp.UnlockComponent(ChilkatKey);
sftp.Connect(hostname, port);
sftp.AuthenticatePw(username, password);
sftp.InitializeSftp();

我错过了什么? 感谢您的帮助。

【问题讨论】:

    标签: sftp chilkat


    【解决方案1】:

    正确的顺序应该和你的一样:

    sftp.UnlockComponent(ChilkatKey);
    sftp.Connect(hostname, port);
    sftp.AuthenticatePw(username, password);
    sftp.InitializeSftp();
    

    但是在这些人之后,您需要调用 OpenDir 和 ReadDir(如果您需要获取远程文件夹上的文件数)方法,例如;

    string handler = sftp.OpenDir("remote_path");
    SFtpDir compassDir = sftp.ReadDir(handler);
    

    只需下载一个文件,您不需要调用 ReadDir 但必须调用 OpenDir。 在填充 compassDir 对象之后,您可以获得文件计数;

    int fileAmount = compassDir.NumFilesAndDirs
    

    或者您可以按名称下载文件,例如;

    sftp.DownloadFileByName("local_path","Remote_path_with_file_name");
    

    抱歉,打字错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-14
      • 1970-01-01
      相关资源
      最近更新 更多