JSch Algorithm negotiation fail

孤者浪人 提交于 2019-11-26 13:50:40

As you can see, the server offers these ciphers:

INFO: kex: server: aes256-cbc,aes192-cbc

But JSch accepts only these:

INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc

There's no common cipher to choose from.


Note that JSch does support both aes256-cbc and aes192-cbc, but requires JCE (Java Cryptography Extension) to allow them.

You probably do not have JCE, so these ciphers are not available. That's why there's

INFO: aes256-cbc is not available.


Download Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8 (or other version if not using JDK 1.8).

See also an answer to The cipher 'aes256-cbc' is required, but it is not available.

Rockie Yang

I solve it by adding the following line to /etc/ssh/sshd_config and restart the sshd service. Thanks for answer by @wierzbiks at another thread

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

I solve it updating the library jsch-0.1.27.jar to jsch-0.1.54.jar.

Finally in your code you should write something like this:

your Method {       
     session.setConfig("StrictHostKeyChecking", "no");
// That solve the problem.
    }

This code works in Java 1.5 or above if you need this java version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!