Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO

Does ftpnetpro have the facility to carry out a SHA512 hash check on a remote server?

0 votes
asked Jun 6 in .NET FTP by stumac68 (150 points)
In a nutshell.

We have a file to upload to a remote server. After upload, I want to do a SHA512 hash compare to make sure the file uploaded without corruption.

I can generate a SHA512 hash locally but how do I then generate the SHA512 on the remote server so I can compare the two? Which part of the API covers this as I've done a search on the documentation and come up with a blank.

1 Answer

0 votes
answered Jun 6 by support2 (143,750 points)
selected Jun 6 by stumac68
Best answer
There's a property called IntegrityCheckTransfers which forces CRC checks on files after they are uploaded if this feature is available on the server.

Most servers aren't going to support generating a SHA512 hash on a named file, and even if they did, there's no standard way of calculating it. CRC is your best hope.
commented Jun 6 by stumac68 (150 points)
Thanks support.
So I've added the following lines to the instantiation of a SecureFTPConnection:
x.PreferredMACAlgorithms = EnterpriseDT.Net.Ssh.SSHMACAlgorithm.HMAC_SHA2_512;
x.IntegrityCheckTransfers = true;

How do I see if it fails this SHA512 integrity check?
Is it just a case of the upload failing in general (and reading the exception) or is there something more specific I need to interrogate?
commented Jun 6 by support2 (143,750 points)
PreferredMACAlgorithms is a setting for the SSH MAC algorithm - it isn't used for file integrity checking. You can't set that.

All you can do is set IntegrityCheckTransfers = true. If CRC is available, it'll use it, otherwise it will compare file lengths which is the next best option.