I am going to protect an image file (ancient manuscript) which will be available online for everyone to download. I want to protect the file in these situations:

  1. When it's on the server, I need to protect the file from any alteration (I mean should previously apply digital watermarking to the file and digital signature or MAC to provide the copyright, data integrity and authenticity)

  2. When the receiver downloads a copy of my file (I want to ensure no alteration done by an adversary in the way from the sender to the receiver)

Will a digital signature and digital water mark provide such a service?

Any better suggestions to protect the online image file?

  • 4
    This question is a duplicate of basically all three of your previous questions that were all put on hold for various reasons. In case you haven't noticed, you can edit your questions to be more in line with requirements and guidelines described in FAQ and How to Ask pages, and/or edited to follow reservations of our reviewers as described in the reason for your questions' closure / being put on hold. Please review your previous questions and edit them accordingly. Posting new yet much the same questions only needlessly adds to our workload, and might not be tolerated for long. Thanks! – TildalWave Jul 4 '13 at 13:34

There is no way any cryptographic tool of any kind will protect a file against alterations. At best, such tools will make alteration detectable in a way that an hostile entity will not be able to hid.

"Detectable" means that it will be detected by somebody. Depending on who you want that somebody to be, various tools are to be applied. A MAC is computed with a secret key, and the same key is used to verify it; so, if you use a MAC, then whoever can verify that the file is unaltered also has all the technical power need to actually alter the file and still avoid detection. If you want verifiers to be distinct from provers (the "prover" is the one who states "this is the correct file" in the first place), then you will need digital signatures.

None of this would prevent a hacker who has taken control of your server from modifying the file on the server. At best, users who download the file and verify the signature may notice that something is amiss. Moreover, signatures on files require some tools to verify them. This can be done relatively easily in PDF files because the PDF format includes provisions for signatures and the usual PDF reader, namely Acrobat Reader from Adobe, includes the necessary code. It still requires some user education, so that the users get alarmed if the PDF they download turns out not to be signed.

TO prevent a hacker from modifying the file on the server, then forget all this talk about signatures and MAC and whatsnot; just make sure that your server cannot be hijacked by outsider. This is the realm of system administration, vulnerabilities and patches, and firewalls. To avoid alterations in transit, just make your server use SSL (i.e. "HTTPS").

  • ,Thanks, these are very helpful tips for good start – user27889 Jul 4 '13 at 14:11

If you will accept the compromise that "Any alterations to the image are detectable" then both of your requirements can be achieved by distributing a hash of the image through a different channel as the image itself.

The reason for using a different channel is to prevent someone who can alter the image either on the server or as it travels across the network from being able to also alter the hash in the same way.

This is exactly how many open-source software projects are delivered. The source code and/or the compiled binaries are mirrored by anyone who wants to support the project and anyone downloading from a potentially untrusted source can verify that they have download exactly the same file by downloading just the hash from the project creator's website, calculating the hash of the downloaded file and comparing the two.

On Linux this can be done with the md5sum and shasum tools. On Mac, the tools are md5 and shasum.

Distributing two different types of hash (such as md5 and sha256) can help protect against collisions.

  • 1
    Adding on to your tools recommendation, I recommend HashCheck for Windows. code.kliu.org/hashcheck – user10211 Jul 4 '13 at 13:39
  • Excellent. I understand that there are some people still using Windows. It's nice to have them covered too. – Ladadadada Jul 4 '13 at 13:40
  • Why not suggest a signed PDF document instead ? It's, basically, the same solution but has a stronger validation mechanism and uses tools that are more familiar to the average user, not requiring any additional software beyond a PDF reader that supports signature validation ? – Stephane Jul 4 '13 at 13:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.