I have a Json array
JsonArray people;
which holds JSON objects representing people.
Currently I am saving them as plaintext in a json file.
try {
OutputStream out = new FileOutputStream('storage.json');
JsonWriter writer = Json.createWriter(out);
writer.writeArray(people);
writer.close();
}
However I want these files to be encrypted so that they are worthless without the key to decrypt them.
What is the best way to do this? Should I encrypt the JSON array object or can I just encrypt the entire array before writing it? What is the most recommended Java crypto functions that I should use to do this?








