ColdFusion FTP Explicit TLS

无人久伴 提交于 2019-12-11 19:18:51

问题


Is it possible to do a ColdFusion FTP connection using Explicit TLS?

I have searched on Google but to no avail.


回答1:


The Apache Commons has an FTPSClient class as well, and I think it is already available in the later versions of Coldfusion.

Just adding an example. It uses a test server that I found available. I am using CF 9.0.2, and did not have to download any additional jars.

ftpsClient = CreateObject("java","org.apache.commons.net.ftp.FTPSClient").init(JavaCast("boolean",true));
ftpsClient.connect(JavaCast("string","ftp.secureftp-test.com"),990);
connected = ftpsClient.isConnected();

WriteOutput("Is Connected:" &  connected & '<br/>');

login = ftpsClient.login('test','test');
WriteOutput("Is Logged in:" &  login & '<br/>');


ftpsClient.logout();
ftpsClient.disconnect();
connected = ftpsClient.isConnected();

WriteOutput("Is Connected:" &  connected & '<br/>');



回答2:


Unless something changed in CF10, CFFTP supports secure FTP but not SFTP or FTPS. You may need to use a java library like FTP4J as mentioned in this blog.

From the FTP4J documentation:

FTPS/FTPES secured connection

The ftp4j library supports both FTPS (FTP over implicit TLS/SSL) and FTPES (FTP over explicit TLS/SSL).

The setSecurity() method can be used to turn on the feature:

client.setSecurity(FTPClient.SECURITY_FTPS); // enables FTPS client.setSecurity(FTPClient.SECURITY_FTPES); // enables FTPES

as Miguel-F pointed out, if you switch the comment on these two lines it should enable FTPES.

//FTPClient.setSecurity(FTPClient.SECURITY_FTPES); // enables FTPES
FTPClient.setSecurity(FTPClient.SECURITY_FTPS); // enables FTPS


来源:https://stackoverflow.com/questions/16584175/coldfusion-ftp-explicit-tls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!