Package net.schmizz.sshj
Class ConfigImpl
java.lang.Object
net.schmizz.sshj.ConfigImpl
- All Implemented Interfaces:
Config
- Direct Known Subclasses:
DefaultConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<Factory.Named<Cipher>> private List
<Factory.Named<Compression>> private List
<Factory.Named<FileKeyProvider>> private KeepAliveProvider
private List
<Factory.Named<KeyExchange>> private List
<Factory.Named<KeyAlgorithm>> private LoggerFactory
private List
<Factory.Named<MAC>> private int
private boolean
private String
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the list of named factories forCipher
.Retrieve the list of named factories forCompression
.Retrieve the list of named factories forFileKeyProvider
.Retrieve the list of named factories forKeyAlgorithm
Retrieve the list of named factories forKeyExchange
.Retrieve the list of named factories forMAC
.int
Retrieve theRandom
factory.Returns the software version information for identification during SSH connection initialization.boolean
Returns true if host key certificates should be verified while connecting to the server.boolean
Gets whether the client should first wait for a received server ident, before sending the client ident.void
Modern servers neglect the key algorithm ssh-rsa.void
setCipherFactories
(List<Factory.Named<Cipher>> cipherFactories) Set the named factories forCipher
.void
setCipherFactories
(Factory.Named<Cipher>... cipherFactories) void
setCompressionFactories
(List<Factory.Named<Compression>> compressionFactories) Set the named factories forCompression
.void
setCompressionFactories
(Factory.Named<Compression>... compressionFactories) void
setFileKeyProviderFactories
(List<Factory.Named<FileKeyProvider>> fileKeyProviderFactories) Set the named factories forFileKeyProvider
.void
setFileKeyProviderFactories
(Factory.Named<FileKeyProvider>... fileKeyProviderFactories) void
setKeepAliveProvider
(KeepAliveProvider keepAliveProvider) Set the provider that provides the keep-alive implementation.void
setKeyAlgorithms
(List<Factory.Named<KeyAlgorithm>> keyAlgorithms) Set the named factories forKeyAlgorithm
.void
setKeyExchangeFactories
(List<Factory.Named<KeyExchange>> kexFactories) Set the named factories forKeyExchange
.void
setKeyExchangeFactories
(Factory.Named<KeyExchange>... kexFactories) void
setLoggerFactory
(LoggerFactory loggerFactory) Sets the LoggerFactory to use.void
setMACFactories
(List<Factory.Named<MAC>> macFactories) Set the named factories forMAC
.void
setMACFactories
(Factory.Named<MAC>... macFactories) void
setMaxCircularBufferSize
(int maxCircularBufferSize) void
setRandomFactory
(Factory<Random> randomFactory) Set the factory forRandom
.void
setVerifyHostKeyCertificates
(boolean value) Sets whether the SSH client should verify host key certificates or not.void
setVersion
(String version) Set the software version information for identification during SSH connection initialization.void
setWaitForServerIdentBeforeSendingClientIdent
(boolean waitForServerIdentBeforeSendingClientIdent) Sets whether the SSH client should wait for a received server ident, before sending the client ident.
-
Field Details
-
version
-
randomFactory
-
keepAliveProvider
-
kexFactories
-
cipherFactories
-
compressionFactories
-
macFactories
-
keyAlgorithms
-
fileKeyProviderFactories
-
waitForServerIdentBeforeSendingClientIdent
private boolean waitForServerIdentBeforeSendingClientIdent -
loggerFactory
-
verifyHostKeyCertificates
private boolean verifyHostKeyCertificates -
maxCircularBufferSize
private int maxCircularBufferSize
-
-
Constructor Details
-
ConfigImpl
public ConfigImpl()
-
-
Method Details
-
getCipherFactories
Description copied from interface:Config
Retrieve the list of named factories forCipher
.- Specified by:
getCipherFactories
in interfaceConfig
- Returns:
- a list of named
Cipher
factories
-
getCompressionFactories
Description copied from interface:Config
Retrieve the list of named factories forCompression
.- Specified by:
getCompressionFactories
in interfaceConfig
- Returns:
- a list of named
Compression
factories
-
getFileKeyProviderFactories
Description copied from interface:Config
Retrieve the list of named factories forFileKeyProvider
.- Specified by:
getFileKeyProviderFactories
in interfaceConfig
- Returns:
- a list of named
FileKeyProvider
factories
-
getKeyExchangeFactories
Description copied from interface:Config
Retrieve the list of named factories forKeyExchange
.- Specified by:
getKeyExchangeFactories
in interfaceConfig
- Returns:
- a list of named
KeyExchange
factories
-
getMACFactories
Description copied from interface:Config
Retrieve the list of named factories forMAC
.- Specified by:
getMACFactories
in interfaceConfig
- Returns:
- a list of named
MAC
factories
-
getRandomFactory
Description copied from interface:Config
Retrieve theRandom
factory.- Specified by:
getRandomFactory
in interfaceConfig
- Returns:
- the
Random
factory
-
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 interfaceConfig
-
setCipherFactories
-
setCipherFactories
Description copied from interface:Config
Set the named factories forCipher
.- Specified by:
setCipherFactories
in interfaceConfig
- Parameters:
cipherFactories
- a list of named factories
-
setCompressionFactories
-
setCompressionFactories
Description copied from interface:Config
Set the named factories forCompression
.- Specified by:
setCompressionFactories
in interfaceConfig
- Parameters:
compressionFactories
- a list of named factories
-
setFileKeyProviderFactories
-
setFileKeyProviderFactories
public void setFileKeyProviderFactories(List<Factory.Named<FileKeyProvider>> fileKeyProviderFactories) Description copied from interface:Config
Set the named factories forFileKeyProvider
.- Specified by:
setFileKeyProviderFactories
in interfaceConfig
- Parameters:
fileKeyProviderFactories
- a list of named factories
-
setKeyExchangeFactories
-
setKeyExchangeFactories
Description copied from interface:Config
Set the named factories forKeyExchange
.- Specified by:
setKeyExchangeFactories
in interfaceConfig
- Parameters:
kexFactories
- a list of named factories
-
setMACFactories
-
setMACFactories
Description copied from interface:Config
Set the named factories forMAC
.- Specified by:
setMACFactories
in interfaceConfig
- Parameters:
macFactories
- a list of named factories
-
setRandomFactory
Description copied from interface:Config
Set the factory forRandom
.- Specified by:
setRandomFactory
in interfaceConfig
- Parameters:
randomFactory
- the factory
-
setVersion
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 interfaceConfig
- Parameters:
version
- software version info
-
getKeepAliveProvider
- Specified by:
getKeepAliveProvider
in interfaceConfig
- Returns:
- The provider that creates the keep-alive implementation of choice.
-
setKeepAliveProvider
Description copied from interface:Config
Set the provider that provides the keep-alive implementation.- Specified by:
setKeepAliveProvider
in interfaceConfig
- 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 interfaceConfig
- 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 interfaceConfig
- Parameters:
waitForServerIdentBeforeSendingClientIdent
- Whether to wait for the server ident.
-
getKeyAlgorithms
Description copied from interface:Config
Retrieve the list of named factories forKeyAlgorithm
- Specified by:
getKeyAlgorithms
in interfaceConfig
- Returns:
- a list of named
KeyAlgorithm
factories
-
setKeyAlgorithms
Description copied from interface:Config
Set the named factories forKeyAlgorithm
.- Specified by:
setKeyAlgorithms
in interfaceConfig
- Parameters:
keyAlgorithms
- a list of named factories
-
getLoggerFactory
- Specified by:
getLoggerFactory
in interfaceConfig
- Returns:
- The LoggerFactory the SSHClient will use.
-
getMaxCircularBufferSize
public int getMaxCircularBufferSize()- Specified by:
getMaxCircularBufferSize
in interfaceConfig
-
setMaxCircularBufferSize
public void setMaxCircularBufferSize(int maxCircularBufferSize) - Specified by:
setMaxCircularBufferSize
in interfaceConfig
-
setLoggerFactory
Description copied from interface:Config
Sets the LoggerFactory to use.- Specified by:
setLoggerFactory
in interfaceConfig
-
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 interfaceConfig
-
setVerifyHostKeyCertificates
public void setVerifyHostKeyCertificates(boolean value) Description copied from interface:Config
Sets whether the SSH client should verify host key certificates or not. SeeConfig.isVerifyHostKeyCertificates()
.- Specified by:
setVerifyHostKeyCertificates
in interfaceConfig
-
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 ingetKeyAlgorithms()
, this methods makes ssh-rsa key algorithm more preferred than any of rsa-sha2-*. Otherwise, nothing happens.
-