In the similar question "Conversion of byte[] into a String and then back to a byte[]" is said to not to do the byte[] to String and back conversion, what looks like apply to most cases, mainly when you don't know the encoding used.
But, in my case I'm trying to save to a DB the javax.crypto.SecretKey data, and recoverd it after.
The interface provide a method getEncoded() which returns the key data encoded as byte[], and with another class I can use this byte[] to recover the key.
So, the question is, how do I write the key bytes as String, and later get back the byte[] to regenerate the key?