2

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.:

YouTube 500 error

2 Answers 2

3

Encrypt the data and return it as a base64 character string.

Sign up to request clarification or add additional context in comments.

Comments

2

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:

Java simple encryption

How to encrypt String in Java

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.