In my application password is storing in String & fortify is complainng about this.
Remediation says that "stores sensitive data in a String object, making it impossible to reliably purge the data from memory"
Could anyone help me on this.
Do I need to store password in Char[] anything which are not immutable & how can I do ?
This encrypt function is called from number of place in my application
public static void main(String[] args)
{
System.out.println(Accessible.encrypt("ABCD"));
}
public final static String encrypt(String plaintext)
{
StringBuilder pwd = new StringBuilder();
pwd.append(plaintext);
return new String(pwd.toString().getBytes());
}