fr.ifremer.isisfish.util.ssh
Class SSHAgent

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

public class SSHAgent
extends java.lang.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  java.util.Map<java.lang.String,java.lang.String> passphraseForKeys
          Passphrase associated to key file path.
 
Method Summary
protected  java.lang.String askPassphrase(java.lang.String privatekeyFile, java.lang.String message)
          Ask for passphrase.
static SSHAgent getAgent()
          Get agent instance.
 java.lang.String getPassphrase(java.io.File privatekeyFile)
          Get passphrase for key.
 java.lang.String getPassphrase(java.lang.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 java.util.Map<java.lang.String,java.lang.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 java.lang.String getPassphrase(java.io.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 java.lang.String getPassphrase(java.lang.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 java.lang.String askPassphrase(java.lang.String privatekeyFile,
                                         java.lang.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.