com.maverick.ssh1
Class Ssh1Context

java.lang.Object
  extended bycom.maverick.ssh1.Ssh1Context
All Implemented Interfaces:
SshContext

public final class Ssh1Context
extends java.lang.Object
implements SshContext

This class implements SshContext to provide SSH1 connection configuration through the SshConnector class. Currently this provides only one additional feature which is to set the preferred cipher type, however there is currently only one cipher algorithm supported so this feature is reserved for future use. To configure the SSH1 context use the following code:

SshConnector con = SshConnector.getInstance(); Ssh1Context context = (Ssh1Context) con.getContext(SshConnector.SSH1); context.setCipherType(Ssh1Context.CIPHER_3DES);

Author:
Lee David Painter

Field Summary
static int CIPHER_3DES
          Currently the one and only cipher type supported
static int CIPHER_DES
           
 
Constructor Summary
Ssh1Context()
          Construct a new context instance with default values.
 
Method Summary
 int getChannelLimit()
          Get the maximum number of channels that are allowed open at any one time.
 int getCipherType(int supportedCiphers)
          Get the cipher type for this configuration context.
 HostKeyVerification getHostKeyVerification()
          Get the host key verification implementation.
 java.lang.String getSFTPProvider()
          Get the path to the SFTP provider.
 byte[] getX11AuthenticationCookie()
          Get a fake random cookie for X11 authentication
 java.lang.String getX11Display()
          Get the currently configured XDisplay setting which will be null if no display is currently set.
 byte[] getX11RealCookie()
          Get the real X11 authentication cookie, if not cookie has been set the fake cookie will be returned.
 ForwardingRequestListener getX11RequestListener()
          Get the X11 forwarding request listener.
 void setChannelLimit(int maxChannels)
          Set the maximum number of channels that are allowed open at any one time.
 void setCipherType(int preferredCipher)
          Set the cipher type for this configuration context.
 void setHostKeyVerification(HostKeyVerification verify)
          Set the host key verification implementation.
 void setSFTPProvider(java.lang.String sftp_path)
          Set the path to the SFTP provider.
 void setX11Display(java.lang.String xDisplay)
          Set the DISPLAY variable for the SSH connection.
 void setX11RealCookie(byte[] x11RealCookie)
          Sets the real X11 authentication cookie which can be obtained from the users $HOME/.Xauthority file.
 void setX11RequestListener(ForwardingRequestListener x11Listener)
          Set the listener to which X11 forwarding requests will be processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CIPHER_DES

public static final int CIPHER_DES
See Also:
Constant Field Values

CIPHER_3DES

public static final int CIPHER_3DES
Currently the one and only cipher type supported

See Also:
Constant Field Values
Constructor Detail

Ssh1Context

public Ssh1Context()
Construct a new context instance with default values.

Method Detail

setChannelLimit

public void setChannelLimit(int maxChannels)
Description copied from interface: SshContext
Set the maximum number of channels that are allowed open at any one time.

Specified by:
setChannelLimit in interface SshContext
Parameters:
maxChannels -

getChannelLimit

public int getChannelLimit()
Description copied from interface: SshContext
Get the maximum number of channels that are allowed open at any one time.

Specified by:
getChannelLimit in interface SshContext
Returns:
the maximum number of channels

setSFTPProvider

public void setSFTPProvider(java.lang.String sftp_path)
Description copied from interface: SshContext
Set the path to the SFTP provider. For SSH1 connections an attempt to execute this provider will be made as SSH1 does not support subsystems. For SSH2 connections an attempt will be made to execute this provider if the subsystem cannot be started.

Specified by:
setSFTPProvider in interface SshContext
Parameters:
sftp_path -

getSFTPProvider

public java.lang.String getSFTPProvider()
Description copied from interface: SshContext
Get the path to the SFTP provider. For SSH1 connections an attempt to execute this provider will be made as SSH1 does not support subsystems. For SSH2 connections an attempt will be made to execute this provider if the subsystem cannot be started. The default is '/usr/libexec/sftp-server'

Specified by:
getSFTPProvider in interface SshContext
Returns:

setX11Display

public void setX11Display(java.lang.String xDisplay)
Description copied from interface: SshContext
Set the DISPLAY variable for the SSH connection. If this is set the SSH sessions will have their DISPLAY variable set and X sessions will be forwarded over the SSH connection to the display specified.

Specified by:
setX11Display in interface SshContext
Parameters:
xDisplay - the display in the form localhost:1

getX11Display

public java.lang.String getX11Display()
Description copied from interface: SshContext
Get the currently configured XDisplay setting which will be null if no display is currently set.

Specified by:
getX11Display in interface SshContext
Returns:

getX11AuthenticationCookie

public byte[] getX11AuthenticationCookie()
Description copied from interface: SshContext
Get a fake random cookie for X11 authentication

Specified by:
getX11AuthenticationCookie in interface SshContext
Returns:

setX11RealCookie

public void setX11RealCookie(byte[] x11RealCookie)
Description copied from interface: SshContext
Sets the real X11 authentication cookie which can be obtained from the users $HOME/.Xauthority file.

Specified by:
setX11RealCookie in interface SshContext
Parameters:
x11RealCookie -

getX11RealCookie

public byte[] getX11RealCookie()
Description copied from interface: SshContext
Get the real X11 authentication cookie, if not cookie has been set the fake cookie will be returned.

Specified by:
getX11RealCookie in interface SshContext
Returns:

setX11RequestListener

public void setX11RequestListener(ForwardingRequestListener x11Listener)
Description copied from interface: SshContext
Set the listener to which X11 forwarding requests will be processed.

Specified by:
setX11RequestListener in interface SshContext
Parameters:
x11Listener -

getX11RequestListener

public ForwardingRequestListener getX11RequestListener()
Description copied from interface: SshContext
Get the X11 forwarding request listener.

Specified by:
getX11RequestListener in interface SshContext
Returns:

getCipherType

public int getCipherType(int supportedCiphers)
                  throws SshException
Get the cipher type for this configuration context.

Parameters:
supportedCiphers -
Returns:
one of the supported cipher types, for example CIPHER_3DES
Throws:
java.io.IOException
SshException

setCipherType

public void setCipherType(int preferredCipher)
Set the cipher type for this configuration context.

Parameters:
preferredCipher - one of the supported cipher types, for example CIPHER_3DES

setHostKeyVerification

public void setHostKeyVerification(HostKeyVerification verify)
Description copied from interface: SshContext
Set the host key verification implementation.

Specified by:
setHostKeyVerification in interface SshContext
Parameters:
verify -

getHostKeyVerification

public HostKeyVerification getHostKeyVerification()
Description copied from interface: SshContext
Get the host key verification implementation.

Specified by:
getHostKeyVerification in interface SshContext
Returns:
the current host key verification implementation


Copyright © 2003 3SP LTD. All Rights Reserved.