Class ConfigImpl

java.lang.Object
net.schmizz.sshj.ConfigImpl
All Implemented Interfaces:
Config
Direct Known Subclasses:
DefaultConfig

public class ConfigImpl extends Object implements Config
  • Field Details

  • Constructor Details

    • ConfigImpl

      public ConfigImpl()
  • Method Details

    • getCipherFactories

      public List<Factory.Named<Cipher>> getCipherFactories()
      Description copied from interface: Config
      Retrieve the list of named factories for Cipher.
      Specified by:
      getCipherFactories in interface Config
      Returns:
      a list of named Cipher factories
    • getCompressionFactories

      public List<Factory.Named<Compression>> getCompressionFactories()
      Description copied from interface: Config
      Retrieve the list of named factories for Compression.
      Specified by:
      getCompressionFactories in interface Config
      Returns:
      a list of named Compression factories
    • getFileKeyProviderFactories

      public List<Factory.Named<FileKeyProvider>> getFileKeyProviderFactories()
      Description copied from interface: Config
      Retrieve the list of named factories for FileKeyProvider.
      Specified by:
      getFileKeyProviderFactories in interface Config
      Returns:
      a list of named FileKeyProvider factories
    • getKeyExchangeFactories

      public List<Factory.Named<KeyExchange>> getKeyExchangeFactories()
      Description copied from interface: Config
      Retrieve the list of named factories for KeyExchange.
      Specified by:
      getKeyExchangeFactories in interface Config
      Returns:
      a list of named KeyExchange factories
    • getMACFactories

      public List<Factory.Named<MAC>> getMACFactories()
      Description copied from interface: Config
      Retrieve the list of named factories for MAC.
      Specified by:
      getMACFactories in interface Config
      Returns:
      a list of named MAC factories
    • getRandomFactory

      public Factory<Random> getRandomFactory()
      Description copied from interface: Config
      Retrieve the Random factory.
      Specified by:
      getRandomFactory in interface Config
      Returns:
      the Random factory
    • getVersion

      public String getVersion()
      Description copied from interface: Config
      Returns the software version information for identification during SSH connection initialization. For example, "NET_3_0".
      Specified by:
      getVersion in interface Config
    • setCipherFactories

      public void setCipherFactories(Factory.Named<Cipher>... cipherFactories)
    • setCipherFactories

      public void setCipherFactories(List<Factory.Named<Cipher>> cipherFactories)
      Description copied from interface: Config
      Set the named factories for Cipher.
      Specified by:
      setCipherFactories in interface Config
      Parameters:
      cipherFactories - a list of named factories
    • setCompressionFactories

      public void setCompressionFactories(Factory.Named<Compression>... compressionFactories)
    • setCompressionFactories

      public void setCompressionFactories(List<Factory.Named<Compression>> compressionFactories)
      Description copied from interface: Config
      Set the named factories for Compression.
      Specified by:
      setCompressionFactories in interface Config
      Parameters:
      compressionFactories - a list of named factories
    • setFileKeyProviderFactories

      public void setFileKeyProviderFactories(Factory.Named<FileKeyProvider>... fileKeyProviderFactories)
    • setFileKeyProviderFactories

      public void setFileKeyProviderFactories(List<Factory.Named<FileKeyProvider>> fileKeyProviderFactories)
      Description copied from interface: Config
      Set the named factories for FileKeyProvider.
      Specified by:
      setFileKeyProviderFactories in interface Config
      Parameters:
      fileKeyProviderFactories - a list of named factories
    • setKeyExchangeFactories

      public void setKeyExchangeFactories(Factory.Named<KeyExchange>... kexFactories)
    • setKeyExchangeFactories

      public void setKeyExchangeFactories(List<Factory.Named<KeyExchange>> kexFactories)
      Description copied from interface: Config
      Set the named factories for KeyExchange.
      Specified by:
      setKeyExchangeFactories in interface Config
      Parameters:
      kexFactories - a list of named factories
    • setMACFactories

      public void setMACFactories(Factory.Named<MAC>... macFactories)
    • setMACFactories

      public void setMACFactories(List<Factory.Named<MAC>> macFactories)
      Description copied from interface: Config
      Set the named factories for MAC.
      Specified by:
      setMACFactories in interface Config
      Parameters:
      macFactories - a list of named factories
    • setRandomFactory

      public void setRandomFactory(Factory<Random> randomFactory)
      Description copied from interface: Config
      Set the factory for Random.
      Specified by:
      setRandomFactory in interface Config
      Parameters:
      randomFactory - the factory
    • setVersion

      public void setVersion(String version)
      Description copied from interface: Config
      Set the software version information for identification during SSH connection initialization. For example, "SSHJ_0_1".
      Specified by:
      setVersion in interface Config
      Parameters:
      version - software version info
    • getKeepAliveProvider

      public KeepAliveProvider getKeepAliveProvider()
      Specified by:
      getKeepAliveProvider in interface Config
      Returns:
      The provider that creates the keep-alive implementation of choice.
    • setKeepAliveProvider

      public void setKeepAliveProvider(KeepAliveProvider keepAliveProvider)
      Description copied from interface: Config
      Set the provider that provides the keep-alive implementation.
      Specified by:
      setKeepAliveProvider in interface Config
      Parameters:
      keepAliveProvider - keep-alive provider
    • isWaitForServerIdentBeforeSendingClientIdent

      public boolean isWaitForServerIdentBeforeSendingClientIdent()
      Description copied from interface: Config
      Gets whether the client should first wait for a received server ident, before sending the client ident.

      NB: This is non-standard behaviour, and can potentially deadlock if the server also waits on the client ident. The default value is set to false.

      Specified by:
      isWaitForServerIdentBeforeSendingClientIdent in interface Config
      Returns:
      Whether to first wait for the server ident.
    • setWaitForServerIdentBeforeSendingClientIdent

      public void setWaitForServerIdentBeforeSendingClientIdent(boolean waitForServerIdentBeforeSendingClientIdent)
      Description copied from interface: Config
      Sets whether the SSH client should wait for a received server ident, before sending the client ident.

      NB: This is non-standard behaviour, and can potentially deadlock if the server also waits on the client ident.

      Specified by:
      setWaitForServerIdentBeforeSendingClientIdent in interface Config
      Parameters:
      waitForServerIdentBeforeSendingClientIdent - Whether to wait for the server ident.
    • getKeyAlgorithms

      public List<Factory.Named<KeyAlgorithm>> getKeyAlgorithms()
      Description copied from interface: Config
      Retrieve the list of named factories for KeyAlgorithm
      Specified by:
      getKeyAlgorithms in interface Config
      Returns:
      a list of named KeyAlgorithm factories
    • setKeyAlgorithms

      public void setKeyAlgorithms(List<Factory.Named<KeyAlgorithm>> keyAlgorithms)
      Description copied from interface: Config
      Set the named factories for KeyAlgorithm.
      Specified by:
      setKeyAlgorithms in interface Config
      Parameters:
      keyAlgorithms - a list of named factories
    • getLoggerFactory

      public LoggerFactory getLoggerFactory()
      Specified by:
      getLoggerFactory in interface Config
      Returns:
      The LoggerFactory the SSHClient will use.
    • getMaxCircularBufferSize

      public int getMaxCircularBufferSize()
      Specified by:
      getMaxCircularBufferSize in interface Config
    • setMaxCircularBufferSize

      public void setMaxCircularBufferSize(int maxCircularBufferSize)
      Specified by:
      setMaxCircularBufferSize in interface Config
    • setLoggerFactory

      public void setLoggerFactory(LoggerFactory loggerFactory)
      Description copied from interface: Config
      Sets the LoggerFactory to use.
      Specified by:
      setLoggerFactory in interface Config
    • isVerifyHostKeyCertificates

      public boolean isVerifyHostKeyCertificates()
      Description copied from interface: Config
      Returns true if host key certificates should be verified while connecting to the server. It is recommended to verify them, but can cause connection failures in cases when previous versions of the library could have managed to connect.
      Specified by:
      isVerifyHostKeyCertificates in interface Config
    • setVerifyHostKeyCertificates

      public void setVerifyHostKeyCertificates(boolean value)
      Description copied from interface: Config
      Sets whether the SSH client should verify host key certificates or not. See Config.isVerifyHostKeyCertificates().
      Specified by:
      setVerifyHostKeyCertificates in interface Config
    • prioritizeSshRsaKeyAlgorithm

      public void prioritizeSshRsaKeyAlgorithm()
      Modern servers neglect the key algorithm ssh-rsa. OpenSSH 8.8 even dropped its support by default in favour of rsa-sha2-*. However, there are legacy servers like Apache SSHD that don't support the newer replacements for ssh-rsa. If ssh-rsa factory is in getKeyAlgorithms(), this methods makes ssh-rsa key algorithm more preferred than any of rsa-sha2-*. Otherwise, nothing happens.