com.enterprisedt.net.ftp
Class AdvancedSSHSettings

java.lang.Object
  extended by com.enterprisedt.net.ftp.AdvancedSSHSettings

public class AdvancedSSHSettings
extends java.lang.Object

Advanced settings specifically for the SFTP (FTP over SSH) protocol. Generally these settings are not required for basic use of the protocol.

All settings must be set before connecting to the server.

Version:
$Revision: 1.3 $
Author:
Bruce Blackshaw

Method Summary
 void disableAllAlgorithms()
          Disables all algorithms.
 void disableAllAlgorithms(int algorithmType)
          Disables all algorithms of a particular type.
 SSHAuthenticationType getAuthenticationType()
          Get the type of authentication that is set up to be used.
 SSHFTPAlgorithm[] getEnabledAlgorithms()
          Returns an array containing all enabled algorithms (of all types).
 SSHFTPAlgorithm[] getEnabledAlgorithms(int algorithmType)
          Returns an array containing all enabled algorithms of a particular type.
 int getMaxPacketSize()
          Get the max packet size set
 java.lang.String getPrivateKeyFile()
          Get the path to the client's private key file, used for client authentication if SSHAuthenticationType.PUBLIC_KEY is being used.
 java.lang.String getPrivateKeyFilePassphrase()
          Get the passphrase for the private key file.
 SSHAuthPrompt[] getSSHAuthPrompts()
          Get the array of authentication prompts that are to be used for keyboard-interactive authentication.
 SSHFTPValidator getSSHServerValidator()
          Returns a reference to the host validator, which validates the server's public key.
 boolean isDisableWaitForChannelClose()
          Is waiting for server acknowledge on closure of a channel disabled?
 void setAlgorithmEnabled(SSHFTPAlgorithm algorithm, boolean enable)
          Enable/disable the given algorithm.
 void setAuthenticationType(SSHAuthenticationType sshAuthenticationType)
          Set the authentication type to be used.
 void setDisableWaitForChannelClose(boolean disableWaitForChannelClose)
          Disables waiting for an acknowledgement from the server when the client has requested that a channel be closed.
 void setMaxPacketSize(int maxPacketSize)
          Set the maximum packet size.
 void setPrivateKeyFile(java.lang.String privateKeyFile)
          Set the path to the client's private key file, used for client authentication if SSHAuthenticationType.PUBLIC_KEY is being used.
 void setPrivateKeyFilePassphrase(java.lang.String privateKeyFilePassphrase)
          Set the passphrase for the private key file.
 void setSSHAuthPrompts(SSHAuthPrompt[] authPrompts)
          Set the array of authentication prompts that are to be used for keyboard-interactive authentication.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSSHServerValidator

public SSHFTPValidator getSSHServerValidator()
Returns a reference to the host validator, which validates the server's public key.

Returns:
Returns the host validator.

isDisableWaitForChannelClose

public boolean isDisableWaitForChannelClose()
Is waiting for server acknowledge on closure of a channel disabled?

Returns:
true if disabled, false otherwise

setDisableWaitForChannelClose

public void setDisableWaitForChannelClose(boolean disableWaitForChannelClose)
                                   throws FTPException
Disables waiting for an acknowledgement from the server when the client has requested that a channel be closed.

Parameters:
disableWaitForChannelClose - true to disable the wait
Throws:
FTPException

getPrivateKeyFile

public java.lang.String getPrivateKeyFile()
Get the path to the client's private key file, used for client authentication if SSHAuthenticationType.PUBLIC_KEY is being used.

Returns:
path to file, or null if not set

setPrivateKeyFile

public void setPrivateKeyFile(java.lang.String privateKeyFile)
                       throws FTPException
Set the path to the client's private key file, used for client authentication if SSHAuthenticationType.PUBLIC_KEY is being used.

Parameters:
privateKeyFile - path to file
Throws:
FTPException

getPrivateKeyFilePassphrase

public java.lang.String getPrivateKeyFilePassphrase()
Get the passphrase for the private key file.

Returns:
passphrase

setPrivateKeyFilePassphrase

public void setPrivateKeyFilePassphrase(java.lang.String privateKeyFilePassphrase)
                                 throws FTPException
Set the passphrase for the private key file.

Parameters:
privateKeyFilePassphrase - passphrase to set
Throws:
FTPException

getEnabledAlgorithms

public SSHFTPAlgorithm[] getEnabledAlgorithms()
Returns an array containing all enabled algorithms (of all types).

Returns:
An array of all enabled algorithms.

getEnabledAlgorithms

public SSHFTPAlgorithm[] getEnabledAlgorithms(int algorithmType)
                                       throws SSHFTPException
Returns an array containing all enabled algorithms of a particular type.

Parameters:
algorithmType - Type of algorithms to return (See SSHFTPAlgorithm).
Returns:
An array of all enabled algorithms of the given type.
Throws:
SSHFTPException - Thrown if the given algorithm-type is invalid.

disableAllAlgorithms

public void disableAllAlgorithms(int algorithmType)
                          throws FTPException
Disables all algorithms of a particular type. Note that one algorithm of each type must be enabled before you can connect to a server.

Parameters:
algorithmType - Type of algorithms to return (See SSHFTPAlgorithm).
Throws:
FTPException

disableAllAlgorithms

public void disableAllAlgorithms()
                          throws FTPException
Disables all algorithms. Note that one algorithm of each type must be enabled before you can connect to a server.

Throws:
FTPException

setAlgorithmEnabled

public void setAlgorithmEnabled(SSHFTPAlgorithm algorithm,
                                boolean enable)
                         throws FTPException
Enable/disable the given algorithm.

Parameters:
algorithm - Algorithm to enable/disable.
enable - Flag indicating whether the algorithm should be enabled or disabled.
Throws:
FTPException

getMaxPacketSize

public int getMaxPacketSize()
Get the max packet size set

Returns:
-1 if not set, or else the set size

setMaxPacketSize

public void setMaxPacketSize(int maxPacketSize)
                      throws FTPException
Set the maximum packet size. This should be used if errors are being received such as "packet too long: xxxx". Set the size smaller than the size listed in the error message.

Parameters:
maxPacketSize - size to set
Throws:
FTPException

getAuthenticationType

public SSHAuthenticationType getAuthenticationType()
Get the type of authentication that is set up to be used.

Returns:
SSHAuthenticationType

setAuthenticationType

public void setAuthenticationType(SSHAuthenticationType sshAuthenticationType)
                           throws FTPException
Set the authentication type to be used. Different fields need to be set depending on the type use, e.g. SSHAuthenticationType.PUBLIC_KEY requires the client's private key and passphrase to be set.

Parameters:
sshAuthenticationType - authentication type to be used
Throws:
FTPException

getSSHAuthPrompts

public SSHAuthPrompt[] getSSHAuthPrompts()
Get the array of authentication prompts that are to be used for keyboard-interactive authentication.

Returns:
array of prompts

setSSHAuthPrompts

public void setSSHAuthPrompts(SSHAuthPrompt[] authPrompts)
                       throws FTPException
Set the array of authentication prompts that are to be used for keyboard-interactive authentication.

Parameters:
authPrompts - prompts to set up
Throws:
FTPException


Copyright © 2001-2006 Enterprise Distributed Technologies Ltd. All Rights Reserved.