Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
15.9k views
in Java FTP by (500 points)
The loadknownhosts() returns me with this error :

Bad Base64 input character at 3: 64(decimal)


My application goes like this:-

sshftp = new SSHFTPClient( );
sshftp.setRemoteHost(ftpMachine);
sshftp.setRemotePort(22);
sshftp.getValidator().setHostValidationEnabled(true);
sshftpvalidator.addKnownHost(ftpMachine,"~/.ssh/id_rsa.pub");
sshftp.setAlgorithmEnabled(SSHFTPAlgorithm.KEY_RSA, true);
sshftpvalidator.loadKnownHosts("~/.ssh/id_rsa.pub");
sshftp.setAuthentication(ftpUsername,ftpPassword);
sshftp.connect();

My code stops after sshftp.setAlgorithmEnabled(SSHFTPAlgorithm.KEY_RSA, true); and throws the above error.
Kindly help me in resolving the issue as am unsure of the cause for the error.

11 Answers

0 votes
by (500 points)
i have used loadKnownHosts("~/.ssh/known_hosts) in my app.
This time its stopping after this method.

Below is the log:

INFO [com.hp.swmt.esdwh.sweet.sweetSSHFtpClient] 11 Sep 2008 06:34:21.481 : crea
ting sshftpclient
DEBUG [CryptixProperties] 11 Sep 2008 06:34:21.666 : Successfully loaded the Cry
ptixEDT properties file
ptixEDT properties file
INFO [puretls] 11 Sep 2008 06:34:21.679 : PureTLS debug level=0
DEBUG [com.enterprisedt.net.j2ssh.transport.cipher.SshCipherFactory] 11 Sep 2008
06:34:21.690 : Loading supported cipher algorithms
DEBUG [SshKeyExchangeFactory] 11 Sep 2008 06:34:21.711 : Loading key exchange me
thods
DEBUG [SshKeyExchangeFactory] 11 Sep 2008 06:34:21.727 : The default key exchang
e is not set! using first in list
DEBUG [com.enterprisedt.net.j2ssh.transport.publickey.SshKeyPairFactory] 11 Sep
2008 06:34:21.737 : Loading public key algorithms
DEBUG [ConfigurationLoader] 11 Sep 2008 06:34:21.777 : Security provider 0: SUN
DEBUG [ConfigurationLoader] 11 Sep 2008 06:34:21.777 : Security provider 1: SunJ
SSE
DEBUG [ConfigurationLoader] 11 Sep 2008 06:34:21.777 : Security provider 2: SunR
saSign
DEBUG [ConfigurationLoader] 11 Sep 2008 06:34:21.778 : Security provider 3: SunJ
CE
DEBUG [ConfigurationLoader] 11 Sep 2008 06:34:21.786 : Security provider 4: SunJ
@
DEBUG [ConfigurationLoader] 11 Sep 2008 06:34:21.787 : Security provider 5: Cryp
tixEDT
DEBUG [com.enterprisedt.net.j2ssh.transport.publickey.SshKeyPairFactory] 11 Sep
2008 06:34:21.787 : The default public key is not set! using first in list
DEBUG [SshCompressionFactory] 11 Sep 2008 06:34:21.792 : Loading compression met
hods
DEBUG [SshCompressionFactory] 11 Sep 2008 06:34:21.792 : Installed none compress
ion
DEBUG [SshCompressionFactory] 11 Sep 2008 06:34:21.798 : Installed zlib compress
ion
DEBUG [SshHmacFactory] 11 Sep 2008 06:34:21.802 : Loading message authentication
methods
INFO [LicensePropertiesBase] 11 Sep 2008 06:34:21.888 : Licence expiry date: 31
Dec 9999
INFO [LicensePropertiesBase] 11 Sep 2008 06:34:21.889 : Production licence
DEBUG [SSHFTPClient] 11 Sep 2008 06:34:21.893 : Class: com.enterprisedt.net.ftp.
ssh.SSHFTPClient
Version: 1.5.4
Build timestamp: 15-Aug-2007 15:08:20 EST
Java version: 1.4.2.10
CLASSPATH: /opt/java1.4/lib/tools.jar:/opt/hpws/tomcat/bin/bootstrap.jar
OS name: HP-UX
OS arch: PA_RISC2.0
OS version: B.11.23
DEBUG [SSHFTPClient] 11 Sep 2008 06:34:21.893 : Created SFTP client.
validator
testing sshftp 4
INFO [com.hp.swmt.esdwh.sweet.sweetSSHFtpClient] 11 Sep 2008 06:34:21.894 : sett
ing remote host
set a remote port
DEBUG [SSHFTPClient] 11 Sep 2008 06:34:21.894 : Disabling all algorithms of type
3
DEBUG [SSHFTPClient] 11 Sep 2008 06:34:21.900 : Enabling Key-pair algorithm ssh-
rsa
INFO [com.hp.swmt.esdwh.sweet.sweetSSHFtpClient] 11 Sep 2008 06:34:21.900 : addi
ng known hosts
DEBUG [SSHFTPValidator] 11 Sep 2008 06:34:21.900 : Loading known hosts file /hom
e/www/.ssh/known_hosts



The known_hosts contents are :-

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAoi7JGe+QHTCnnZy1V5ZfqmLChtpXzzPbk9D+RM7N3OdL
thOSejaHZjO7MUsqVFTyFruNpZHke/LPwT98kW/Jz5CKpZnX6PQ7yH0DvkmpHURcSZ2+4oyf9DskQNhs
FW//2PCVoutAgh3U50ce3rAQTan7KINdxUVh9eDk7cMpS0c= mohapatr@devlserv

Where am I going wrong???

Categories

...