title: JSch Algorithm negotiation fail
body: <p>I try to connect SFTP server by Java.</p>
  
  <p>I got an error.</p>
  
  <blockquote>
    <p>com.jcraft.jsch.JSchException: Algorithm negotiation fail</p>
  </blockquote>
  
  <p>Here is the POM:</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.53&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Here is the log:</p>
  
  <pre class="lang-none prettyprint-override"><code>INFO: Connecting to **"FTP ADRESS"** port 22
  INFO: Connection established
  INFO: Remote version string: SSH-2.0-Maverick_SSHD
  INFO: Local version string: SSH-2.0-JSCH-0.1.53
  INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
  INFO: aes256-ctr is not available.
  INFO: aes192-ctr is not available.
  INFO: aes256-cbc is not available.
  INFO: aes192-cbc is not available.
  INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
  INFO: diffie-hellman-group14-sha1 is not available.
  INFO: ecdh-sha2-nistp256 is not available.
  INFO: ecdh-sha2-nistp384 is not available.
  INFO: ecdh-sha2-nistp521 is not available.
  INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  INFO: ecdsa-sha2-nistp256 is not available.
  INFO: ecdsa-sha2-nistp384 is not available.
  INFO: ecdsa-sha2-nistp521 is not available.
  INFO: SSH_MSG_KEXINIT sent
  INFO: SSH_MSG_KEXINIT received
  INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
  INFO: kex: server: ssh-rsa
  INFO: kex: server: aes256-cbc,aes192-cbc
  INFO: kex: server: aes256-cbc,aes192-cbc
  INFO: kex: server: hmac-sha1,hmac-sha1-96
  INFO: kex: server: hmac-sha1,hmac-sha1-96
  INFO: kex: server: none
  INFO: kex: server: none
  INFO: kex: server: 
  INFO: kex: server: 
  INFO: kex: client: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
  INFO: kex: client: ssh-rsa,ssh-dss
  INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
  INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-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 "FTP ADRESS" port 22
  </code></pre>
  
  <p>I got this error what i tried to fix. I cannot access the SFTP server to download or update any file or etc...</p>
  
  <p>I can connect the server by FileZilla, but I cannot make it by Java.</p>
  
  <p>Connection Code:</p>
  
  <pre><code>JSch jsch = new JSch();
  Properties config = new Properties();
  config.put("cipher.s2c", 
             "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc");
  config.put("cipher.c2s",
             "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc");
  config.put("kex", "diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256");
  Session jschSession = jsch.getSession("username","server",22);
  
  jschSession.setConfig("StrictHostKeyChecking", "no");
  jschSession.setPassword("password");
  jschSession.setConfig(config);
  jschSession.connect();
  </code></pre>
  
  <p>When I added </p>
  
  <pre><code>config.put("cipher.s2c", 
             "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc");
  </code></pre>
  
  <p>the logs are like this</p>
  
  <pre class="lang-none prettyprint-override"><code>INFO: Connecting to ftp.servername port 22
  INFO: Connection established
  INFO: Remote version string: SSH-2.0-Maverick_SSHD
  INFO: Local version string: SSH-2.0-JSCH-0.1.53
  INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
  INFO: aes256-ctr is not available.
  INFO: aes192-ctr is not available.
  INFO: aes256-cbc is not available.
  INFO: aes192-cbc is not available.
  INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
  INFO: diffie-hellman-group14-sha1 is not available.
  INFO: ecdh-sha2-nistp256 is not available.
  INFO: ecdh-sha2-nistp384 is not available.
  INFO: ecdh-sha2-nistp521 is not available.
  INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  INFO: ecdsa-sha2-nistp256 is not available.
  INFO: ecdsa-sha2-nistp384 is not available.
  INFO: ecdsa-sha2-nistp521 is not available.
  INFO: SSH_MSG_KEXINIT sent
  INFO: SSH_MSG_KEXINIT received
  INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
  INFO: kex: server: ssh-rsa
  INFO: kex: server: aes256-cbc,aes192-cbc
  INFO: kex: server: aes256-cbc,aes192-cbc
  INFO: kex: server: hmac-sha1,hmac-sha1-96
  INFO: kex: server: hmac-sha1,hmac-sha1-96
  INFO: kex: server: none
  INFO: kex: server: none
  INFO: kex: server: 
  INFO: kex: server: 
  INFO: kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
  INFO: kex: client: ssh-rsa,ssh-dss
  INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
  INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-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 ftp.servername port 22
  com.jcraft.jsch.JSchException: Algorithm negotiation fail
  </code></pre>