Just stuck on the Password Hash and Salt
I’ve tried to generate it my self but failed using the code below as it’s generating the wrong salt value
public void GetSettings(InstallationInfo inst)
{
inst["admin.username"] = txtUsername.Text;
int saltSize = 18;
string salt = CreateSalt(saltSize);
inst["admin.password.salt"] = salt;
inst["admin.password"] = CreatePasswordHash(txtPassword.Text,salt);
if (chkCreateSample.Checked)
inst["CreateSample"] = "Yes";
}
private static string CreateSalt(int size)
{
// Generate a cryptographic random number using the cryptographic
// service provider
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
byte[] buff = new byte[size];
rng.GetBytes(buff);
// Return a Base64 string representation of the random number
return Convert.ToBase64String(buff);
}
private static string CreatePasswordHash(string pwd, string salt)
{
string saltAndPwd = String.Concat(pwd, salt);
string hashedPwd =
FormsAuthentication.HashPasswordForStoringInConfigFile(
saltAndPwd, "sha1");
return hashedPwd;
}