Package fr.ifremer.isisfish.util.ssh
Class SSHAgent
java.lang.Object
fr.ifremer.isisfish.util.ssh.SSHAgent
Isis SSH agent.
This class centralize, ssh key and passphrase
management.
This is a singleton class.
- Version:
- $Revision$ Last update : $Date$ By : $Author$
- Author:
- chatellier
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.jcraft.jsch.JSchJSSch instance.Passphrase associated to key file path. -
Method Summary
Modifier and TypeMethodDescriptionstatic SSHAgentgetAgent()Get agent instance.char[]getPassphrase(File privatekeyFile) Get passphrase for key.char[]getPassphrase(String privatekeyFile) Get passphrase for key.protected static byte[]toBytes(char[] chars) Transform char array to byte array without creating String instance.
-
Field Details
-
jsch
protected com.jcraft.jsch.JSch jschJSSch instance. -
passphraseForKeys
Passphrase associated to key file path. private key file path =< passphrase. Ensure that passphrase are valid before add into.
-
-
Method Details
-
getAgent
Get agent instance.- Returns:
- agent
-
getPassphrase
Get passphrase for key.- Parameters:
privatekeyFile- private key file- Returns:
nullif there is no passphrase- Throws:
InvalidPassphraseException- if user cancel authentication
-
getPassphrase
Get passphrase for key.- Parameters:
privatekeyFile- private key file path- Returns:
nullif there is no passphrase- Throws:
InvalidPassphraseException- if user cancel authentication
-
toBytes
protected static byte[] toBytes(char[] chars) Transform char array to byte array without creating String instance. see http://stackoverflow.com/a/9670279/2038100 for details- Parameters:
chars- char array- Returns:
- byte array
-