Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

Do we need to have cipher algorithm enabled in the client machine to do sftp connectivity if it is specified code level?

$
0
0

I am connecting to CB SFTP server using Rebex dll in .net 3.5 framework. I want to know if i specify the key exchange algorithm code through do we need to have that cipher enabled in the client machine from where the connectivity code is called.
My connectivity code is as below:
private void ConnectSftp(ref Sftp objSFTP)
{
try
{
SftpConnectionState IsActive = null;
string[] sSFTPHost = ConfigurationSettings.AppSettings["SFTPHost"].Split('|');

            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 { }
        }
    }

Viewing all articles
Browse latest Browse all 3862

Trending Articles