Class SshClientContext

java.lang.Object
com.sshtools.synergy.nio.ProtocolContext
com.sshtools.synergy.ssh.SshContext
com.sshtools.client.SshClientContext
All Implemented Interfaces:
com.sshtools.common.ssh.Context, com.sshtools.common.ssh.ExecutorServiceProvider
Direct Known Subclasses:
SwitchingSshContext

public class SshClientContext extends com.sshtools.synergy.ssh.SshContext
Holds the configuration for an SSH connection.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from class com.sshtools.synergy.ssh.SshContext

    byteBufferPool, CIPHER_AES_GCM_128, CIPHER_AES_GCM_256, CIPHER_AES128_CBC, CIPHER_AES128_CTR, CIPHER_AES192_CBC, CIPHER_AES192_CTR, CIPHER_AES256_CBC, CIPHER_AES256_CTR, CIPHER_ARCFOUR, CIPHER_ARCFOUR_128, CIPHER_ARCFOUR_256, CIPHER_BLOWFISH_CBC, CIPHER_TRIPLEDES_CBC, CIPHER_TRIPLEDES_CTR, ciphersCS, ciphersSC, componentManager, COMPRESSION_NONE, COMPRESSION_ZLIB, compressionLevel, compressionsCS, compressionsSC, daemon, executor, extendedIdentificationSanitization, HMAC_MD5, HMAC_MD5_96, HMAC_MD5_ETM, HMAC_RIPEMD160, HMAC_RIPEMD160_ETM, HMAC_SHA1, HMAC_SHA1_96, HMAC_SHA1_ETM, HMAC_SHA256, HMAC_SHA256_96, HMAC_SHA256_ETM, HMAC_SHA512, HMAC_SHA512_96, HMAC_SHA512_ETM, idleAuthenticationTimeoutSeconds, idleConnectionTimeout, keepAliveDataMaxLength, keepAliveInterval, KEX_DIFFIE_HELLMAN_ECDH_NISTP_256, KEX_DIFFIE_HELLMAN_ECDH_NISTP_384, KEX_DIFFIE_HELLMAN_ECDH_NISTP_521, KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1, KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA256, KEX_DIFFIE_HELLMAN_GROUP1_SHA1, KEX_DIFFIE_HELLMAN_GROUP14_SHA1, KEX_DIFFIE_HELLMAN_GROUP14_SHA256, KEX_DIFFIE_HELLMAN_GROUP15_SHA512, KEX_DIFFIE_HELLMAN_GROUP16_SHA512, KEX_DIFFIE_HELLMAN_GROUP17_SHA512, KEX_DIFFIE_HELLMAN_GROUP18_SHA512, KEYBOARD_INTERACTIVE_AUTHENTICATION, keyExchanges, killTunnelsOnRemoteForwardingCancel, locale, macCS, macSC, MAX_NUM_BYTES_BEFORE_REKEY, MAX_NUM_PACKETS_BEFORE_REKEY, maxChannels, maxDHGroupExchangeKeySize, maximumPacketLength, maximumSocketsBacklogPerRemotelyForwardedConnection, minDHGroupExchangeKeySize, PASSWORD_AUTHENTICATION, prefCipherCS, prefCipherSC, prefCompressionCS, prefCompressionSC, preferredDHGroupExchangeKeySize, prefKeyExchange, prefMacCS, prefMacSC, prefPublicKey, PUBLIC_KEY_ECDSA_SHA2_NISPTP_256, PUBLIC_KEY_ECDSA_SHA2_NISPTP_384, PUBLIC_KEY_ECDSA_SHA2_NISPTP_521, PUBLIC_KEY_ED25519, PUBLIC_KEY_RSA_SHA256, PUBLIC_KEY_RSA_SHA512, PUBLIC_KEY_SSHDSS, PUBLIC_KEY_SSHRSA, PUBLICKEY_AUTHENTICATION, publicKeys, sendIgnorePacketOnIdle, signatures, softwareVersionComments

    Fields inherited from class com.sshtools.synergy.nio.ProtocolContext

    keepAlive, receiveBufferSize, reuseAddress, sendBufferSize, tcpNoDelay
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    SshClientContext(com.sshtools.common.ssh.SecurityLevel securityLevel)
     
    SshClientContext(com.sshtools.synergy.nio.SshEngine daemon)
     
    SshClientContext(com.sshtools.synergy.nio.SshEngine daemon, com.sshtools.common.ssh.components.ComponentManager componentManager, com.sshtools.common.ssh.SecurityLevel securityLevel)
     
    SshClientContext(com.sshtools.synergy.nio.SshEngine daemon, com.sshtools.common.ssh.SecurityLevel securityLevel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    addGlobalRequestHandler(com.sshtools.synergy.ssh.GlobalRequestHandler<SshClientContext> handler)
     
     
    protected void
     
    com.sshtools.synergy.nio.ProtocolEngine
    createEngine(com.sshtools.synergy.nio.ConnectRequestFuture connectFuture)
     
     
     
     
    com.sshtools.synergy.ssh.ChannelFactory<SshClientContext>
     
    com.sshtools.synergy.ssh.ConnectionManager<SshClientContext>
     
    com.sshtools.synergy.nio.SshEngineContext
     
    final com.sshtools.synergy.nio.SshEngine
     
    com.sshtools.synergy.ssh.ForwardingManager<SshClientContext>
     
    com.sshtools.synergy.ssh.GlobalRequestHandler<SshClientContext>
     
    com.sshtools.common.knownhosts.HostKeyVerification
     
    boolean
     
     
    com.sshtools.synergy.nio.SocketConnectionFactory
     
     
    int
     
     
    Get the username of this connection.
    void
    keysExchanged(boolean first)
     
     
    void
    setChannelFactory(com.sshtools.synergy.ssh.ChannelFactory<SshClientContext> channelFactory)
     
    setConnectionManager(com.sshtools.synergy.ssh.ConnectionManager<SshClientContext> connectionManager)
     
    setForwardingManager(com.sshtools.synergy.ssh.ForwardingManager<SshClientContext> forwardingManager)
     
    setHostKeyVerification(com.sshtools.common.knownhosts.HostKeyVerification hkv)
     
    void
    setPreferKeyboardInteractiveOverPassword(boolean preferKeyboardInteractiveOverPassword)
     
    void
     
    setSubsystemCacheSize(int subsystemCacheSize)
     
    setUsername(String username)
    Set the username for this connection.
    com.sshtools.common.ssh.components.ComponentFactory<com.sshtools.synergy.ssh.components.SshKeyExchange<?>>
     
    boolean
     

    Methods inherited from class com.sshtools.synergy.ssh.SshContext

    addOperationListener, enableFIPSMode, getByteBufferPool, getChannelLimit, getCiphersCS, getCiphersSC, getComponentManager, getCompressionLevel, getExecutorListeners, getExecutorService, getForwardingPolicy, getHttpRedirectUrl, getIdleAuthenticationTimeoutSeconds, getIdleConnectionTimeoutSeconds, getKeepAliveDataMaxLength, getKeepAliveInterval, getKeyExchangePacketLimit, getKeyExchanges, getKeyExchangeTransferLimit, getLocale, getMacsCS, getMacsSC, getMaxDHGroupExchangeKeySize, getMaximumPacketLength, getMaximumSocketsBacklogPerRemotelyForwardedConnection, getMinDHGroupExchangeKeySize, getPolicy, getPolicy, getPreferredCipherCS, getPreferredCipherSC, getPreferredCompressionCS, getPreferredCompressionSC, getPreferredDHGroupExchangeKeySize, getPreferredKeyExchange, getPreferredMacCS, getPreferredMacSC, getPublicKeys, getRemoteForwardingCancelKillsTunnels, getSoftwareVersionComments, getSupportedSignatures, hasPolicy, init, isExtendedIdentificationSanitization, isHttpRedirect, isSendIgnorePacketOnIdle, isSHA1SignaturesSupported, listPublicKeys, removeOperationListener, setChannelLimit, setCipherPreferredPositionCS, setCipherPreferredPositionSC, setCompressionLevel, setExtendedIdentificationSanitization, setHttpRedirect, setHttpRedirectUrl, setIdleAuthenticationTimeoutSeconds, setIdleConnectionTimeoutSeconds, setKeepAliveDataMaxLength, setKeepAliveInterval, setKeyExchangePacketLimit, setKeyExchangePreferredPosition, setKeyExchangeTransferLimit, setLocale, setMacPreferredPositionCS, setMacPreferredPositionSC, setMaxDHGroupExchangeKeySize, setMaximumPacketLength, setMaximumSocketsBacklogPerRemotelyForwardedConnection, setMinDHGroupExchangeKeySize, setPolicy, setPreferredCipherCS, setPreferredCipherCS, setPreferredCipherCS, setPreferredCipherSC, setPreferredCipherSC, setPreferredCipherSC, setPreferredCompressionCS, setPreferredCompressionSC, setPreferredDHGroupExchangeKeySize, setPreferredKeyExchange, setPreferredKeyExchange, setPreferredMacCS, setPreferredMacCS, setPreferredMacCS, setPreferredMacSC, setPreferredMacSC, setPreferredMacSC, setPublicKeyPreferredPosition, setRemoteForwardingCancelKillsTunnels, setSendIgnorePacketOnIdle, setSHA1SignaturesSupported, setSocketConnectionFactory, setSoftwareVersionComments, shutdown, supportedCiphersCS, supportedCiphersSC, supportedCompressionsCS, supportedCompressionsSC, supportedMacsCS, supportedMacsSC, supportedPublicKeys

    Methods inherited from class com.sshtools.synergy.nio.ProtocolContext

    enableHTTPProxy, enableHTTPProxy, enableHTTPProxy, enableHTTPProxy, enableSocks4Proxy, enableSocks5Proxy, getOptionalHeaders, getProxyHostname, getProxyPassword, getProxyPort, getProxyType, getProxyUsername, getReceiveBufferSize, getSendBufferSize, getSocketOptionKeepAlive, getSocketOptionReuseAddress, getSocketOptionTcpNoDelay, getUserAgent, isProxyEnabled, isResolveLocally, setReceiveBufferSize, setSendBufferSize, setSocketOptionKeepAlive, setSocketOptionReuseAddress, setSocketOptionTcpNoDelay

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SshClientContext

      public SshClientContext() throws IOException, com.sshtools.common.ssh.SshException
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
    • SshClientContext

      public SshClientContext(com.sshtools.synergy.nio.SshEngine daemon, com.sshtools.common.ssh.components.ComponentManager componentManager, com.sshtools.common.ssh.SecurityLevel securityLevel) throws IOException, com.sshtools.common.ssh.SshException
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
    • SshClientContext

      public SshClientContext(com.sshtools.synergy.nio.SshEngine daemon) throws IOException, com.sshtools.common.ssh.SshException
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
    • SshClientContext

      public SshClientContext(com.sshtools.synergy.nio.SshEngine daemon, com.sshtools.common.ssh.SecurityLevel securityLevel) throws IOException, com.sshtools.common.ssh.SshException
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
    • SshClientContext

      public SshClientContext(com.sshtools.common.ssh.SecurityLevel securityLevel) throws IOException, com.sshtools.common.ssh.SshException
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
  • Method Details

    • createEngine

      public com.sshtools.synergy.nio.ProtocolEngine createEngine(com.sshtools.synergy.nio.ConnectRequestFuture connectFuture) throws IOException
      Specified by:
      createEngine in class com.sshtools.synergy.ssh.SshContext
      Throws:
      IOException
    • getEngine

      public final com.sshtools.synergy.nio.SshEngine getEngine()
      Overrides:
      getEngine in class com.sshtools.synergy.ssh.SshContext
    • setUsername

      public SshClientContext setUsername(String username)
      Set the username for this connection.
      Parameters:
      username -
    • getUsername

      public String getUsername()
      Get the username of this connection.
      Returns:
    • addStateListener

      public SshClientContext addStateListener(ClientStateListener stateListener)
    • getStateListeners

      public Collection<ClientStateListener> getStateListeners()
    • getForwardingManager

      public com.sshtools.synergy.ssh.ForwardingManager<SshClientContext> getForwardingManager()
      Specified by:
      getForwardingManager in class com.sshtools.synergy.ssh.SshContext
    • setForwardingManager

      public SshClientContext setForwardingManager(com.sshtools.synergy.ssh.ForwardingManager<SshClientContext> forwardingManager)
    • keysExchanged

      public void keysExchanged(boolean first)
    • getAuthenticationClient

      public AuthenticationProtocolClient getAuthenticationClient()
    • configureKeyExchanges

      protected void configureKeyExchanges()
      Specified by:
      configureKeyExchanges in class com.sshtools.synergy.ssh.SshContext
    • testClientKeyExchangeAlgorithm

      public boolean testClientKeyExchangeAlgorithm(SshKeyExchangeClientFactory<? extends SshKeyExchangeClient> cls)
    • getSupportedPublicKeys

      public String getSupportedPublicKeys()
      Specified by:
      getSupportedPublicKeys in class com.sshtools.synergy.ssh.SshContext
    • supportedKeyExchanges

      public com.sshtools.common.ssh.components.ComponentFactory<com.sshtools.synergy.ssh.components.SshKeyExchange<?>> supportedKeyExchanges()
      Overrides:
      supportedKeyExchanges in class com.sshtools.synergy.ssh.SshContext
    • getPreferredPublicKey

      public String getPreferredPublicKey()
      Specified by:
      getPreferredPublicKey in class com.sshtools.synergy.ssh.SshContext
    • setPreferredPublicKey

      public void setPreferredPublicKey(String prefPublicKey)
    • getConnectionManager

      public com.sshtools.synergy.ssh.ConnectionManager<SshClientContext> getConnectionManager()
      Specified by:
      getConnectionManager in class com.sshtools.synergy.ssh.SshContext
    • setConnectionManager

      public SshClientContext setConnectionManager(com.sshtools.synergy.ssh.ConnectionManager<SshClientContext> connectionManager)
    • addAuthenticator

      public SshClientContext addAuthenticator(ClientAuthenticator auth)
    • getAuthenticators

      public List<ClientAuthenticator> getAuthenticators()
    • getBannerDisplay

      public BannerDisplay getBannerDisplay()
    • setBannerDisplay

      public SshClientContext setBannerDisplay(BannerDisplay bannerDisplay)
    • getSubsystemCacheSize

      public int getSubsystemCacheSize()
    • setSubsystemCacheSize

      public SshClientContext setSubsystemCacheSize(int subsystemCacheSize)
    • getChannelFactory

      public com.sshtools.synergy.ssh.ChannelFactory<SshClientContext> getChannelFactory()
      Specified by:
      getChannelFactory in class com.sshtools.synergy.ssh.SshContext
    • setChannelFactory

      public void setChannelFactory(com.sshtools.synergy.ssh.ChannelFactory<SshClientContext> channelFactory)
    • getDaemonContext

      public com.sshtools.synergy.nio.SshEngineContext getDaemonContext()
      Overrides:
      getDaemonContext in class com.sshtools.synergy.ssh.SshContext
    • addGlobalRequestHandler

      public SshClientContext addGlobalRequestHandler(com.sshtools.synergy.ssh.GlobalRequestHandler<SshClientContext> handler)
    • getGlobalRequestHandler

      public com.sshtools.synergy.ssh.GlobalRequestHandler<SshClientContext> getGlobalRequestHandler(String name)
      Specified by:
      getGlobalRequestHandler in class com.sshtools.synergy.ssh.SshContext
    • getSocketConnectionFactory

      public com.sshtools.synergy.nio.SocketConnectionFactory getSocketConnectionFactory()
      Overrides:
      getSocketConnectionFactory in class com.sshtools.synergy.ssh.SshContext
    • getHostKeyVerification

      public com.sshtools.common.knownhosts.HostKeyVerification getHostKeyVerification()
    • setHostKeyVerification

      public SshClientContext setHostKeyVerification(com.sshtools.common.knownhosts.HostKeyVerification hkv)
    • getPreferKeyboardInteractiveOverPassword

      public boolean getPreferKeyboardInteractiveOverPassword()
    • setPreferKeyboardInteractiveOverPassword

      public void setPreferKeyboardInteractiveOverPassword(boolean preferKeyboardInteractiveOverPassword)