I am using WinSCPnet, Version=5.19.0 for file transfer using SFTP. The vendor where I was transferring file has deprecated a couple of ciphers. I want to check which cipher or encryption algorithm is being used by SFTP session which I am using in my code.
Here is my code to open the SFTP connection:
SessionOptions sessionOptionsSFTP = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = sftpServerIP,
UserName = sftpUserID,
Password = sftpPassword,
PortNumber = sftpPort,
SshHostKeyFingerprint = sftpHostKey,
Timeout = new TimeSpan(0, 2, 0)
};
Session sessionSFTP = new Session();
sessionSFTP.Open(sessionOptionsSFTP);
log.Info("SFTP session has been opened");
Is there a way to log or check which algorithm is being used?
To check what algorithms are supported by your version of WinSCP .NET assembly, lookup the
winscp.exe
binary in your assembly package (or just download WinSCP 5.19 binary separately).And run it with
/info
command-line parameter. You will get:To check what algorithms are actually used by your session, inspect the session log file. Enable it by setting
Session.SessionLogPath
.Though I strongly discourage you from using old version of WinSCP. Use the latest version instead.