Hi Marc,

 

It may help if you post the full backtrace of the exception so we get an idea what kind of key algorithm is involved:

 

try {

                session.connect();

} catch(Throwable t) {

                t.printStackTrace();

}

 

 

Some more information about the kind of remote system may also help. For instance, using a Linux box do this:

 

$> sftp -vvv your.host.ip > debug .log

 

And debug.log will contain lots of information about the key exchange process:

 

OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 19: Applying options for *

debug2: ssh_connect: needpriv 0

[…]

 

Thanks,

Martin

--

Martin Oberhuber, SMTS / Product Owner – Development Tools, Wind River

direct +43.662.457915.85  fax +43.662.457915.6

 

From: Marc Logemann [mailto:marc.logemann@gmail.com]
Sent: Monday, July 28, 2014 6:18 PM
To: jsch-users@lists.sourceforge.net
Subject: [JSch-users] Jsch stopped working with Java8

 

Hi,

 

we are using JSch as transport mechanism for EDI data to a different company for about 7 years now. Today we upgraded to Java 8 and now when we try to connect, we get:

 

 Session.connect: java.security.InvalidKeyException: Key is too long for this algorithm

Currently we use: 

<dependency org="com.jcraft" name="jsch" rev="0.1.42"/>

Our code is like this..

Session session = jsch.getSession(sftpUser, sftpHost);
session.setPassword(sftpPassword);
UserInfo ui = new SFTPClientWrapper.MyUserInfo();
session.setUserInfo(ui);
session.connect();

 

So some questions arise :-)

1) will upgrade to latest version of JSch help me?

2) do you know the error in general? I dont have any clue because i dont do anything with keys. IMO its some kind of internal issue with java and JSch.

 

Thanks for any hints.

Marc