I get an error trying to connect to OpenSSH on Windows.
I used the sample program in Ex6_SFTPClient and it works.
I have the jar files loaded in the class path, but do I need all of the other files, the keys and such. The reason I ask is because in the sample program, I renambed all of the files except for the .class and .bat file, and it still ran with no problems (I guess because host validation is off?)
The IOException error I'm getting is: RSA KeyFactory not available
Here's the code:
public boolean connect(String sServer, String sUserName, String sPassword)
{
try
{
// set remote host
ftp.setRemoteHost( sServer);
System.out.println( " Setting user-name and password");
ftp.setAuthentication( sUserName, sPassword);
System.out.println( " Turning off server validation");
ftp.getValidator().setHostValidationEnabled( false);
// connect to the server
System.out.println( " Connecting to server");
ftp.connect();
bConnected = true;
return true;
}
catch(FTPException ex)
{
System.out.println( "FTPError Connecting. " + ex.getMessage());
}
catch(IOException ex)
{
System.out.println( "IOError Connecting. " + ex.getMessage());
}
return false;
}