Package org.apache.sshd.common.config
Class SshConfigFileReader
java.lang.Object
org.apache.sshd.common.config.SshConfigFileReader
Reads and interprets some useful configurations from an OpenSSH configuration file.
- Author:
- Apache MINA SSHD Project
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <M extends AbstractFactoryManager>
Mconfigure
(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configures anAbstractFactoryManager
with the values read from some configuration.static <M extends AbstractFactoryManager>
MconfigureCiphers
(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureCiphers
(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureCompression
(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureCompression
(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configure the factory manager using one of the knownCompressionConfigValue
s.static <M extends AbstractFactoryManager>
MconfigureKeyExchanges
(M manager, String value, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureKeyExchanges
(M manager, PropertyResolver props, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureMacs
(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureMacs
(M manager, PropertyResolver resolver, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureSignatures
(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureSignatures
(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) static BuiltinCiphers.ParseResult
getCiphers
(PropertyResolver props) static CompressionFactory
getCompression
(PropertyResolver props) getKexFactories
(PropertyResolver props) static BuiltinMacs.ParseResult
getMacs
(PropertyResolver props) getSignatures
(PropertyResolver props)
-
Method Details
-
getCiphers
- Parameters:
props
- ThePropertyResolver
- ignored ifnull
/empty- Returns:
- A
ParseResult
of all theNamedFactory
-ies whose name appears in the string and represent a built-in cipher. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown ciphers. Note: it is up to caller to ensure that the lists do not contain duplicates - See Also:
-
getMacs
- Parameters:
props
- ThePropertyResolver
- ignored ifnull
/empty- Returns:
- A
ParseResult
of all theNamedFactory
-ies whose name appears in the string and represent a built-in MAC. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown MACs. Note: it is up to caller to ensure that the list does not contain duplicates - See Also:
-
getSignatures
- Parameters:
props
- ThePropertyResolver
- ignored ifnull
/empty- Returns:
- A
ParseResult
of all theNamedFactory
whose name appears in the string and represent a built-in signature. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown signatures. Note: it is up to caller to ensure that the list does not contain duplicates - See Also:
-
getKexFactories
- Parameters:
props
- ThePropertyResolver
- ignored ifnull
/empty- Returns:
- A
ParseResult
of all theDHFactory
-ies whose name appears in the string and represent a built-in value. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown ones. Note: it is up to caller to ensure that the list does not contain duplicates - See Also:
-
getCompression
- Parameters:
props
- ThePropertyResolver
- ignored ifnull
/empty- Returns:
- The matching
NamedFactory
for the configured value.null
if no configuration or unknown name specified - See Also:
-
configure
public static <M extends AbstractFactoryManager> M configure(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configures an
AbstractFactoryManager
with the values read from some configuration. Currently it configures:- The
Cipher
s - via theConfigFileReaderSupport.CIPHERS_CONFIG_PROP
- The
Mac
s - via theConfigFileReaderSupport.MACS_CONFIG_PROP
- The
Signature
s - via theConfigFileReaderSupport.HOST_KEY_ALGORITHMS_CONFIG_PROP
- The
Compression
- via theConfigFileReaderSupport.COMPRESSION_PROP
- Type Parameters:
M
- The generic factory manager- Parameters:
manager
- TheAbstractFactoryManager
to configureprops
- ThePropertyResolver
to use for configuration - Note: if any known configuration value has a default and does not appear in the properties, the default is usedlenient
- Iftrue
then any unknown configuration values are ignored. Otherwise anIllegalArgumentException
is thrownignoreUnsupported
- filter out unsupported configuration values (e.g., ciphers, key exchanges, etc..). Note: if after filtering out all the unknown or unsupported values there is an empty configuration exception is thrown- Returns:
- The configured manager
- The
-
configureCiphers
public static <M extends AbstractFactoryManager> M configureCiphers(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) -
configureCiphers
public static <M extends AbstractFactoryManager> M configureCiphers(M manager, String value, boolean lenient, boolean ignoreUnsupported) -
configureSignatures
public static <M extends AbstractFactoryManager> M configureSignatures(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) -
configureSignatures
public static <M extends AbstractFactoryManager> M configureSignatures(M manager, String value, boolean lenient, boolean ignoreUnsupported) -
configureMacs
public static <M extends AbstractFactoryManager> M configureMacs(M manager, PropertyResolver resolver, boolean lenient, boolean ignoreUnsupported) -
configureMacs
public static <M extends AbstractFactoryManager> M configureMacs(M manager, String value, boolean lenient, boolean ignoreUnsupported) -
configureKeyExchanges
public static <M extends AbstractFactoryManager> M configureKeyExchanges(M manager, PropertyResolver props, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) - Type Parameters:
M
- The generic factory manager- Parameters:
manager
- TheAbstractFactoryManager
to set up (may not benull
)props
- The (non-null
)PropertyResolver
containing the configurationlenient
- Iftrue
then any unknown/unsupported configuration values are ignored. Otherwise anIllegalArgumentException
is thrownxformer
- AFunction
to convert the configuredDHFactory
-ies toNamedFactory
-ies ofKeyExchange
ignoreUnsupported
- Filter out any un-supported configurations - Note: if after ignoring the unknown and un-supported values the result is an empty list of factories and exception is thrown- Returns:
- The configured manager
- See Also:
-
configureKeyExchanges
public static <M extends AbstractFactoryManager> M configureKeyExchanges(M manager, String value, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) -
configureCompression
public static <M extends AbstractFactoryManager> M configureCompression(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configure the factory manager using one of the knownCompressionConfigValue
s.- Type Parameters:
M
- The generic factory manager- Parameters:
manager
- TheAbstractFactoryManager
to configureprops
- The configurationProperties
lenient
- Iftrue
and an unknown value is provided then it is ignoredignoreUnsupported
- Iffalse
then check if the compression is currently supported before setting it- Returns:
- The configured manager - Note: if the result of filtering due to lenient mode or ignored unsupported value is empty then no factories are set
-
configureCompression
public static <M extends AbstractFactoryManager> M configureCompression(M manager, String value, boolean lenient, boolean ignoreUnsupported)
-