Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

What is the best way to encrypt a json object in Java?

$
0
0

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?


Viewing all articles
Browse latest Browse all 148

Latest Images

Trending Articles



Latest Images