0 votes
by (120 points)

Preset parts need to be adjusted,How to remove unwanted SSH algorithms?

1 Answer

0 votes
by (148k points)

This can be achieved using methods and/or properties of Sftp.Settings.SshParameters or Ssh.Settings.SshParameters. See SSH ciphers for instructions.

Example:

var sftp = new Rebex.Net.Sftp();

// only allow RSA and AES algorithms
sftp.Settings.SshParameters.HostKeyAlgorithms = SshHostKeyAlgorithm.RSA;
sftp.Settings.SshParameters.EncryptionAlgorithms = SshEncryptionAlgorithm.AES;

// only allow particular SSH ciphers
sftp.Settings.SshParameters.SetHostKeyAlgorithms("rsa-sha2-256", "rsa-sha2-512");
sftp.Settings.SshParameters.SetEncryptionAlgorithms("aes256-gcm@openssh.com", "aes256-ctr");

Note: If you use both the property and the method to set algorithms of a specific category, only algorithms allowed by both of these are going to be enabled.

...