Esempio n. 1
0
        public void GenerateALotOfNewKeys_WriteToFile()
        {
            // Arrange
            // Change the path as needed.
            using (FileStream file = File.OpenWrite(@"s:\RandomKeys.txt"))
            {
                using (StreamWriter writer = new StreamWriter(file))
                {
                    // Act
                    for (int i = 1; i < 2000; i++)
                    {
                        byte[] newKey = AESThenHMACEncryptionHelper.NewKey();

                        string key = Convert.ToBase64String(newKey);
                        writer.WriteLine(key);

                        Trace.WriteLine(key);

                        // Assert
                        Assert.IsNotNull(key);
                    }
                    file.Flush();
                }
            }
        }
Esempio n. 2
0
        public void GenerateNewKeys()
        {
            // Arrange

            // Act
            byte[] newKey = AESThenHMACEncryptionHelper.NewKey();

            string key = Convert.ToBase64String(newKey);

            Trace.WriteLine(key);

            // Assert
            Assert.IsNotNull(key);
        }