public abstract class SshContext extends ProtocolContext implements ExecutorServiceProvider, Context
SshEngine.| Modifier and Type | Field and Description |
|---|---|
protected com.sshtools.common.util.ByteBufferPool |
byteBufferPool |
static java.lang.String |
CIPHER_AES_GCM_128 |
static java.lang.String |
CIPHER_AES_GCM_256 |
static java.lang.String |
CIPHER_AES128_CBC |
static java.lang.String |
CIPHER_AES128_CTR |
static java.lang.String |
CIPHER_AES192_CBC |
static java.lang.String |
CIPHER_AES192_CTR |
static java.lang.String |
CIPHER_AES256_CBC |
static java.lang.String |
CIPHER_AES256_CTR |
static java.lang.String |
CIPHER_ARCFOUR |
static java.lang.String |
CIPHER_ARCFOUR_128 |
static java.lang.String |
CIPHER_ARCFOUR_256 |
static java.lang.String |
CIPHER_BLOWFISH_CBC |
static java.lang.String |
CIPHER_TRIPLEDES_CBC |
static java.lang.String |
CIPHER_TRIPLEDES_CTR |
protected ComponentFactory<SshCipher> |
ciphersCS |
protected ComponentFactory<SshCipher> |
ciphersSC |
protected ComponentManager |
componentManager |
static java.lang.String |
COMPRESSION_NONE
Compression off
|
static java.lang.String |
COMPRESSION_ZLIB
ZLIB compression
|
protected int |
compressionLevel |
protected ComponentFactory<SshCompression> |
compressionsCS |
protected ComponentFactory<SshCompression> |
compressionsSC |
protected SshEngine |
daemon |
protected static java.util.concurrent.ExecutorService |
executor |
static java.lang.String |
HMAC_MD5
MD5 message authentication
|
static java.lang.String |
HMAC_MD5_96
MD5 96 bit message authentication
|
static java.lang.String |
HMAC_MD5_ETM |
static java.lang.String |
HMAC_RIPEMD160 |
static java.lang.String |
HMAC_RIPEMD160_ETM |
static java.lang.String |
HMAC_SHA1
SHA1 message authentication
|
static java.lang.String |
HMAC_SHA1_96
SHA1 96 bit message authentication
|
static java.lang.String |
HMAC_SHA1_ETM |
static java.lang.String |
HMAC_SHA256 |
static java.lang.String |
HMAC_SHA256_96 |
static java.lang.String |
HMAC_SHA256_ETM |
static java.lang.String |
HMAC_SHA512 |
static java.lang.String |
HMAC_SHA512_96 |
static java.lang.String |
HMAC_SHA512_ETM |
protected int |
idleAuthenticationTimeoutSeconds |
protected int |
idleConnectionTimeout |
protected int |
keepAliveDataMaxLength |
protected int |
keepAliveInterval |
static java.lang.String |
KEX_DIFFIE_HELLMAN_ECDH_NISTP_256 |
static java.lang.String |
KEX_DIFFIE_HELLMAN_ECDH_NISTP_384 |
static java.lang.String |
KEX_DIFFIE_HELLMAN_ECDH_NISTP_521 |
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1
Constant for the algorithm name "diffie-hellman-group-exchange-sha1".
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA256 |
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP1_SHA1
Constant for the algorithm name "diffie-hellman-group1-sha1".
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP14_SHA1
Constant for the algorithm name "diffie-hellman-group14-sha1".
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP14_SHA256
Constant for the algorithm name "diffie-hellman-group14-sha256".
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP15_SHA512
Constant for the algorithm name "diffie-hellman-group15-sha512".
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP16_SHA512
Constant for the algorithm name "diffie-hellman-group16-sha512".
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP17_SHA512
Constant for the algorithm name "diffie-hellman-group17-sha512".
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP18_SHA512
Constant for the algorithm name "diffie-hellman-group18-sha512".
|
static java.lang.String |
KEYBOARD_INTERACTIVE_AUTHENTICATION |
protected ComponentFactory<SshKeyExchange<? extends SshContext>> |
keyExchanges |
protected boolean |
killTunnelsOnRemoteForwardingCancel |
protected java.util.Locale |
locale |
protected ComponentFactory<SshHmac> |
macCS |
protected ComponentFactory<SshHmac> |
macSC |
protected long |
MAX_NUM_BYTES_BEFORE_REKEY |
protected long |
MAX_NUM_PACKETS_BEFORE_REKEY |
protected int |
maxChannels |
protected int |
maxDHGroupExchangeKeySize |
protected int |
maximumPacketLength |
protected int |
maximumSocketsBacklogPerRemotelyForwardedConnection |
protected int |
minDHGroupExchangeKeySize |
static java.lang.String |
PASSWORD_AUTHENTICATION
Identifier for password authentication
|
protected java.lang.String |
prefCipherCS |
protected java.lang.String |
prefCipherSC |
protected java.lang.String |
prefCompressionCS |
protected java.lang.String |
prefCompressionSC |
protected int |
preferredDHGroupExchangeKeySize |
protected java.lang.String |
prefKeyExchange |
protected java.lang.String |
prefMacCS |
protected java.lang.String |
prefMacSC |
protected java.lang.String |
prefPublicKey |
static java.lang.String |
PUBLIC_KEY_ECDSA_SHA2_NISPTP_256
ECDSA 256 bit Public Key
|
static java.lang.String |
PUBLIC_KEY_ECDSA_SHA2_NISPTP_384
ECDSA 384 bit Public Key
|
static java.lang.String |
PUBLIC_KEY_ECDSA_SHA2_NISPTP_521
ECDSA 521 bit Public Key
|
static java.lang.String |
PUBLIC_KEY_ED25519
ED25519 Public key
|
static java.lang.String |
PUBLIC_KEY_RSA_SHA256
RSA key with SHA256 signature
|
static java.lang.String |
PUBLIC_KEY_RSA_SHA512
RSA key with SHA512 signature
|
static java.lang.String |
PUBLIC_KEY_SSHDSS
SSH2 DSA Public Key
|
static java.lang.String |
PUBLIC_KEY_SSHRSA
SSH2 RSA Public Key
|
static java.lang.String |
PUBLICKEY_AUTHENTICATION
Identifier for public key authentication
|
protected ComponentFactory<SshPublicKey> |
publicKeys |
protected boolean |
sendIgnorePacketOnIdle |
protected SocketConnectionFactory |
socketConnectionFactory |
protected java.lang.String |
softwareVersionComments |
keepAlive, receiveBufferSize, reuseAddress, sendBufferSize, tcpNoDelay| Constructor and Description |
|---|
SshContext(ComponentManager componentManager,
SecurityLevel securityLevel)
Constructs a default context but does not set the daemon
|
SshContext(SshEngine daemon,
ComponentManager componentManager,
SecurityLevel securityLevel)
Constructs a default context
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOperationListener(ExecutorOperationListener listener) |
protected abstract void |
configureKeyExchanges() |
abstract ProtocolEngine |
createEngine(ConnectRequestFuture connectFuture)
Create a protocol engine.
|
void |
enableFIPSMode() |
protected AuthenticatedFuture |
getAuthenticatedFuture() |
com.sshtools.common.util.ByteBufferPool |
getByteBufferPool() |
abstract ChannelFactory<? extends SshContext> |
getChannelFactory() |
int |
getChannelLimit()
Get the maximum number of open channels allowed by each client.
|
java.lang.String |
getCiphersCS() |
java.lang.String |
getCiphersSC()
Get the ciphers for the Server->Client stream.
|
ComponentManager |
getComponentManager() |
int |
getCompressionLevel()
Get the current compression level
|
abstract ConnectionManager<? extends SshContext> |
getConnectionManager() |
SshEngineContext |
getDaemonContext() |
SshEngine |
getEngine()
Get the instance of the SSHD for this context.
|
java.util.List<ExecutorOperationListener> |
getExecutorListeners() |
java.util.concurrent.ExecutorService |
getExecutorService() |
abstract ForwardingManager<? extends SshContext> |
getForwardingManager() |
ForwardingPolicy |
getForwardingPolicy() |
abstract GlobalRequestHandler<? extends SshContext> |
getGlobalRequestHandler(java.lang.String requestname) |
java.lang.String |
getHttpRedirectUrl() |
int |
getIdleAuthenticationTimeoutSeconds() |
int |
getIdleConnectionTimeoutSeconds()
Should the connection be disconnected on session timeout?
|
int |
getKeepAliveDataMaxLength()
Get the maximum data length for the keep-alive packet.
|
int |
getKeepAliveInterval()
Get the current keep-alive interval (in seconds).
|
long |
getKeyExchangePacketLimit()
Get the number of packets to send before a key exchange is forced
|
java.lang.String |
getKeyExchanges()
Get the ciphers for the Server->Client stream.
|
long |
getKeyExchangeTransferLimit()
Get the number of bytes to transfer before a key exchange is forced.
|
java.util.Locale |
getLocale() |
java.lang.String |
getMacsCS()
Get the ciphers for the Client->Server stream.
|
java.lang.String |
getMacsSC()
Get the ciphers for the Server->Client stream.
|
int |
getMaxDHGroupExchangeKeySize() |
int |
getMaximumPacketLength()
Get the maximum supported length of an SSH packet.
|
int |
getMaximumSocketsBacklogPerRemotelyForwardedConnection() |
int |
getMinDHGroupExchangeKeySize() |
<P> P |
getPolicy(java.lang.Class<P> clz) |
<P> P |
getPolicy(java.lang.Class<P> clz,
P defaultValue) |
java.lang.String |
getPreferredCipherCS()
Get the currently preferred cipher for the Client->Server stream.
|
java.lang.String |
getPreferredCipherSC()
Get the currently preferred cipher for the Server->Client stream.
|
java.lang.String |
getPreferredCompressionCS()
Get the currently preferred compression for the Client->Server stream.
|
java.lang.String |
getPreferredCompressionSC()
Get the currently preferred compression for the Server->Client stream.
|
int |
getPreferredDHGroupExchangeKeySize() |
java.lang.String |
getPreferredKeyExchange()
Get the currently preferred key exchange method.
|
java.lang.String |
getPreferredMacCS()
Get the currently preferred mac for the Client->Server stream.
|
java.lang.String |
getPreferredMacSC()
Get the currently supported mac for the Server-Client stream.
|
abstract java.lang.String |
getPreferredPublicKey() |
java.lang.String |
getPublicKeys()
Get the ciphers for the Server->Client stream.
|
boolean |
getRemoteForwardingCancelKillsTunnels()
Determines whether the cancellation of a remote forwarding drops
currently active tunnels
|
SocketConnectionFactory |
getSocketConnectionFactory() |
java.lang.String |
getSoftwareVersionComments()
Get the software/version/comments field that is to be used in the SSH
protocols negotiation procedure.
|
abstract java.lang.String |
getSupportedPublicKeys() |
boolean |
hasPolicy(java.lang.Class<?> clz) |
void |
init(SshEngine daemon)
Initialise the SshContext by setting the daemon
|
boolean |
isHttpRedirect() |
boolean |
isSendIgnorePacketOnIdle() |
protected java.lang.String |
listPublicKeys(java.lang.String... keys) |
void |
removeOperationListener(ExecutorOperationListener listener) |
void |
setChannelLimit(int maxChannels)
Set the maximum number of open channels allowed by each client (defaults
to 100).
|
void |
setCipherPreferredPositionCS(java.lang.String name,
int position) |
void |
setCipherPreferredPositionSC(java.lang.String name,
int position) |
void |
setCompressionLevel(int compressionLevel)
Set the compression level to use if compression is enabled
|
void |
setHttpRedirect(boolean httpRedirect) |
void |
setHttpRedirectUrl(java.lang.String httpRedirectUrl) |
void |
setIdleAuthenticationTimeoutSeconds(int idleAuthenticationTimeoutSeconds) |
void |
setIdleConnectionTimeoutSeconds(int idleConnectionTimeout)
Inform the context that the connection should be disconnected on session
timeout
|
void |
setKeepAliveDataMaxLength(int keepAliveDataMaxLength)
Set the maximum data length for the keep-alive packet.
|
void |
setKeepAliveInterval(int keepAliveInterval)
Set the keep-alive interval (in seconds).
|
void |
setKeyExchangePacketLimit(int MAX_NUM_PACKETS_BEFORE_REKEY)
This tells the server how many packets to use before a key exchange.
|
void |
setKeyExchangePreferredPosition(java.lang.String name,
int position) |
void |
setKeyExchangeTransferLimit(long MAX_NUM_BYTES_BEFORE_REKEY)
This limit tells the server when to force a key exchange.
|
void |
setLocale(java.util.Locale locale) |
void |
setMacPreferredPositionCS(java.lang.String name,
int position) |
void |
setMacPreferredPositionSC(java.lang.String name,
int position) |
void |
setMaxDHGroupExchangeKeySize(int maxDHGroupExchangeKeySize) |
void |
setMaximumPacketLength(int maximumPacketLength)
Set the maximum supported length of an SSH packet.
|
void |
setMaximumSocketsBacklogPerRemotelyForwardedConnection(int maximumSocketsBacklogPerRemotelyForwardedConnection) |
void |
setMinDHGroupExchangeKeySize(int minDHGroupExchangeKeySize) |
void |
setPolicy(java.lang.Class<?> clz,
java.lang.Object policy) |
void |
setPreferredCipherCS(int[] order)
Set the preferred SC cipher order
|
void |
setPreferredCipherCS(java.lang.String name)
Set the preferred cipher for the Client->Server stream.
|
void |
setPreferredCipherCS(java.lang.String[] order)
Set the preferred CS cipher order
|
void |
setPreferredCipherSC(int[] order)
Set the preferred SC cipher order
|
void |
setPreferredCipherSC(java.lang.String name)
Set the preferred cipher for the Server->Client stream.
|
void |
setPreferredCipherSC(java.lang.String[] order)
Set the preferred SC cipher order
|
void |
setPreferredCompressionCS(java.lang.String name)
Set the preferred compression for the Client->Server stream.
|
void |
setPreferredCompressionSC(java.lang.String name)
Set the preferred compression for the Server->Client stream.
|
void |
setPreferredDHGroupExchangeKeySize(int preferredDHGroupExchangeKeySize) |
void |
setPreferredKeyExchange(java.lang.String name)
Set the preferred key exchange method.
|
void |
setPreferredKeyExchange(java.lang.String[] order) |
void |
setPreferredMacCS(int[] order)
Set the preferred CS Mac order
|
void |
setPreferredMacCS(java.lang.String name)
Set the preferred MAC for the Client->Server stream.
|
void |
setPreferredMacCS(java.lang.String[] order) |
void |
setPreferredMacSC(int[] order)
Set the preferred SC Mac order
|
void |
setPreferredMacSC(java.lang.String name)
Set the preferred mac for the Server->Client stream.
|
void |
setPreferredMacSC(java.lang.String[] order) |
void |
setPublicKeyPreferredPosition(java.lang.String name,
int position) |
void |
setRemoteForwardingCancelKillsTunnels(boolean killTunnelsOnRemoteForwardingCancel)
When the user cancels a remote forwarding should active tunnels be
dropped?
|
void |
setSendIgnorePacketOnIdle(boolean sendIgnorePacketOnIdle) |
void |
setSocketConnectionFactory(SocketConnectionFactory socketConnectionFactory) |
void |
setSoftwareVersionComments(java.lang.String softwareVersionComments)
Set the current implementations software/version/comments field that is
used during the SSH protocols negotiation procedure.
|
void |
shutdown() |
ComponentFactory<SshCipher> |
supportedCiphersCS()
Returns a factory implementation that enables configuration of the
available ciphers.
|
ComponentFactory<SshCipher> |
supportedCiphersSC() |
ComponentFactory<SshCompression> |
supportedCompressionsCS()
Get the supported compression algorithms.
|
ComponentFactory<SshCompression> |
supportedCompressionsSC() |
ComponentFactory<SshKeyExchange<? extends SshContext>> |
supportedKeyExchanges()
Get the supported key exchange methods.
|
ComponentFactory<SshHmac> |
supportedMacsCS()
Get the supported message authentication algorithms.
|
ComponentFactory<SshHmac> |
supportedMacsSC() |
ComponentFactory<SshPublicKey> |
supportedPublicKeys() |
getReceiveBufferSize, getSendBufferSize, getSocketOptionKeepAlive, getSocketOptionReuseAddress, getSocketOptionTcpNoDelay, setReceiveBufferSize, setSendBufferSize, setSocketOptionKeepAlive, setSocketOptionReuseAddress, setSocketOptionTcpNoDelaypublic static final java.lang.String CIPHER_TRIPLEDES_CBC
public static final java.lang.String CIPHER_TRIPLEDES_CTR
public static final java.lang.String CIPHER_BLOWFISH_CBC
public static final java.lang.String CIPHER_AES128_CBC
public static final java.lang.String CIPHER_AES192_CBC
public static final java.lang.String CIPHER_AES256_CBC
public static final java.lang.String CIPHER_AES128_CTR
public static final java.lang.String CIPHER_AES192_CTR
public static final java.lang.String CIPHER_AES256_CTR
public static final java.lang.String CIPHER_ARCFOUR
public static final java.lang.String CIPHER_ARCFOUR_128
public static final java.lang.String CIPHER_ARCFOUR_256
public static final java.lang.String CIPHER_AES_GCM_128
public static final java.lang.String CIPHER_AES_GCM_256
public static final java.lang.String HMAC_SHA1
public static final java.lang.String HMAC_SHA1_ETM
public static final java.lang.String HMAC_SHA1_96
public static final java.lang.String HMAC_MD5
public static final java.lang.String HMAC_MD5_ETM
public static final java.lang.String HMAC_MD5_96
public static final java.lang.String HMAC_SHA256
public static final java.lang.String HMAC_SHA256_ETM
public static final java.lang.String HMAC_SHA256_96
public static final java.lang.String HMAC_SHA512
public static final java.lang.String HMAC_SHA512_ETM
public static final java.lang.String HMAC_SHA512_96
public static final java.lang.String HMAC_RIPEMD160
public static final java.lang.String HMAC_RIPEMD160_ETM
public static final java.lang.String COMPRESSION_NONE
public static final java.lang.String COMPRESSION_ZLIB
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP1_SHA1
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA256
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP14_SHA1
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP14_SHA256
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP15_SHA512
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP16_SHA512
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP17_SHA512
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP18_SHA512
public static final java.lang.String KEX_DIFFIE_HELLMAN_ECDH_NISTP_256
public static final java.lang.String KEX_DIFFIE_HELLMAN_ECDH_NISTP_384
public static final java.lang.String KEX_DIFFIE_HELLMAN_ECDH_NISTP_521
public static final java.lang.String PUBLIC_KEY_SSHDSS
public static final java.lang.String PUBLIC_KEY_ED25519
public static final java.lang.String PUBLIC_KEY_SSHRSA
public static final java.lang.String PUBLIC_KEY_ECDSA_SHA2_NISPTP_256
public static final java.lang.String PUBLIC_KEY_ECDSA_SHA2_NISPTP_384
public static final java.lang.String PUBLIC_KEY_ECDSA_SHA2_NISPTP_521
public static final java.lang.String PUBLIC_KEY_RSA_SHA256
public static final java.lang.String PUBLIC_KEY_RSA_SHA512
public static final java.lang.String PASSWORD_AUTHENTICATION
public static final java.lang.String PUBLICKEY_AUTHENTICATION
public static final java.lang.String KEYBOARD_INTERACTIVE_AUTHENTICATION
protected int maximumSocketsBacklogPerRemotelyForwardedConnection
protected SocketConnectionFactory socketConnectionFactory
protected ComponentFactory<SshCompression> compressionsCS
protected ComponentFactory<SshCompression> compressionsSC
protected ComponentFactory<SshCipher> ciphersCS
protected ComponentFactory<SshCipher> ciphersSC
protected ComponentFactory<SshKeyExchange<? extends SshContext>> keyExchanges
protected ComponentFactory<SshHmac> macCS
protected ComponentFactory<SshHmac> macSC
protected ComponentFactory<SshPublicKey> publicKeys
protected java.lang.String prefCipherCS
protected java.lang.String prefCipherSC
protected java.lang.String prefMacCS
protected java.lang.String prefMacSC
protected java.lang.String prefCompressionCS
protected java.lang.String prefCompressionSC
protected java.lang.String prefKeyExchange
protected java.lang.String prefPublicKey
protected int maxChannels
protected int compressionLevel
protected int maximumPacketLength
protected long MAX_NUM_PACKETS_BEFORE_REKEY
protected long MAX_NUM_BYTES_BEFORE_REKEY
protected SshEngine daemon
protected java.lang.String softwareVersionComments
protected boolean killTunnelsOnRemoteForwardingCancel
protected boolean sendIgnorePacketOnIdle
protected int idleConnectionTimeout
protected int idleAuthenticationTimeoutSeconds
protected int keepAliveInterval
protected int keepAliveDataMaxLength
protected static java.util.concurrent.ExecutorService executor
protected java.util.Locale locale
protected com.sshtools.common.util.ByteBufferPool byteBufferPool
protected int minDHGroupExchangeKeySize
protected int preferredDHGroupExchangeKeySize
protected int maxDHGroupExchangeKeySize
protected ComponentManager componentManager
public SshContext(ComponentManager componentManager, SecurityLevel securityLevel) throws java.io.IOException, SshException
componentManager - SshExceptionjava.io.IOExceptionpublic SshContext(SshEngine daemon, ComponentManager componentManager, SecurityLevel securityLevel) throws java.io.IOException, SshException
componentManager - java.io.IOExceptionSshExceptionpublic void init(SshEngine daemon)
public abstract ConnectionManager<? extends SshContext> getConnectionManager()
public abstract ProtocolEngine createEngine(ConnectRequestFuture connectFuture) throws java.io.IOException
ProtocolContextcreateEngine in class ProtocolContextjava.io.IOExceptionpublic abstract java.lang.String getSupportedPublicKeys()
protected abstract void configureKeyExchanges()
public abstract java.lang.String getPreferredPublicKey()
public abstract ChannelFactory<? extends SshContext> getChannelFactory()
public <P> P getPolicy(java.lang.Class<P> clz)
public <P> P getPolicy(java.lang.Class<P> clz,
P defaultValue)
public void setPolicy(java.lang.Class<?> clz,
java.lang.Object policy)
public boolean hasPolicy(java.lang.Class<?> clz)
public ComponentManager getComponentManager()
getComponentManager in interface Contextpublic void addOperationListener(ExecutorOperationListener listener)
public void removeOperationListener(ExecutorOperationListener listener)
public java.util.List<ExecutorOperationListener> getExecutorListeners()
getExecutorListeners in interface ExecutorServiceProviderpublic void setSocketConnectionFactory(SocketConnectionFactory socketConnectionFactory)
setSocketConnectionFactory in class ProtocolContextpublic SocketConnectionFactory getSocketConnectionFactory()
getSocketConnectionFactory in class ProtocolContextpublic abstract GlobalRequestHandler<? extends SshContext> getGlobalRequestHandler(java.lang.String requestname)
public SshEngine getEngine()
public void setChannelLimit(int maxChannels)
maxChannels - public int getChannelLimit()
public ComponentFactory<SshCipher> supportedCiphersCS()
Returns a factory implementation that enables configuration of the available ciphers.
The standard default ciphers installed are 3DES and Blowfish, however the
J2SSH Maverick API on which this server is based also supports a number
of optional ciphers AES, CAST and Twofish. These can be installed by
adding the sshtools-cipher.jar to your class path and using the
following code within your SSHD
SshDaemon#configure(ConfigurationContext) method.
// import the cipher package import com.sshtools.cipher.*; // Add AES context.supportedCiphers().add(AES128Cbc.AES128_CBC, AES128Cbc.class); context.supportedCiphers().add(AES192Cbc.AES192_CBC, AES192Cbc.class); context.supportedCiphers().add(AES256Cbc.AES256_CBC, AES256Cbc.class); // Add Twofish - note the 256 bit cipher has two different entries to maintain backwards compatibility context.supportedCiphers().add(Twofish128Cbc.TWOFISH128_CBC, Twofish128Cbc.class); context.supportedCiphers().add(Twofish192Cbc.TWOFISH192_CBC, Twofish192Cbc.class); context.supportedCiphers().add(Twofish256Cbc.TWOFISH256_CBC, Twofish256Cbc.class); context.supportedCiphers().add(Twofish256Cbc.TWOFISH_CBC, Twofish256Cbc.class); // Add CAST context.supportedCiphers().add(CAST128Cbc.CAST128_CBC, CAST128Cbc.class);
public ComponentFactory<SshCipher> supportedCiphersSC()
public java.lang.String getPreferredCipherCS()
public void setPreferredCipherCS(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred cipher for the Client->Server stream.
Use the static fields available within this class (or the com.sshtools.cipher classes) to identify the correct cipher.
context.setPreferredCipherCS(ConfigurationContext.CIPHER_BLOWFISH_CBC);
name - java.io.IOException - if the cipher is not supportedSshExceptionpublic java.lang.String getPreferredCipherSC()
public java.lang.String getSoftwareVersionComments()
public void setSoftwareVersionComments(java.lang.String softwareVersionComments)
softwareVersionComments - public void setPreferredCipherSC(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred cipher for the Server->Client stream.
Use the static fields available within this class (or the com.sshtools.cipher classes) to identify the correct cipher.
context.setPreferredCipherSC(ConfigurationContext.CIPHER_BLOWFISH_CBC);
name - java.io.IOExceptionSshExceptionpublic ComponentFactory<SshHmac> supportedMacsCS()
Get the supported message authentication algorithms.
There are no optional MAC algorithms currently available and this method is supplied in preperation for future enhancements.
public ComponentFactory<SshHmac> supportedMacsSC()
public java.lang.String getPreferredMacCS()
public void setPreferredMacCS(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred MAC for the Client->Server stream.
Use the static fields available within this class to identify the correct MAC.
context.setPreferredMacCS(ConfigurationContext.HMAC_MD5);
name - java.io.IOExceptionSshExceptionpublic java.lang.String getPreferredMacSC()
public void setRemoteForwardingCancelKillsTunnels(boolean killTunnelsOnRemoteForwardingCancel)
killTunnelsOnRemoteForwardingCancel - booleanpublic boolean getRemoteForwardingCancelKillsTunnels()
public void setPreferredMacSC(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred mac for the Server->Client stream.
Use the static fields available within this class to identify the correct MAC.
context.setPreferredMacCS(ConfigurationContext.HMAC_MD5);
name - java.io.IOExceptionSshExceptionpublic ComponentFactory<SshCompression> supportedCompressionsCS()
Get the supported compression algorithms.
There are no optional compression algorithms currently available and this method is supplied in preperation for future enhancements.
public ComponentFactory<SshCompression> supportedCompressionsSC()
public java.lang.String getPreferredCompressionCS()
public void setPreferredCompressionCS(java.lang.String name)
throws java.io.IOException
Set the preferred compression for the Client->Server stream.
It is recommended that you do not set the preferred compression so that the client has control over the compression selection.
name - java.io.IOExceptionpublic java.lang.String getPreferredCompressionSC()
public void setPreferredCompressionSC(java.lang.String name)
throws java.io.IOException
Set the preferred compression for the Server->Client stream.
It is recommended that you do not set the preferred compression so that the client has control over the compression selection.
name - java.io.IOExceptionpublic ComponentFactory<SshKeyExchange<? extends SshContext>> supportedKeyExchanges()
Get the supported key exchange methods.
There are no optional key exchange algorithms currently available and this method is supplied in preperation for future enhancements.
public java.lang.String getPreferredKeyExchange()
public void setPreferredKeyExchange(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred key exchange method.
There is only one supported key exchange algorithm and as such this method is supplied in preperation for future enhancements.
name - java.io.IOExceptionSshExceptionpublic void setCompressionLevel(int compressionLevel)
compressionLevel - intpublic int getCompressionLevel()
public int getMaximumSocketsBacklogPerRemotelyForwardedConnection()
public void setMaximumSocketsBacklogPerRemotelyForwardedConnection(int maximumSocketsBacklogPerRemotelyForwardedConnection)
public java.lang.String getCiphersSC()
public java.lang.String getCiphersCS()
public java.lang.String getMacsCS()
public java.lang.String getMacsSC()
public java.lang.String getPublicKeys()
public java.lang.String getKeyExchanges()
public void setPreferredCipherSC(int[] order)
throws SshException
order - , list of indices to be moved to the top.SshExceptionpublic void setPreferredCipherSC(java.lang.String[] order)
throws SshException
order - SshExceptionpublic void setPreferredCipherCS(int[] order)
throws SshException
order - , list of indices to be moved to the top.SshExceptionpublic void setPreferredCipherCS(java.lang.String[] order)
throws SshException
order - SshExceptionpublic void setPreferredMacSC(int[] order)
throws SshException
order - , list of indices to be moved to the top.SshExceptionpublic void setPreferredMacSC(java.lang.String[] order)
throws SshException
order - SshExceptionpublic void setPreferredKeyExchange(java.lang.String[] order)
throws SshException
order - SshExceptionpublic void setPreferredMacCS(int[] order)
throws SshException
order - , list of indices to be moved to the top.SshExceptionpublic void setPreferredMacCS(java.lang.String[] order)
throws SshException
SshExceptionpublic void setCipherPreferredPositionCS(java.lang.String name,
int position)
throws SshException
SshExceptionpublic void setCipherPreferredPositionSC(java.lang.String name,
int position)
throws SshException
SshExceptionpublic void setMacPreferredPositionSC(java.lang.String name,
int position)
throws SshException
SshExceptionpublic void setMacPreferredPositionCS(java.lang.String name,
int position)
throws SshException
SshExceptionpublic void setPublicKeyPreferredPosition(java.lang.String name,
int position)
throws SshException
SshExceptionpublic void setKeyExchangePreferredPosition(java.lang.String name,
int position)
throws SshException
SshExceptionpublic void setMaximumPacketLength(int maximumPacketLength)
maximumPacketLength - intpublic int getMaximumPacketLength()
getMaximumPacketLength in interface Contextpublic void setKeyExchangeTransferLimit(long MAX_NUM_BYTES_BEFORE_REKEY)
MAX_NUM_BYTES_BEFORE_REKEY - intpublic void setKeyExchangePacketLimit(int MAX_NUM_PACKETS_BEFORE_REKEY)
MAX_NUM_PACKETS_BEFORE_REKEY - intpublic long getKeyExchangeTransferLimit()
public long getKeyExchangePacketLimit()
public int getIdleConnectionTimeoutSeconds()
public void setIdleConnectionTimeoutSeconds(int idleConnectionTimeout)
idleConnectionTimeout - public ComponentFactory<SshPublicKey> supportedPublicKeys()
public int getKeepAliveInterval()
public void setKeepAliveInterval(int keepAliveInterval)
keepAliveInterval - public int getKeepAliveDataMaxLength()
public void setKeepAliveDataMaxLength(int keepAliveDataMaxLength)
keepAliveDataMaxLength - public void setLocale(java.util.Locale locale)
public java.util.Locale getLocale()
public void enableFIPSMode()
throws SshException
SshExceptionpublic java.util.concurrent.ExecutorService getExecutorService()
getExecutorService in interface ContextgetExecutorService in interface ExecutorServiceProviderpublic void shutdown()
shutdown in class ProtocolContextpublic com.sshtools.common.util.ByteBufferPool getByteBufferPool()
getByteBufferPool in interface Contextpublic SshEngineContext getDaemonContext()
public int getIdleAuthenticationTimeoutSeconds()
public void setIdleAuthenticationTimeoutSeconds(int idleAuthenticationTimeoutSeconds)
public int getMinDHGroupExchangeKeySize()
public void setMinDHGroupExchangeKeySize(int minDHGroupExchangeKeySize)
public abstract ForwardingManager<? extends SshContext> getForwardingManager()
protected java.lang.String listPublicKeys(java.lang.String... keys)
public boolean isSendIgnorePacketOnIdle()
public void setSendIgnorePacketOnIdle(boolean sendIgnorePacketOnIdle)
public boolean isHttpRedirect()
public void setHttpRedirect(boolean httpRedirect)
public java.lang.String getHttpRedirectUrl()
public void setHttpRedirectUrl(java.lang.String httpRedirectUrl)
public int getPreferredDHGroupExchangeKeySize()
public void setPreferredDHGroupExchangeKeySize(int preferredDHGroupExchangeKeySize)
public int getMaxDHGroupExchangeKeySize()
public void setMaxDHGroupExchangeKeySize(int maxDHGroupExchangeKeySize)
public ForwardingPolicy getForwardingPolicy()
protected AuthenticatedFuture getAuthenticatedFuture()
Copyright © 2021. All rights reserved.