fr.ifremer.isisfish.util.ssh
Class SSHAgent

java.lang.Object
  extended by fr.ifremer.isisfish.util.ssh.SSHAgent

public class SSHAgent
extends Object

Isis SSH agent. This class centralize, ssh key and passphrase management. This is a singleton class.

Version:
$Revision: 2705 $ Last update : $Date: 2009-10-27 18:50:23 +0100 (mar., 27 oct. 2009) $ By : $Author: chatellier $
Author:
chatellier

Field Summary
protected  com.jcraft.jsch.JSch jsch
          JSSch instance.
protected  Map<String,String> passphraseForKeys
          Passphrase associated to key file path.
 
Method Summary
protected  String askPassphrase(String privatekeyFile, String message)
          Ask for passphrase.
static SSHAgent getAgent()
          Get agent instance.
 String getPassphrase(File privatekeyFile)
          Get passphrase for key.
 String getPassphrase(String privatekeyFile)
          Get passphrase for key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jsch

protected com.jcraft.jsch.JSch jsch
JSSch instance.


passphraseForKeys

protected Map<String,String> passphraseForKeys
Passphrase associated to key file path. private key file path => passphrase. Ensure that passphrase are valid before add into.

Method Detail

getAgent

public static SSHAgent getAgent()
Get agent instance.

Returns:
agent

getPassphrase

public String getPassphrase(File privatekeyFile)
                     throws InvalidPassphraseException
Get passphrase for key.

Parameters:
privatekeyFile - private key file
Returns:
null if there is no passphrase
Throws:
InvalidPassphraseException - if user cancel authentication

getPassphrase

public String getPassphrase(String privatekeyFile)
                     throws InvalidPassphraseException
Get passphrase for key.

Parameters:
privatekeyFile - private key file path
Returns:
null if there is no passphrase
Throws:
InvalidPassphraseException - if user cancel authentication

askPassphrase

protected String askPassphrase(String privatekeyFile,
                               String message)
                        throws InvalidPassphraseException
Ask for passphrase.

Parameters:
privatekeyFile - private key file path
message - message
Returns:
entrered passphrase
Throws:
InvalidPassphraseException - if user cancel authentication


Copyright © 1999-2010 CodeLutin. All Rights Reserved.