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)
SshContextsetChannelLimit in interface SshContextpublic int getChannelLimit()
SshContextgetChannelLimit in interface SshContextpublic void setSFTPProvider(String sftp_path)
SshContextsetSFTPProvider in interface SshContextpublic String getSFTPProvider()
SshContextgetSFTPProvider in interface SshContextpublic void setX11Display(String xDisplay)
SshContextsetX11Display in interface SshContextxDisplay - the display in the form localhost:1public String getX11Display()
SshContextgetX11Display in interface SshContextpublic byte[] getX11AuthenticationCookie()
throws SshException
SshContextgetX11AuthenticationCookie in interface SshContextSshExceptionpublic void setX11AuthenticationCookie(byte[] x11FakeCookie)
SshContextsetX11AuthenticationCookie in interface SshContextpublic void setX11RealCookie(byte[] x11RealCookie)
SshContextsetX11RealCookie in interface SshContextpublic byte[] getX11RealCookie()
throws SshException
SshContextgetX11RealCookie in interface SshContextSshExceptionpublic void setX11RequestListener(ForwardingRequestListener x11Listener)
SshContextsetX11RequestListener in interface SshContextpublic ForwardingRequestListener getX11RequestListener()
SshContextgetX11RequestListener in interface SshContextpublic int getCipherType(int supportedCiphers)
throws SshException
supportedCiphers - IOExceptionSshExceptionpublic void setCipherType(int preferredCipher)
preferredCipher - one of the supported cipher types, for example CIPHER_3DESpublic SshCipher createCipher(int cipherType) throws SshException
SshExceptionpublic void setHostKeyVerification(HostKeyVerification verify)
SshContextsetHostKeyVerification in interface SshContextpublic HostKeyVerification getHostKeyVerification()
SshContextgetHostKeyVerification in interface SshContextpublic void setMessageTimeout(int messageTimeout)
setMessageTimeout in interface SshContextpublic int getMessageTimeout()
getMessageTimeout in interface SshContext@Deprecated public void enableFIPSMode() throws SshException
SshContextenableFIPSMode in interface SshContextSshExceptionpublic ExecutorService getExecutorService()
getExecutorService in interface ExecutorServiceProviderpublic void setExecutorService(ExecutorService executor)
setExecutorService in interface ExecutorServiceProviderpublic boolean isSHA1SignaturesSupported()
SshContextisSHA1SignaturesSupported in interface SshContextpublic void setSHA1SignaturesSupported(boolean supportSHA1Signatures)
SshContextsetSHA1SignaturesSupported in interface SshContextCopyright © 2025. All rights reserved.