Skip to content

SSH.Session.SetPreferredAlgorithms

Andrew Lambert edited this page Nov 26, 2022 · 10 revisions

SSH.Session.SetPreferredAlgorithms

Method Signature

 Sub SetPreferredAlgorithms(Type As SSH.AlgorithmType, Preferred() As String)

Parameters

Name Type Comment
Type AlgorithmType The type of algorithm.
Preferred String array A list of one or more preferred algorithms in order of priority.

Remarks

Prior to calling Session.Connect, you may use this method to specify a list of acceptable algorithms for the specified AlgorithmType. If none of your preferred algorithms are supported by the server then the connection will fail. If any of the algorithms in the list are not supported by libssh2 then they are ignored.

Example

  Dim session As New SSH.Session
  Dim prefs() As String = Array("ecdh-sha2-nistp384", "ecdh-sha2-nistp256", "rsa2048-sha256")
  session.SetPreferredAlgorithms(SSH.AlgorithmType.KeyExchange, prefs)
  If Not session.Connect("ssh.example.com", 22) Then
    Call MsgBox("Unable to establish SSH connection.", 16, "Connection failed")
  End If

See also

Clone this wiki locally