Question

I believe this is going to be a big question but I searched the web for at least an hour for an answer and I hope here I'll get the answer.
So the thing is I want to create my own file extension that will essentially be a binary file that my program will obviously will know how to interpret.
I know how to create a binary file and read from it, I understood that all I need is to change the extension and check it before I start reading the file.

The question is even if I create my own extension and check for it before start reading, I can't know that the file was really created by my application, someone could just change the extension and my application won't get the data it needs (of course I'll put everything in a try and catch so the application won't crush).

Is there a way to sign a binary file before opening it so people that get the file can know that my application created that file and not something that someone changed to look like my file type?

It's more of an idea I have so I don't have any code to show or any example other than this scenario.
All I need is something that people will know came from me and not something that every other person can generate on his own (not talking about programmers, I'm talking about regular people).

If you know anything about this subject please direct me to the answer or if you know post it here.

Was it helpful?

Solution 2

I would create a special sequence at the beginning of the file (a file header)

OTHER TIPS

One way could be to encrypt the contents of the file, then have your application decrypt it.

Anyone opening the file in your application would immediately know if that application generated it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top