Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
8k views
in Java FTP by (500 points)
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!!!!!!!!!!!!!!!!!!!!!

3 Answers

0 votes
by (51.6k points)
Could you please post a log with the logging level set to ALL?

- Hans (EnterpriseDT)
0 votes
by (500 points)
Below is the output i view on the tomcat server:

testing sshftp 1
testing sshftp 2
testing sshftp 3
generation of key pairs
keygen
pair generated

Generating key/value pair using RSA algorithm
length of public key :162
file writer generated
data output stream
public key bytes
Private Key Format : PKCS8
Public Key Format : X509
Are both private keys equal? true
Are both public keys equal? true
RSA key pairs
set a remote port
authorized key :48
testing sshftp 4
host public key :com.enterprisedt.net.ftp.ssh.SSHFTPPublicKey@b25494ad
get enabled algorithm :[Lcom.enterprisedt.net.ftp.ssh.SSHFTPAlgorithm;@64dfeb
bit length :1023
algorithm type :Binary
host validation done
authentication successful

Kindly help me!!!!!!!!!!!!!!!
0 votes
by (162k points)
Here's how you get logging:

import com.enterprisedt.util.debug;

Logger.setLevel(Level.ALL);
Logger.addAppender(new FileAppender(myLogFileName));


Please email us a log file (support at enterprisedt dot com).

Also, please confirm that you can log in with ssh or another ssh client.

Categories

...