private static void EncryptDataForUser()
        {
            Terminal.Message("You may now encrypt some data.");
            var data = Terminal.Prompt("What data would you like to encrypt?");

            SecurityLayer.EncryptData(data);
            Terminal.Message("Printing your encrypted data");
            Terminal.Message(EncryptedFile.Read(UserDataFilename));

            SecurityLayer.DecryptData();
        }
        static void Main(string[] args)
        {
            var enteredPassword = Terminal.Prompt("What is your password?");
            var attemptsMade    = 1;

            while (!SecurityLayer.CheckPassword(enteredPassword))
            {
                if (MaxAttemptsBeforeShutdown == attemptsMade)
                {
                    return;
                }

                Terminal.Message("Password is incorrect.");
                enteredPassword = Terminal.Prompt("What is your password?");
                attemptsMade++;
            }

            Terminal.Message("Printing your saved password");
            Terminal.Message(EncryptedFile.Read(ConfigurationFilename));

            EncryptDataForUser();

            Terminal.Prompt("Press enter to exit");
        }
示例#3
0
 public static EncryptedString ReadEncryptedFile()
 {
     return(EncryptedFile.Read(FilePath));
 }