Discuss (FTP) and (SFTP, FTPS and SCP), our Java file transfer clients.
no avatar
User

rozanalitasy

Posts

12

Joined

Sat Jun 28, 2008 12:25 am

Bad Base64 input character at 3: 64(decimal)

by rozanalitasy » Fri Sep 05, 2008 7:01 pm

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.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Bad Base64 input character at 3: 64(decimal)

by support2 » Fri Sep 05, 2008 9:50 pm

You aren't loading a known_hosts file. It is a different format to id_rsa.pub, which is a public key file.

Using addKnownHost(ftpMachine,"~/.ssh/id_rsa.pub") is sufficient (it is an alternative), you don't need to call loadKnownHosts().
no avatar
User

rozanalitasy

Posts

12

Joined

Sat Jun 28, 2008 12:25 am

by rozanalitasy » Mon Sep 08, 2008 3:58 pm

I already tried doing that as you have asked me to use either
addKnownHost(ftpMachine,"~/.ssh/id_rsa.pub") or loadKnownHosts().

I did it again by removing the loadKnownHosts() from my apps but it returns me the error saying

The host signature is invalid or the host key was not accepted!

Where am i going wrong???

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

Its not able to invoke the connect().

HELP ME!!!!!!!!!!!!!!
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Mon Sep 08, 2008 8:19 pm

Please create a log file at the ALL level and email it (zipped up) to support at enterprisedt dot com.

See the Dev Guide for creating a log file
no avatar
User

rozanalitasy

Posts

12

Joined

Sat Jun 28, 2008 12:25 am

The host signature is invalid or the host key was not accept

by rozanalitasy » Tue Sep 09, 2008 4:28 pm

As discussed earlier i am facing the problem of

The host signature is invalid or the host key was not accepted!

My apps is as follows:-

log.info("Creating SFTP client");
sshftp = new SSHFTPClient( );

sshftp.setRemoteHost(props.getProperty("ftpMachine"));

sshftp.setRemotePort(22);
System.out.println("set a remote port");

log.info("host validation enabled");
sshftp.getValidator().setHostValidationEnabled(true);
System.out.println("host validation done");

log.info("adding known hosts");
sshftpvalidator.addKnownHost(ftpMachine,"~/.ssh/id_rsa.pub");
System.out.println("adding known hosts");

log.info("Setting user-name and password");
sshftp.setAuthentication(ftpUsername,ftpPassword);
System.out.println("authentication successful");

sshftp.setTimeout(60000);
sshftp.connect();

And the error is as follows:-


INFO [com.hp.swmt.esdwh.sweet.sweetSSHFtpClient] 8 Sep 2008 22:59:23.785 : Creat
ing SFTP client
INFO [puretls] 8 Sep 2008 22:59:24.161 : PureTLS debug level=0
INFO [LicensePropertiesBase] 8 Sep 2008 22:59:24.363 : Licence expiry date: 31 D
ec 9999
INFO [LicensePropertiesBase] 8 Sep 2008 22:59:24.363 : Production licence
set a remote port
testing sshftp 4
INFO [com.hp.swmt.esdwh.sweet.sweetSSHFtpClient] 8 Sep 2008 22:59:24.368 : host
validation enabled
host validation done
INFO [com.hp.swmt.esdwh.sweet.sweetSSHFtpClient] 8 Sep 2008 22:59:24.368 : addin
g known hosts
adding known hosts
INFO [com.hp.swmt.esdwh.sweet.sweetSSHFtpClient] 8 Sep 2008 22:59:24.426 : Setti
ng user-name and password
authentication successful
INFO [SSHFTPClient] 8 Sep 2008 22:59:24.451 : SSHFTPClient settings validated.
INFO [TransportProtocolCommon] 8 Sep 2008 22:59:24.635 : Timeout=60000
INFO [TransportProtocolCommon] 8 Sep 2008 22:59:24.643 : Wait for state update t
INFO [TransportProtocolCommon] 8 Sep 2008 22:59:24.644 : Wait for state update t
INFO [cryptix] 8 Sep 2008 22:59:24.708 : GLOBAL_TRACE=false
INFO [cryptix] 8 Sep 2008 22:59:24.708 : GLOBAL_DEBUG=false
INFO [cryptix] 8 Sep 2008 22:59:24.708 : GLOBAL_DEBUG_SLOW=false
INFO [TransportProtocolCommon] 8 Sep 2008 22:59:24.731 : Wait for state update t
INFO [DhGroup1Sha1] 8 Sep 2008 22:59:24.740 : Starting client side key exchange.
ERROR [TransportProtocolOutputStream] 8 Sep 2008 22:59:25.49 : sendMessage() fai
ERROR [TransportProtocolOutputStream] 8 Sep 2008 22:59:25.50 : sendMessage() fai
ERROR [TransportProtocolCommon] 8 Sep 2008 22:59:25.242 : The Transport Protocol
java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:134)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
@ at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
at com.enterprisedt.net.j2ssh.transport.A.A(Unknown Source)

at java.net.SocketInputStream.socketRead0(Native Method)


at java.io.BufferedInputStream.read(BufferedInputStream.java:277)



Kindly let me know what can i do to resolve this issue....
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: The host signature is invalid or the host key was not ac

by support2 » Tue Sep 09, 2008 8:47 pm

We need an entire log file set to ALL level emailed to us please - the log above is not sufficient.

It would be very helpful if you also emailed a similar log file with sshftp.getValidator().setHostValidationEnabled(false);
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: The host signature is invalid or the host key was not ac

by support2 » Tue Sep 09, 2008 9:53 pm

Just thinking about this problem a bit more, are you sure that you are using the *server's* public key here?

There's a pretty good chance that ~/.ssh/id_rsa.pub is actually *your* public key, not the server's - they are completely different.

If you do have a known_hosts file available, please try that via loadKnownHosts() rather than using addKnownHost().
no avatar
User

rozanalitasy

Posts

12

Joined

Sat Jun 28, 2008 12:25 am

The Transport Protocol thread failed : Socket closed

by rozanalitasy » Wed Sep 10, 2008 7:18 pm

Well first let me inform you with a piece of info that i am using the version 2.0.0 and am trying to enable
sshftp.getValidator().setHostValidationEnabled(false) i.e.,

sshftp.getValidator().setHostValidationEnabled(true) in my apps.

i have generated the public keys through

ssh-keygen -t RSA

followed by performing the copying and pasting of the keys at the client's authorized_keys.

I even want to inform you that everything goes fine when i do it practically over the server prompts.

But my apps stops with the error which exactly tries to do the same.

Now because my public key is already available at both the places (server & client) i was using
addKnownHosts(ftpMachine,"~/.ssh/id_rsa.pub").

My apps requirement is to only have known and authorized users to access SSHFTP and so we are generating the keys outside the app and not through the apps.

I am still stuck at the place with the log i previously posted.

I have no issues with
sshftp.getValidator().setHostValidationEnabled(false);

Kindly let me know if i am missing something somewhere.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: The Transport Protocol thread failed : Socket closed

by support2 » Wed Sep 10, 2008 7:31 pm

addKnownHosts() requires the SERVER'S public key.

It looks to me like you are using the CLIENT'S public key with addKnownHosts(). This WON"T WORK. They have absolutely nothing in common.

You need a copy of the SERVER'S public key here.

The best place to get it is normally in a file called known_hosts.

That's why loadKnownHosts() is normally used to load the known_hosts file.
no avatar
User

rozanalitasy

Posts

12

Joined

Sat Jun 28, 2008 12:25 am

The Transport Protocol thread failed : Socket closed

by rozanalitasy » Wed Sep 10, 2008 11:21 pm

I tried doing the way you mentioned in your reply i.e.; by changing the keys

If i am using loadKnownHosts(hostfile) it gives me

Bad Base64 input character at 3: 64(decimal) error

And if i change it to addKnownHost(ftpmachine,"~/.ssh/id_rsa.pub)

it gives me the The Transport Protocol thread failed : Socket closed error

I am not sure as what should be done.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: The Transport Protocol thread failed : Socket closed

by support2 » Thu Sep 11, 2008 7:05 am

Are you using loadKnownHosts("~/.ssh/known_hosts")?

If so and you are still getting an error, please email us the known_hosts file and the log file set to the ALL level.
no avatar
User

rozanalitasy

Posts

12

Joined

Sat Jun 28, 2008 12:25 am

Null

by rozanalitasy » Fri Sep 12, 2008 12:04 am

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???

Who is online

Users browsing this forum: No registered users and 14 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign