+1 vote
by (130 points)
edited

I need to do FTP with SSL (FTPS). I can connect to the server (3rd party) using SecureFX if I check the Disable certificate validation, so that tells me their certificate isn't being validated correctly, but I can't do anything about that...the security is for their benifit so if they don't do it right, I don't care. What I do care about is being able to download the files using FTPS which I can't seem to get to work with Rebex as I can't figure out how to disable certificate validation. Is there a way?

    Dim f As New Rebex.Net.Sftp()
    f.Connect(Host)
    f.Login(UserID, PW)
    f.GetFiles("/ftprca/Outbound/epic", "c:\aatemp\", Rebex.Net.SftpBatchTransferOptions.Default, Rebex.Net.SftpActionOnExistingFiles.OverwriteAll)
    f.Disconnect()
Applies to: Rebex SFTP

1 Answer

0 votes
by (144k points)
edited

You seem to be using "Rebex SFTP" (file transfer over SSH) instead of "Rebex FTP/SSL" (FTPS, FTP over SSL) - please check out our Secure FTP disambiguation page for more information about these protocols and component.

I think you should use Rebex FTP/SSL instead. To skip certificate validation in Rebex FTP/SSL, you can use the following code:

' disable certificate validation - accept any certificate
Dim p As New Rebex.Net.TlsParameters()
p.CertificateVerifier = CertificateVerifier.AcceptAll

Dim f As New Rebex.Net.Ftp()
' not sure whether you need explicit or implicit TLS/SSL
f.Connect(Host, 21, p, FtpSecurity.Explicit)
' f.Connect(Host, 990, p, FtpSecurity.Implicit)
f.Login(UserID, PW)
f.GetFiles("/ftprca/Outbound/epic", "c:\aatemp\", Rebex.Net.SftpBatchTransferOptions.Default, Rebex.Net.SftpActionOnExistingFiles.OverwriteAll)
f.Disconnect()

But please be aware that skipping certificate validation in production environment is greatly discouraged - please check out certificate validation HOWTO for an overview of recommended solutions.

...