2

I have a private file storage for users and I would like to enforce that the files are downloaded directly from my storage and not via some peer sharing. So I was wondering whether it would be possible to add few extra bytes to each downloaded file so it is still executable but if I find some reuploaded file I would be able to say which user downloaded it.

Is such approach possible?

Considered file format mights include: MS Word files, PDF, RAR, ZIP files

EDIT:

I was thinking more about the concept and one thing crossed my mind: What if I set the creation date & modified date of the file to a specific and unique date? For example: 1980/05/16 10:12:54

Of course - If someone wants to remove the stamp he can always do so but most of the users will not figgure it out.

Are there any problems with this approach? Do you see other "attributes" that could be set easily?

Vojtech B
  • 2,837
  • 7
  • 31
  • 59
  • Please tag your question with some platform information (i.e. Windows, Android, ?), and the programming language you are using. Overall, your question is very underspecified. – Robert Harvey Apr 03 '14 at 19:46
  • Question editted. But After all my question aims to general binary file structure. – Vojtech B Apr 03 '14 at 19:49
  • Yes, language and platform are actually quite irrelevant here. I can understand it from a "people being able to find your question" standpoint though; without tags you're likely to be overlooked. – omgz0r Apr 03 '14 at 19:50
  • 2
    @VojtechB "General binary file structure" varies immensely by platform, however, which is the point of Robert's question. Trying to put a few extra bytes into an EXE will almost certainly not work the same way as trying to put a few extra bytes into a Mac app, which will in turn almost certainly not work the same way as putting a few bytes into a Linux app. Different binary formats require different approaches. – cf- Apr 03 '14 at 19:50
  • 1
    I'd read up a little on something called 'Steganography'. It is the art of hiding information in something that serves a different purpose - like encoding a message in a painting, that sort of thing. Depending on your filetype, there are different approaches. Can you tell me a little more about the files you are sharing? – omgz0r Apr 03 '14 at 19:49
  • Ok, valid point. I updated the question again – Vojtech B Apr 03 '14 at 19:53
  • This is usually called "watermarking". Literally it means adding a visual but invisible-to-the-eye stamp to something which makes you able to trace its origin, but the digital term covers everything from adding visual stamps to images to adding bits to binary files. – bzlm Apr 03 '14 at 19:55

1 Answers1

1

It sounds like you may want to just stick to header data. A lot of file types you've listed allow for adding information you're talking about into their headers. Beyond that, you're talking about very varying structures and adding anything beyond their scope will require custom code for each file type.

Here's a good post on SO which discusses handling metadata (read through all the answers, not just the accepted one): Read/Write 'Extended' file properties (C#)

Community
  • 1
  • 1
B.K.
  • 9,982
  • 10
  • 73
  • 105