I am having an issue connecting to an SFTP in a production environment. My code works fine in my development area.
When I try connecting to the server in production I get the following error:
System.Exception: System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
at System.Security.Cryptography.MD5CryptoServiceProvider..ctor()
at h.a(String A_0, Int32 A_1)
at h.a(Byte[] A_0, String A_1)
at f5.a(String A_0, String A_1)
at hh.e()
at hh.a(a2 A_0)
at a8.a(ai A_0, b8 A_1, gx A_2, a2 A_3)
at a8.a(ai A_0, b8 A_1, Socket A_2)
at EnterpriseDT.Net.Ftp.Ssh.SSHFTPClient.Connect()
at EnterpriseDT.Net.Ftp.SecureFTPConnection.Connect()
at Utility.SFTPWrapper.OpenConnection()
at AutomatedTravelApplication.RunFTP.UploadDailyTravelDataSFTP()
Is there anyway to have the connect method call a different hashing algorithm other than MD5? I could not seem to find any settings to set this.
I am using edtFTPnetPRO v4.2.1.0. My code looks similiar to this:
SecureFTPConnection.LogLevel = EnterpriseDT.Util.Debug.LogLevel.All;
SecureFTPConnection.LogFile = logfile;
SecureFTPConnection ftpCon = new SecureFTPConnection();
ftpCon.ServerValidation = SecureFTPServerValidationType.Automatic;
ftpCon.Protocol = FileTransferProtocol.SFTP;
ftpCon.AuthenticationMethod = AuthenticationType.PublicKey;
ftpCon.PreferredHostKeyAlgorithms = SSHPublicKeyAlgorithm.RSA;
ftpCon.KnownHosts.AddKnownHost(hostName, serverPublicKeyLocation);
ftpCon.ClientPrivateKeyFile = clientPrivateKeyLocation;
try
{
this.ftpCon.UserName = this.userName;
this.ftpCon.Password = this.password;
this.ftpCon.ServerAddress = this.serverAddress;
this.ftpCon.Connect();
}
catch (Exception ex)
{
this.errorText = ex.Message;
this.errorString = ex.ToString();
}
There is not much in the log as it errors out before it can connect.
Thanks in advance to anyone who might have some insight to my issue.