[JSch-users] java.security.NoSuchAlgorithmException: DH KeyPairGenerator not available
Status: Alpha
Brought to you by:
ymnk
|
From: Walter M. <wb...@fe...> - 2004-10-22 14:53:48
|
Hi,
I tried to use the Sftp example in my own code, for sending a file to a
remote server.
But I'm getting this error on the session.connect():
===
java.security.NoSuchAlgorithmException: DH KeyPairGenerator not available
java.lang.NullPointerException
at com.jcraft.jsch.jce.DH.getE(Unknown Source)
at com.jcraft.jsch.DHG1.init(Unknown Source)
at com.jcraft.jsch.Session.receive_kexinit(Unknown Source)
at com.jcraft.jsch.Session.connect(Unknown Source)
at com.jcraft.jsch.Session.connect(Unknown Source)
at com.fedex.lac.itd.io.Sftp.session(Sftp.java:80)
at com.fedex.lac.itd.io.Sftp.main(Sftp.java:53)
======
This is the relevant code:
====
public boolean session(String cmd, String host, int port, String user,
String pass,
String filename, String remotedir) throws
IOException,
UnknownHostException, IllegalArgumentException
{
try {
JSch jsch=new JSch();
// make the connection and login
session=jsch.getSession(user, host, port);
session.setPassword(pass);
session.connect(); // IT DIES HERE
// now open a channel with sftp as the protocol
Channel channel=session.openChannel("sftp");
channel.connect();
csftp=(ChannelSftp)channel;
// now, we need to change dir
if (remotedir.length() > 0)
{
csftp.lcd(remotedir);
}
// only one way to transmit data - binary
if (cmd.equals("put"))
{
sendFile(filename);
} else
{
getFile(filename);
}
// now we need to disconnect
session.disconnect();
}
catch(SftpException e){
System.out.println(e.message);
e.printStackTrace();
return false;
}
catch(Exception e){
System.out.println(e);
e.printStackTrace();
return false;
}
=====
What am I missing?
thanks,
Walter
|