public void TestCreateSalt() { int length = 10; try { var result = FileEncryptor.CreateSalt(length); var bytes = Convert.FromBase64String(result); } catch { Assert.Fail("Salt value does not contain valid base64 characters"); } Assert.Pass("Salt value is valid, contains only base64 characters"); }
public void TestCreateDES() { string key = "sfasdfasdfasdfasdf"; int length = 10; try { var salt = FileEncryptor.CreateSalt(length); var saltBytes = Convert.FromBase64String(salt); RijndaelManaged rijndaelManaged = FileEncryptor.CreateDES(key, saltBytes); Assert.NotNull(rijndaelManaged); } catch { Assert.Fail("Hash value does not contain valid base64 characters"); } }
public void TestCreateHash() { string password = "******"; int length = 10; try { var salt = FileEncryptor.CreateSalt(length); var hash = FileEncryptor.CreateHash(password, salt); var hashBytes = Convert.FromBase64String(hash); } catch { Assert.Fail("Hash value does not contain valid base64 characters"); } Assert.Pass("Hash value is valid, contains only base64 characters"); }
public void setPassword(string newPassword) { passwordSalt = FileEncryptor.CreateSalt(10); passwordHash = FileEncryptor.CreateHash(newPassword, passwordSalt); amcw.WriteToConfigFile(passwordHash, passwordSalt); }