aspose file tools*
The moose likes Security and the fly likes Jsch Passphrase Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Jsch Passphrase Query" Watch "Jsch Passphrase Query" New topic
Author

Jsch Passphrase Query

Jiss Elizabeth
Greenhorn

Joined: Jul 28, 2004
Posts: 19
Hi,

I am using Jsch and so far ssh worked great for my application. Now that i have added key chain and trying to log on to my server without password it is asking for passphrase which is already stored using ssh key agent. How can i make jsch read passphrase from the key file? Is there a way to do this. Would be great if you could help me out with this.

Thank You!

-- Jiss
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Use com.jcraft.jsch.KeyPair.setPassphrase()?


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Jiss Elizabeth
Greenhorn

Joined: Jul 28, 2004
Posts: 19
Hi,

I am using Mac 10.5. When i open a terminal and ssh to my server it directly logs on to server without asking me for the passphrase as it is added in Mac's Key Chain. But when i run my application which uses jsch it always prompts for the passphrase. This is my code.

JSch jsch = new JSch();
jsch.addIdentity(x.getKeyChainPath());
session = jsch.getSession(x.getUsername(), hostname, port);
session.setPassword(remoteData.getPassword());
localUserInfo lui = new localUserInfo();
session.setUserInfo(lui);
session.connect();

How i can i make jsch read passphrase from keychain?

Thank You!
--Jiss
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

I'm not sure if Jsch can work with ssh-agent. It's been a while since the last time I used Jsch. BTW, there is a method jsch.addIdentity(String privateKey, String passphrase). Why don't you use that instead?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jsch Passphrase Query
 
Similar Threads
How to avoid storing rsa passphrase
SSH Public Key Authentication
Java remote paths
Ant checkout CVS using SSH
Can't connect to ssh server using jsch or sshtools -- OpenSSL misconfiguration or coding error?