How can I make my delphi application use FTPS instead of FTP (indy)

user1398287 picture user1398287 · Feb 13, 2013 · Viewed 10.6k times · Source

Here's my program:

Application.FTP.Host:= vHost;
Application.FTP.Port:= vPort;
try
  Application.FTP.AutoLogin := false;
  Application.FTP.Connect;
  Application.FTP.IOHandler.RecvBufferSize := 2048;

I'm using TIdFTP component in Delphi XE3.

I think I have to use something like this...

 Application.FTP.UseTLS := utUseRequireTLS;

but the compiler doesn't like that line

How can I get my FTP application to use FTPS ?

Answer

Remy Lebeau picture Remy Lebeau · Feb 13, 2013

First, do you need SFTP (FTP over SSH) or FTPS (FTP over SSL)? They are not the same thing. Indy does not support SSH at this time. For SSL, you can attach an SSL IOHandler, such as TIdSSLIOHandlerSocketOpenSSL, to the TIdFTP.IOHandler property and then set the TIdFTP.UseTLS property to anything other than utNoTLSSupport (yes, TIdFTP does have a UseTLS property). If you need to encrypt the actual file transfer connections, not just the command connection, then set the TIdFTP.DataPortProtection property to ftpdpsPrivate.