public void TestEncryptStreamGenerateNewKey() { // Setup var enc = new EncryptStream(); // Test enc.GenerateNewKey(); // Check Assert.IsNotNull(enc.Key); Assert.AreEqual(32, enc.Key.Length); }
public void TestEncryptStreamEncrypt() { // Setup var enc = new EncryptStream(); enc.GenerateNewKey(); // Test var hexstring = enc.Encrypt("Test Message"); // Check Assert.IsNotNull(hexstring); Assert.AreEqual(64, hexstring.Length); }
private string CreateFileBackup(string data) { var guid = Guid.NewGuid(); var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var datalocation = Path.Combine(config.AppSettings.Settings["FileRepo"].Value, guid.ToString()); var encryptdata = new EncryptStream(); encryptdata.GenerateNewKey(); File.WriteAllText(datalocation, data); return(datalocation); }