I am using IBMJCECCA provider. Encrypting text and writing it to MQ and retrieving it on another machine and trying to decrypt.
When I print the value, I do not see anything. But when I check for length of the decrypted string, I see correct length. encrypt and decrypt methods return byte using which I am constructing string through new String(bytes). I have even tried passing various character sets to new String(bytes, charset) and it doesn't work. I'm clueless on what is happening here. I have done encryption and decryption on same system (tried separately for both machines) and it works. That confirms, there is no issue with accessing the keys.
Any suggestions or thoughts that could show some pointer would be of great help!
As a rule of thumb, you should never use new String(byte) or String.getBytes(). In this day and age of heterogenous hardware and software, always be explicit about the character encoding. What's more, encrypted data is binary data, not character data - it can't be stored as a string at all (unless you converted it to character data via something like base-64).
When I print the value, I do not see anything.
What does this mean - how are you trying to print it, and where to? Post a relevant code excerpt.