I am programmatically generating the key pairs,copying the public key to a file authorized_keys......everything works fine...it stops working only when it has to perform the connect().
I am attaching here the piece of code...........help is needed to recolve this................Kindly help :cry:
sshftp = new SSHFTPClient( );
SSHFTPValidator sshftpvalidator = new SSHFTPValidator();
sshftp.setRemoteHost(props.getProperty("ftpMachine"));
sshftp.setRemotePort(22);
String str = sshftp.getRemoteHost();
FileInputStream fispub = new FileInputStream(authorized_keys file path);
DataInputStream d = new DataInputStream(fispub);
System.out.println("authorized key :" +d.read());
d.close();
sshftp.getValidator().setHostValidationEnabled(true);
System.out.println("host validation done");
sshftpvalidator.addKnownHost(hostname,public key file path);
sshftp.setAuthentication(private key file path,username);
System.out.println("authentication successful");
sshftp.connect();
System.out.println("connected" +sshftp.connected());
System.out.println("connection done");
Correct me if am doing wrong!!!!!!!!!!!!!!!!!!!!!