Popular Posts

File Transfer Protocols with java

FTP (File Transfer Protocol):

This tutorial explains about the File Transfer Protocols with java.

FTPS and SFTP both are different protocols.

FileZilla and putty are the FTP Clients to transfer files in java independent way.

here is the brief introduction of FTP, sFTP, FTPs.

FTP (File Transfer Protocol):

Does not take any precautions to protect information transmitted during a session. This includes your username, password, and any files transmitted. During an FTP session, your username and password are transmitted in clear text. If someone is eavesdropping, it is not difficult for them to log your FTP username and password.

In FTP all data is passed back and forth between the client and server in un-encrypted manner. This makes it possible for an eavesdropper to listen in and retrieve your confidential information including login details. With SFTP all the data is encrypted before it is sent across the network.

SFTP (Secure File Transfer Protocol):

It is a secure replacement for FTP (File Transfer Protocol) based on the Secure Shell protocol. Unlike FTP, SFTP encrypts both commands and data providing effective protection against common network security risks. SSH Client and Server provide both command-line SFTP tools and a graphical user interface for Windows users. SFTP encrypts the session, preventing the casual detection of your username, password or anything you’ve transmitted.

FTPs ( FTP over SSL) Protocol:

FTPs implements the original FTP protocol through a separately-created secure tunnel(ssl channel).

it is just a normal FTP where it uses TSL/SSL to encrypt control sesssion(username & password), but not the data session(actual file which we want to transfer).

This is useful when you want encrypt file with your own algorithm and want to send it in secure way, This is best suitable.

FTPs also has option to encrypt the file at the time of transfer.

However, if you are pre-encrypting the file then you do not need to have the data connection encrypted as you do not need to add the overhead of encrypting the data connection, since the file is already encrypted.

Understand that SFTP is SSH file transfer and FTPS is FTP with SSL, FTPS is a file transport layer on top of SSL or TLS.

The FTPS adds SSL-enabled FTP send and receive capabilities, uses the FTP protocol to transfer files to and from SSL-enabled FTP servers.

below one is SCP (Secure Copy)(i never worked with this ) is a non-interactive command-line tool for securely transmitting files from a machine to another.

It is a secure replacement for RCP and provides a similar command-line syntax.

SCP is strongly based on SFTP but is often a more suitable choice when setting up unattended file transfers using scripts.

JAVA APIs to work with these FTP

  • Apache Commons Net: if you want work with FTP and FTPS this is best choice. Remember this API doesn’t support SFTP.

  • JCraft API: It is uses Apache Commons Net as base and exposes their own methods to work with FTP& FTPS. It won’t support SFTP Protocol.

  • Zehon API: http://www.zehon.com

The Zehon libraries have support for FTP, SFTP and FTPS.

They offer a very simple interface in the form of a bunch of static methods to do actions like sending and receiving files. No source code is provided. Can be difficult to debug in case of problems.

They do use Apache Commons Net as a base but some of the power is hidden by Zehon in exchange for simplicity.

No comments:

Post a Comment