@Zelta said:
which method is easier? or more efficient when reading / applying the data in-game?
JSON is probably easiest from a security perspective, since it's a human-readable format prior to encryption. This makes it a lot easier to verify the data that is being decrypted is the same as the data you passed to be encrypted. Looking at the example in the crypto class, I do not think it would be too difficult to get working, you'd just need to make sure the key and certificate are usable and have a condition if they are missing, since you wouldn't be able to read the file without it.
Storing the data as binary using the File class also is a usable solution, and one I've opted for a few times for saving user data. It's binary, so the potential of someone simply opening it and modifying it are a lot lower, as they would need to use a Godot instance or a program that allows them to read and write the binary data Godot stores. It's not completely fool proof and probably not quite as secure as using JSON with the crypto class, but it would probably prevent all but the most determined.
Storing in binary also would be easier for Godot to read at runtime, as it's already in the correct format. JSON is a little slower because it has to be parsed into Godot data types, while with the binary data stored in the File class, it can just be retrieved and used.
If I was going to choose one of the two, I'd probably use the File class. Then you don't need to worry about storing keys and certificates to open and use the data, most everyone will not be able to cheat and modify the values, and the data is pretty well optimized to being used in Godot. You can even use store_var and get_var to store variables directly, as long as it's a Godot type. But that's just what I would do, I would recommend you choose what you think will work best for your project and go with that :smile: