Question
Why char array is preferred over String for passwords?

Answers

Strings are immutable. That means once you’ve created the string, if another process can dump memory, there’s no way (aside from reflection) you can get rid of the data before GC kicks in.
With an array, you can explicitly wipe the data after you’re done with it: you can overwrite the array with anything you like, and the password won’t be present anywhere in the system, even before garbage collection.
So yes, this is a security concern – but even using char[] only reduces the window of opportunity for an attacker, and it’s only for this specific type of attack.   Your Comment




More Software,Java Questions..
What is the inputsplit in map reduce software?

Can variables be used in Java without initialization?

What is the difference between java bean and enterprise java bean?

What is software configuration management?

How does the java database connectivity (jdbc) work?

What are the advantages of threads in java?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

What is object cloning in Java?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?



Search
Can you Answer!!
  • Q Not Gate can be operated by –
  • Q The metal used in storage batteries is
  • Q Mention the type of fruit in Barbeyaceae Family?
  • Q It's raining and have forgotten your umbrella, so you shelter in an unlocked car. Are you guilty of the offence of allowing yourself to be carried in a conveyance without the owner's consent?
  • Q What is fundamental accounting equation?
  • Q Is transport allowance admissible in all the cases?
  • Q How do I handle alphabetic pagination?
  • Q A ______ is a pair of forces, equal in magnitude, oppo- sitely directed, and displaced by perpendicular distance or moment.
  • Q Which function is used to find the largest integer less than or equal to a specific value?
  • Q Can I have more than one action in my intent-filter?
  • Q Who first starred in the film The Boy in the Plastic Bubble