I have a legacy application which is not FIPS compliant. When a user saves his password for the first time the encrypted password is saved in the database and the below algorithm is used to determine the encrypted password on login (which is then compared with the database value).
My question is can I replace these calls with FIPS compliant calls? (I tried changing the hash call to var hashmd5 = MACTripleDES.Create() but the TripleDESCryptoServiceProvider call fails with "Specified key is not a valid size for this algorithm.").
using (var hashmd5 = new MD5CryptoServiceProvider())
{
byte[] pwdhash = hashmd5.ComputeHash(Encoding.ASCII.GetBytes(PasswordSalt));
using (var des = new TripleDESCryptoServiceProvider {Key = pwdhash, Mode = CipherMode.ECB})
{
byte[] buff = Encoding.UTF8.GetBytes(password);
result = Convert.ToBase64String(des.CreateEncryptor().TransformFinalBlock(buff, 0, buff.Length));
}
}
If I do get this working, will I have to delete all the passwords and ask users to recreate their passwords?
Thanks