• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsch Passphrase Query

 
Jiss Elizabeth
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use com.jcraft.jsch.KeyPair.setPassphrase()?
 
Jiss Elizabeth
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic