I need to decode a Base64 char array without converting it to a String. The char array is a password, and for security reasons I am not allowed to convert it to a String (this requirement is non-negotiable).
The java.util.Base64.Decoder.decode method accepts byte[]
, ByteBuffer, and String, but not char[]
.
Security concerns of using a String to store sensitive data
per Jim Archer's comment
- Strings are immutable
- They can only be purged from memory by the Garbage Collector (which cannot be forced to do it)