• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jsch Passphrase Query

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use com.jcraft.jsch.KeyPair.setPassphrase()?
 
Jiss Elizabeth
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic