0 votes
by (620 points)

            if (objSFTP == null)
                objSFTP = new Sftp();
                //--- commented by mathew for SFTP Rebex connectivity issue on 20240513 ---
           // else
             //   IsActive = objSFTP.GetConnectionState();

            //--------------------------------------------------------------------------------------


            IsActive = objSFTP.GetConnectionState();

            if (IsActive == null || IsActive.Connected == false)
            {
                //--- Added by mathew for SFTP Rebex connectivity issue on 20240513 ---
                **string IsCipherPriorityRequired = string.Empty;
                IsCipherPriorityRequired = Common.GetParamValue("IsCipherPriorityRequired");
                if (IsCipherPriorityRequired != string.Empty)
                {
                    if (IsCipherPriorityRequired.ToUpper() == "YES")
                    {
                        **objSFTP.Settings.SshParameters.KeyExchangeAlgorithms =
            SshKeyExchangeAlgorithm.DiffieHellmanGroup14SHA1;**
                    }
                }**
                //-----------------------------------------------------------------------------
                objSFTP.Connect(sSFTPHost[0], int.Parse(sSFTPHost[1]));
                objSFTP.Login(sSFTPHost[2], sSFTPHost[3]);
            }
            try
            {
                SetSFTPStatus("C", 2);
            }
            catch { }
        }
        catch (Exception ex)
        {
            objSFTP.Disconnect();

            Common.WriteLogService("Error while connecting SFTP: " + ex.Message, ex.StackTrace, true);
            try
            {
                SetSFTPStatus("E", 2);
            }
            catch { }
        }
    }
Applies to: Rebex SFTP

1 Answer

0 votes
by (150k points)

by (620 points)
So even if i do not specify the key exchange algorithm in the code the sftp connectivity will work. Are there chances to lose connectivity in between using this
by (150k points)
In theory, a software or device along the way (such as a firewall, a router or antivirus software) could prevent the initial SSH negotiation based on ciphers being used. However, we have not encountered such behavior yet.
...