Reputation: 9241
I'm looking for a simple Java encryption solution that will allow me to specify the encoding such that the encrypted data can be embedded in a JSON document.
Why? My web service returns a descriptive JSON message when errors occur. In the event of an internal server error, I'd like to include a field that contains diagnostic information, however I want to encrypt this data to avoid potential security issues.
I'm going for something similar to YouTube's Internal Server Error, plus JSON and minus monkeys.:
Upvotes: 2
Views: 9937
Reputation: 6581
As Hot Licks said, encrypt using your choice method to achieve the level of SECURITY you want vs performance/simplicity. Then use Base64 encoding on that data to make it easy to transport in your JSON. There are several Base64 libraries around. Have a look at these stack overflow answers for good Java encryption options:
Upvotes: 2