JSCH连接SFTP服务Algorithm negotiation fail

JAVA环境:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Server VM (build 20.45-b01, mixed mode)

jsch-0.1.42.jar

SFTP环境:
OpenSSH_6.7p1, OpenSSL 1.0.1j 15 Oct 2014。

现象就是应用程序客户端始终SFTP连接不了服务端,导致很多功能不能使用。
而在一些旧版本的OpenSSL机器上,如0.9.8e版本上是没有问题的,只要一升级OpenSSL就会导致该问题。

尝试思路:
1. JSCH版本过低,不支持最新版本OpenSSL导致的。
升级到JSCH 0.1.51版本后依然不行。

  1. JSCH不支持ECDSA算法,是无法使用最新OpenSSL的。
    为JSCH添加支持ECDSA算法的插件--->未测试。
    有没有哪位大神指明一下?

  2. 使用SSH调试模式连接:
    debug1:no match JSCH-0.1.51
    ...
    debug1:list_hostkey_types:ssh-rsa, ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519[preauth]
    ...
    debug1:kex:client->server aes128-ctr hmac-sha1 none [preauth]
    debug1:kex:server->client aes128-ctr hmac-sha1 none [preauth]
    debug1:Unable to negotiate a key exchange method [preauth]

    ...

然后尝试在sshd_config中添加了
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
还是不行。

求哪位大神指教一下,给个思路。

OpenSSH8.8p1
jdk1.8
jsch-0.1.55
服务端限制kex算法为curve25519-sha256,连不上,查看jsch源码中没有这个算法的支持代码。怎么破?

After upgrading OpenSSL and OpenSSH, before re-start ssh service:
Please add parameters in configure file < /etc/ssh/sshd_config > and < /usr/etc/sshd_config > as below:

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

because of algorithm negotiation fail occurred by OpenSSH and JSCH.
key exchange failure between JSCH and OpenSSH, it’s common issue for all code users.
JSCH support Key exchange algorithms: diffie-hellman-group1-sha1和diffie-hellman-group-exchange-sha1
But these algorithms are not listed by OpenSSH_6.7p1 Key exchange algorithms list.

So we need to specify key exchange algorithms in SSH configure files.

你好,请问你的这个问题解决了吗?我现在也遇到了这个问题。主机ssh升级到6.7后,我们使用jsch jar包ssh连接不上报Algorithm negotiation fail。

请问你的问题解决了吗?我也遇到了这个问题,请给我指点一下吧?

ssh client 报 algorithm negotiation failed的解决方法之一
修改sshd的配置文件 /etc/ssh/sshd_config

在配置文件中添加:

Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc

MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

我遇到类似的问题,jsch升级到最新版0.1.53即解决了问题

我也想知道,环境jdk1.8 ,jsch-54.jar,sftp据说是8.1,报了一模一样的错,除了算法更改的方式,兄弟们还有没有别的方式