I am writing a application where the requirement is to transfer files from a remote SFTP server to the local machine and vice - versa. During the file transfer I want to make sure that no data packets are lost and corrupted in the transit.So the idea is to run a MD5 checksum on the remote file (residing in the sftp server) before the transfer and then start the transfer process. Once the transfer is done, run a md5 on the local file and compare the two checksums.
I am using JSCH to connect to sftp server and the code is in java.But I dont know how to run a md5 on the remote file residing in the SFTP server.My code has to do the MD5 on the remote file before the transfer takes place.Any idea on how to accomplish this please.