public final class Ssh1Context extends 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);
Modifier and Type | Field and Description |
---|---|
static int |
CIPHER_3DES |
static int |
CIPHER_DES |
Constructor and Description |
---|
Ssh1Context()
Construct a new context instance with default values.
|
Modifier and Type | Method and Description |
---|---|
SshCipher |
createCipher(int cipherType) |
void |
enableFIPSMode()
Deprecated.
This method is out-of-date. Use JCEProvider.initializeDefaultProvider("BCFIPS") passing a FIPS approved JCE provider
in approved mode to restrict algorithms to only those supported by the approved FIPS environment.
|
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.
|
ExecutorService |
getExecutorService() |
HostKeyVerification |
getHostKeyVerification()
Get the host key verification implementation.
|
int |
getMessageTimeout() |
String |
getSFTPProvider()
Get the path to the SFTP provider.
|
byte[] |
getX11AuthenticationCookie()
Get a fake random cookie for X11 authentication
|
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.
|
boolean |
isSHA1SignaturesSupported()
Option to disable SHA1 signatures on RSA keys.
|
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 |
setExecutorService(ExecutorService executor) |
void |
setHostKeyVerification(HostKeyVerification verify)
Set the host key verification implementation.
|
void |
setMessageTimeout(int messageTimeout) |
void |
setSFTPProvider(String sftp_path)
Set the path to the SFTP provider.
|
void |
setSHA1SignaturesSupported(boolean supportSHA1Signatures)
Option to disable SHA1 signatures on RSA keys.
|
void |
setX11AuthenticationCookie(byte[] x11FakeCookie)
Set the fake cookie used for X11 authentication
|
void |
setX11Display(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.
|
public static final int CIPHER_DES
public static final int CIPHER_3DES
public Ssh1Context()
public void setChannelLimit(int maxChannels)
SshContext
setChannelLimit
in interface SshContext
public int getChannelLimit()
SshContext
getChannelLimit
in interface SshContext
public void setSFTPProvider(String sftp_path)
SshContext
setSFTPProvider
in interface SshContext
public String getSFTPProvider()
SshContext
getSFTPProvider
in interface SshContext
public void setX11Display(String xDisplay)
SshContext
setX11Display
in interface SshContext
xDisplay
- the display in the form localhost:1public String getX11Display()
SshContext
getX11Display
in interface SshContext
public byte[] getX11AuthenticationCookie() throws SshException
SshContext
getX11AuthenticationCookie
in interface SshContext
SshException
public void setX11AuthenticationCookie(byte[] x11FakeCookie)
SshContext
setX11AuthenticationCookie
in interface SshContext
public void setX11RealCookie(byte[] x11RealCookie)
SshContext
setX11RealCookie
in interface SshContext
public byte[] getX11RealCookie() throws SshException
SshContext
getX11RealCookie
in interface SshContext
SshException
public void setX11RequestListener(ForwardingRequestListener x11Listener)
SshContext
setX11RequestListener
in interface SshContext
public ForwardingRequestListener getX11RequestListener()
SshContext
getX11RequestListener
in interface SshContext
public int getCipherType(int supportedCiphers) throws SshException
supportedCiphers
- IOException
SshException
public void setCipherType(int preferredCipher)
preferredCipher
- one of the supported cipher types, for example CIPHER_3DESpublic SshCipher createCipher(int cipherType) throws SshException
SshException
public void setHostKeyVerification(HostKeyVerification verify)
SshContext
setHostKeyVerification
in interface SshContext
public HostKeyVerification getHostKeyVerification()
SshContext
getHostKeyVerification
in interface SshContext
public void setMessageTimeout(int messageTimeout)
setMessageTimeout
in interface SshContext
public int getMessageTimeout()
getMessageTimeout
in interface SshContext
@Deprecated public void enableFIPSMode() throws SshException
SshContext
enableFIPSMode
in interface SshContext
SshException
public ExecutorService getExecutorService()
getExecutorService
in interface ExecutorServiceProvider
public void setExecutorService(ExecutorService executor)
setExecutorService
in interface ExecutorServiceProvider
public boolean isSHA1SignaturesSupported()
SshContext
isSHA1SignaturesSupported
in interface SshContext
public void setSHA1SignaturesSupported(boolean supportSHA1Signatures)
SshContext
setSHA1SignaturesSupported
in interface SshContext
Copyright © 2024. All rights reserved.