سؤال

Im pretty sure this is a question that someone already has made, but Im also sure that this has a concept name which I dont know and I would like to get known, therefore I can research more about.

My java app has some setup files, which can be openned as a txt file to manually modify. I would like to prevent those files from being openned manually (by that I mean through the explorer and notepad), I only want them to be modified thorugh the GUI of my application. How people handle this? Some sort of cryptography for each setup file?

هل كانت مفيدة؟

المحلول

I don't think that it is possible to prevent opening a file. But you can put them in system folders e.g. %PROGRAMDATA%. Not exactly what you are asking for but hides them at least from an "average" user and is a common practice.

You could also serialize and deserialize your setup files in binary format.

Another way is - like you proposed - crypting them.

نصائح أخرى

It depends on how secure you want it to be. If you just want to prevent modification by casual users, you could pass some sort of obfuscation over the text to discourage people (e.g. xor with a known value), or you could zip each file.

If you want it more secure, such that even someone with some smarts can't get into them, then you would want to encrypt the files. You could do a search for "java encryption" to see where people have gone with that.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top