I was passing sensitive information (between my app and backend) like password in String format. Later on I realized that password can be easily read from heap memory dump as it is stored in text format.
String password = "super_password";
So I decided to use Char array,
Char[] passChar = password.toCharArray();
but I am worried that password can still be read from memory dump character by character. Then I thought of using byte array instead.
byte[] passByte = password.getBytes();
My question: Is it safe to use byte array for passing sensitive information like password ? OR can anyone recommend anything secure ?