Hello,
for an automated installation, I have a private key stored in a
database instead of on filesystem and I'm trying to make Jsch use this
key to connect. I found the Method
Jsch.addIdentity(String,byte[],byte[],byte[]) when browsing the source,
but for some strange reason I can not use it. It always gives me
NoSuchMethodException. Maybe I just didnt the method right, but i guess
it's what i am looking for.
I'm using the latest Jar-File from the homepage (jsch-0.1.43.jar) along
with Eclipse 3.6.0 Helios.
This is what I am trying to do:
----------------
public SshConnection(String host, String user, String password,
String key){
try {
jsch = new JSch();
session = jsch.getSession(user,host,22);
jsch.addIdentity(user, key.getBytes(), "".getBytes(),
password.getBytes());
session.setUserInfo(new MyUserInfo());
session.connect();
}
catch (Exception ee) {ee.printStackTrace();}
}
------------------------
and this is the error message I get:
--------------
Throwable: java.lang.NoSuchMethodError
message:com.jcraft.jsch.JSch.addIdentity(Ljava/lang/String;[B[B[B)V,java.lang.NoSuchMethodError
at de.unikiel.svn.SshConnection.(SshConnection.java:20)
-----------------
Does anyone see what I'm missing? Or has another idea on how to
accomplish my goal?
Chris-Werner Reimer
PS: the "String key" parameter above contains the key as a String,
(-----BEGIN RSA PRIVATE KEY ---- ....)
<https://sourceforge.net/projects/jsch/files/jsch/jsch-0.1.43.jar/download>
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users