I am trying to connect from a standalone SFTP client using jsch 0.1.36 to
an SFTP server and getting exceptions:
The key pair were created by some one else and it uses a passphrase. We are
able to login to the server via command prompt using the same key pair.
I have gone through the archive and spotted similar question but no
solution. I tried debugging through the source code but in vain. What i 
understand is that public key verification fails and therefore fails over to 
password. But i want public key auth to work. Can you please help on why this 
can happen?

Sample program;

       ChannelSftp sftpChannel = null;
           UserInfo userInfo = null;
           int TRY_ESTABLISH_CONNECTION = 10;
           String hosts_FileName = null;

            try
               {
                   jsch = new JSch();
                   jsch.setKnownHosts("C:\\.ssh\\known_hosts");
                   com.jcraft.jsch.Logger l = new myLogger();
                   JSch.setLogger(l);
                   session = jsch.getSession("***", "***", 22);
                   userInfo = new MyUserInfo();
                   session.setUserInfo(userInfo);
                   jsch.addIdentity("***", "***");
                   session.connect();
                   sftpChannel = (ChannelSftp)session.openChannel("sftp");
                   sftpChannel.connect();
                   sftpChannel.disconnect();
               }
        catch (Exception e) {
           e.printStackTrace();
       }


Detailed logging:
1 Connecting to 9.184.166.194 port 22
1 Connection established
1 Remote version string: SSH-2.0-WeOnlyDo 2.1.3
1 Local version string: SSH-2.0-JSCH-0.1.42
1 CheckCiphers:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
1 aes256-ctr is not available.
1 aes192-ctr is not available.
1 aes256-cbc is not available.
1 aes192-cbc is not available.
1 arcfour256 is not available.
1 SSH_MSG_KEXINIT sent
1 SSH_MSG_KEXINIT received
1 kex: server->client aes128-cbc hmac-md5 none
1 kex: client->server aes128-cbc hmac-md5 none
1 SSH_MSG_KEXDH_INIT sent
1 expecting SSH_MSG_KEXDH_REPLY
1 ssh_rsa_verify: signature true
1 Host '9.184.166.194' is known and mathces the RSA host key
1 SSH_MSG_NEWKEYS sent
1 SSH_MSG_NEWKEYS received
1 SSH_MSG_SERVICE_REQUEST sent
1 SSH_MSG_SERVICE_ACCEPT received
1 Authentications that can continue:
publickey,keyboard-interactive,password
1 Next authentication method: publickey
1 Authentications that can continue: password
1 Next authentication method: password
1 Disconnecting from 9.184.166.194 port 22
com.jcraft.jsch.JSchException: Auth cancel
   at com.jcraft.jsch.Session.connect(Session.java:451)
   at com.jcraft.jsch.Session.connect(Session.java:150)
   at com.ibm.j2ca.sftp.SimpleSFTP.main(SimpleSFTP.java:39)




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to