In the pure FTP protocol, you donโt have the means to encrypt anything, so the credentials are moved like plain text, and the files, list, etc. move in unencrypted form to / from the server.
If your server supports FTPS, which is a normal regular FTP session over an SSL-encrypted connection, you can do this using the same TIdFTP object that you use, but change the default IO handler to SSL-compatible, for example, an instance of TIdSSLIOHandlerSocketOpenSSL, which performs encryption using the popular OpenSSL library.
In code, it looks like this:
var ftp: TIdFTP; ssl: TIdSSLIOHandlerSocketOpenSSL; begin ftp := TIdFTP.Create(); try ssl := TIdSSLIOHandlerSocketOpenSSL.Create(ftp); ftp.IOHandler := ssl; ftp.Host := 'ftp.myserver.com'; ftp.Username := 'myuser'; ftp.Password := 'mypass'; ftp.Connect; DoWhateverYouWantToDoWithThe(ftp); AndUploadMoreFiles(ftp); ftp.Disconnect; finally ftp.Free; end; end;
source share