Class ConfigImpl

  • All Implemented Interfaces:
    Config
    Direct Known Subclasses:
    DefaultConfig

    public class ConfigImpl
    extends java.lang.Object
    implements Config
    • Constructor Detail

      • ConfigImpl

        public ConfigImpl()
    • Method Detail

      • getCipherFactories

        public java.util.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 java.util.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
      • getKeyExchangeFactories

        public java.util.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 java.util.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
      • getVersion

        public java.lang.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​(java.util.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
      • setMACFactories

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

        public void setMACFactories​(java.util.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​(java.lang.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
      • 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.
      • 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
      • 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.