Removing algorithms

If you want to remove any particular algorithm supported by the client you can do so by editing the supported algorithms on the Ssh2Context.

For example to remove a Key Exchange or Public Key algorithm you can use the following code:

Ssh2Context ssh2Context = (Ssh2Context) con.getContext(SshConnector.SSH2);

// Key Exchange

ssh2Context.supportedKeyExchanges().remove(Ssh2Context.KEX_DIFFIE_HELLMAN_GROUP1_SHA1);   

 

// Public Key

ssh2Context.supportedPublicKeys().remove(Ssh2Context.PUBLIC_KEY_SSHDSS);

 

When removing Ciphers or Hmacs you need to do this on both directions of the connection, client->server and server-client. For example:

Ssh2Context ssh2Context = (Ssh2Context) con.getContext(SshConnector.SSH2);

// Ciphers

ssh2Context.supportedCiphersCS().remove(Ssh2Context.CIPHER_ARCFOUR);

ssh2Context.supportedCiphersSC().remove(Ssh2Context.CIPHER_ARCFOUR);

 

// HMac

ssh2Context.supportedMacsCS().remove(Ssh2Context.HMAC_MD5);

ssh2Context.supportedMacsSC().remove(Ssh2Context.HMAC_MD5);

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.