I know we can do Base64Encoding. The problem is, it creates a string that is always the same.
If Base64 encoding creates a string that is "always the same" then you MUST be starting with the same input every time.
Converting to and from strings with getBytes, etc is always going to be a disaster with random binary data because String conversion involve some assumptions about encoding. The sequence of envents:
byte[] -> base64encode -> (a string in ASCII chars) -> base64decode -> byte[]
is safe with respect to the string being transmitted, read, etc.
Bill