How can I have different algorithm settings for each client?

To configure the various algorithm preferences for a client connection you make changes to the Ssh2Context returned from the SshConnector object. Normally these context's share the same algorithm settings so that this does not have to be performed for each connection.

One extreme example of this is a FIPS mode client, when you enable FIPS mode on the Ssh2Context it removes any algorithms that are not supported by FIPS. What if you wanted to have 2 clients in the same JVM, one using FIPS mode and the other not?

The answer is to set the global per-context algorithm preference. Once enabled this ensures each Ssh2Context is configured with its own set of algorithm factories, so any changes made to one context are not reflected in the other.

Call the following before any other usage of the API.


After calling each SshContext has its own set of preferences and calling enableFIPS on one will not affect any other.

Have more questions? Submit a request


Please sign in to leave a comment.