c# - Validating a received file using a checksum -
i need pass file using web service (i have control on webservice). fulfill security requirements need make sure passed file not modified or corrupted. plan below.
- convert file
byte[]
calculate hash,
system.security.cryptography.md5.create().computehash(stream);
pass file
when passing file (byte array) web service, passing hash value practice?
or need follow other process check files? best way handle this?
if it's security requirement, sending md5 sum along file not want do: can intercept file can rewrite checksum well.
i use crcs, instead: more sensitive small changes in file (or stream's) contents, , more compact , easier compare. .net doesn't appear have crc implementation, found nice 1 online appears work well, calculating crc-32 in c# , .net.
does client have capability of computing checksum independently on side well?
Comments
Post a Comment