i am using webservices to connect to the sshftp,i have a sshftpclient class where i am implementing methods to establish the connection.
The piece of code is as follows:
sshftp = new SSHFTPClient( );
sshftp.setRemoteHost(props.getProperty("ftpMachine"));
sshftp.setRemotePort(22);
System.out.println("set a remote port");
// Turn off server validation (ONLY do this when testing)
sshftp.getValidator().setHostValidationEnabled(true);
String str = sshftp.getRemoteHost();
com.enterprisedt.net.ftp.ssh.SSHFTPPublicKey str1 = sshftp.getHostPublicKey(str);
System.out.println("host public key :" +str1);
sshftp.disableAllAlgorithms(SSHFTPAlgorithm.KEY_PAIR);
sshftp.setAlgorithmEnabled(SSHFTPAlgorithm.KEY_DSA, true);
System.out.println("get enabled algorithm :" +sshftp.getEnabledAlgorithms());
System.out.println("bit length :" +str1.getBitLength());
System.out.println("algorithm type :" +sshftp.getType());
sshftp.getValidator().addKnownHost("devlserv.cup.hp.com","/home/mohapatr/publickeyfile/file1.pub");
System.out.println("loading known hosts");
sshftp.setAuthentication("/home/mohapatr/publickeyfile/file1",props.getProperty("ftpUsername"),"Libra04");
System.out.println("authentication successful");
sshftp.setTimeout(60000); // "Gimme a minute!" hehe
// connect to the server
sshftp.connect();
When i run this through a client code which invokes the sshftpclient on the server side i get the ERROR!!! as
The host signature is invalid or the host key was not accepted!
on the server.
changing the addKnownHost() to
sshftp.getValidator().loadKnownHosts("/home/mohapatr/publickeyfile/file1.pub");
i get a ERROR!! as
Bad Base64 input character at 10: 64(decimal)
again on the server side....
This is a public key i generated using ssh-keygen
file1.pub:-
ssh-dss AAAAB3NzaC1kc3MAAACBAPjXY3x4W+VNi0w3FAMuJyfLYmxeL+S0MSauT7uw/HGZaKAoLu1i
ZLt3GAI3UaHroCb4cj6FB3QNA9vtelcSB1XwKWOvX1YCqbMh0NGYoWaE8I/8vUfVvvx/npARfRVgYAki
XKj/jB/R56TobaqMamHx0vcRFXjfy7Ot/eH6v+ozAAAAFQC0eEku2m7fjXo1kyNdHBqGpLhcNQAAAIAJ
3FguXRswHIzQ1X4i+yBiksZ6FLUyh84tTHfs70vWNz8A+TMGzik3dEfdWrmI6on4pamm3rbZCfYrZSwL
iHyC3JRsKm+XU+cjWYILv5WgIcAxmq8Pyl8QskEOKHmoXMrZPUa4+e3vq0oiZU1gAn4JjlYKUkaCZoCN
jeC6m6loxAAAAIBu9e+9t4A9nl63wArGxWxtJ7l5BmKOqGk4lnfvAGwjybpr0KeZnUjArMXbrAOgbDWU
M9dt0VewGGzVdQT9IcAcHa8M4lbR4cJEVKYu8FWpy8yzc1kc+rKUwtHnY0OTik/5PgEkoKri+nyff+V+
qfjjHu90m/a3MORZ9r1rBJKixg==
SHARMISTHA@shell.sf.net
Anything else you require????
Kindly help me.....................