Save data to "secure" or hidden file

I have various auto saved & auto loaded settings in my app that I don’t want an end user messing with, what is the best way from preventing them doing this ?

Is there a way to export data (a Table for example) to a format that can not be easily read & therefore edited by a user ?
Or if exporting a full app(as I am on both PC & MAC) from Proccessing is there somewhere in the resulting java files that it can be hidden away?

Or is perhaps the answer to just encrypt and then write out to csv or whatever ?

Thanks you in advance for any advice.

1 Like

If you don’t want a user without any coding experience to read or mess with the data, perhaps consider saving it as a binary file (which has it’s own benefits too). I’m not very experienced with binary files, but I see them a lot in game data files, and almost everywhere which involves a lot of data to be packaged.

What kind of data, what kind of users, and how are you distributing the app?

Is the goal to prevent accidental changes, or to make cheating at a game a bit harder, or to hide passwords?

Is network access involved – can they be remote resources?

You might be interested in this AES for P3 example:

Although if you just want curb-high protection against people fiddling with files you could use something like rot13 and call it a day.

In general you don’t want to keep resources that need to be updated at runtime in a jar, even if you can. jars are zips, so editing is terrible, and may require that the zip be rebuilt and replaced on the fly.

or in this example i used a readable settings file
with a MD5 encrypted password

read here

you have to download and RUN the code, as that project has no settings file,
that was what this exercise was about, to create a default settings file at first run.

1 Like

Thanks for the suggestions,
Data being saved is mostly just the last used settings from around 20 UI input fields.
No network access involved.
In reality none of it needs to be encrypted, as my goal is just to stop accidental changes and fiddling by users digging around in the files.

Though there are also a few other important settings such as last COM port used as the app is the UI for a custom piece of hardware connected on USB.

I will have a play around with both the AES and MD5 examples as that could be useful further down the line.