I’m encrypting a string in Java, and when I’m printing the encrypted data, I see only question marks.
As an example:
-
Plain text:
jjkkjlkljkj -
Encrypted text:
??????????? -
After decrypting this text again, I’m getting
jjkkjlkljkjagain.
So it looks like the encryption worked right. But why can I see only question marks?
Yes, it’s because you can’t print the strings that are resulting from the encryption.
Note that saving the encrypted result in a string will possibly result in loss of the data, so don’t do that. Take it as a byte array, and convert it to a displayable format, like Base64 or just simple Hex.