JSchException: Algorithm negotiation fail

前端 未结 10 1903
面向向阳花
面向向阳花 2020-11-27 06:30

I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during \"session.connect();\" I am getting this exception:

com.jcraft.jsch.JS         


        
相关标签:
10条回答
  • 2020-11-27 07:13

    There are a couple of places that SSH clients and servers try and agree on a common implementation. Two I know of are encryption and compression. The server and client produce a list of available options and then the best available option in both lists is chosen.

    If there is no acceptable option in the lists then it fails with the error you got. I'm guessing from the debug output here but it looks like the only server options for encryption are "aes256-cbc hmac-md5 none".

    JSch doesn't do hmac-md5 and aes256-cbc is disabled because of your Java policy files. Two things you could try are...

    1. To increase the available encryption libraries on the server, install unrestricted policy files on your client, enabling aes256-cbc (make sure the message saying it is disabled goes away, those policy files are notoriously easy to install on the wrong JVM) from the site:

      For JDK 1.6: http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html

      For JDK 1.7: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

      For JDK 1.8: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

    2. or try and disable encryption.

    The first is ideal if you have access to the server (trust me aes128-cbc is plenty of encryption), but the second is easy enough to quickly test out the theory.

    0 讨论(0)
  • 2020-11-27 07:14

    The issue is with the Version of JSCH jar you are using.

    Update it to latest jar.

    I was also getting the same error and this solution worked.

    You can download latest jar from

    http://www.jcraft.com/jsch/

    0 讨论(0)
  • 2020-11-27 07:16

    I updated jsch lib latest one (0.1.55). working fine for me. no need to restart the server or no need to update java(current using java8)

    0 讨论(0)
  • 2020-11-27 07:18

    FWIW, I had this same error message under JSch 0.1.50. Upgrading to 0.1.52 solved the problem.

    0 讨论(0)
提交回复
热议问题