Tim Moores wrote:
Should I do something like String encodedEncryBytes = Base64.getEncoder().encode(encryBytes) instead?
Yes
How do I get the actual encrypted string value
There is no such thing. Encrypted data is not character data, and thus not a string.
Thank you. As you suggested, I tried with the following changes:-
Encryption:-
Decryption:-
Does this look good? Now I get the following exception thrown at this step in the decrypt method:- byte[] decodedDecryptedBytes = Base64.getDecoder().decode(decryptedBytes);
java.lang.IllegalArgumentException: Illegal base64 character 25
at java.util.Base64$Decoder.decode0(Base64.java:714)
at java.util.Base64$Decoder.decode(Base64.java:526)
at com.hm.um.security.UoloSecurityImpl.decrypt(UoloSecurityImpl.java:104)
at com.hm.um.security.UoloSecurityImpl.main(UoloSecurityImpl.java:30)