I have a question I am hoping to be able to get some assistance with. I know this question have been asked before and I have gone through a bunch of posts over the last few days. I have a form that allows users to enter username and password and stores those in a registry key, that key is then referenced in a different app. I added my code for the app that sets the keys is someone able to explain to me the best way to provide the password some secrecy.
private void button5_Click(object sender, EventArgs e)
{
Regex myRegularExpression = new Regex("@");
u_p.BackColor = Color.White;
u_n.BackColor = Color.White;
if (myRegularExpression.IsMatch(u_n.Text))
{
if(!String.IsNullOrEmpty(u_p.Text))
{
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);
key.CreateSubKey("####");
key = key.OpenSubKey("####", true);
key.CreateSubKey("Backup");
key = key.OpenSubKey("Backup", true);
key.SetValue("u_name", u_n.Text);
key.SetValue("u_pass", u_p.Text);
MessageBox.Show("Username and Pass Updated Successfully");
}
else
{
MessageBox.Show("no password entered");
u_p.BackColor = Color.OrangeRed;
}
}
else
{
MessageBox.Show("not a proper username entered");
u_n.BackColor = Color.OrangeRed;
}
}