Пример #1
0
        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();
        }
Пример #2
0
        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");
        }