title: JSch connection issue: JSchException: Algorithm negotiation fail – Even with JCE installed
body: <p>I am trying to connect to a server using JSch but it gives issues with connection. I am able to connect to the server using PuTTY but not using Java code.</p>
  <p>I am using jdk1.8.0_171</p>
  <p>Here is the code snippet</p>
  <pre><code>session = jsch.getSession(username, server, SSH_PORT);
  session.setPassword(password);
  session.setConfig(&quot;StrictHostKeyChecking&quot;, &quot;no&quot;);
  session.setTimeout(timeout);
  session.connect(timeout);
  </code></pre>
  <p>I am getting the following exception:</p>
  <pre class="lang-none prettyprint-override"><code>com.jcraft.jsch.JSchException: Algorithm negotiation fail
  at com.jcraft.jsch.Session.receive_kexinit(Session.java:590)
  at com.jcraft.jsch.Session.connect(Session.java:320)
  </code></pre>
  <p>Below are the JSch logs:</p>
  <pre class="lang-none prettyprint-override"><code>INFO: Connecting to &lt;servername&gt; port 22
  INFO: Connection established
  INFO: Remote version string: SSH-2.0-OpenSSH_8.0
  INFO: Local version string: SSH-2.0-JSCH-0.1.54
  INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
  INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
  INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  INFO: SSH_MSG_KEXINIT sent
  INFO: SSH_MSG_KEXINIT received
  INFO: kex: server: curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512
  INFO: kex: server: rsa-sha2-512,rsa-sha2-256,ssh-rsa
  INFO: kex: server: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
  INFO: kex: server: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
  INFO: kex: server: hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-sha1-etm@openssh.com,hmac-sha1,umac-128-etm@openssh.com,umac-64-etm@openssh.com,umac-128@openssh.com,umac-64@openssh.com
  INFO: kex: server: hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-sha1-etm@openssh.com,hmac-sha1,umac-128-etm@openssh.com,umac-64-etm@openssh.com,umac-128@openssh.com,umac-64@openssh.com
  INFO: kex: server: none,zlib@openssh.com
  INFO: kex: server: none,zlib@openssh.com
  INFO: kex: server: 
  INFO: kex: server: 
  INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
  INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
  INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
  INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
  INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
  INFO: kex: client: none
  INFO: kex: client: none
  INFO: kex: client: 
  INFO: kex: client: 
  INFO: Disconnecting from &lt;servername&gt; port 22
  com.jcraft.jsch.JSchException: Algorithm negotiation fail
  </code></pre>
  <p>Here is the pom file:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;com.jcraft&lt;/groupId&gt;
      &lt;artifactId&gt;jsch&lt;/artifactId&gt;
      &lt;version&gt;0.1.54&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>I also tried using JSch 0.1.55, still the same issue.</p>
  <p>I have checked the <a href="https://stackoverflow.com/questions/6263630/jschexception-algorithm-negotiation-fail">JSchException: Algorithm negotiation fail</a>. But as you can see in the log, all ciphers are available.</p>
  <p>It would be preferable if no changes are done on the server side.</p>
  <p>How do I solve this? Thank you for your help.</p>