private void btnEraseKey_Click(object sender, RoutedEventArgs e) { if (MSPWDStorage.MasterKeyFileExists()) { MSPWDStorage.DeleteMasterKey(); MessageBox.Show("Master key file has been deleted"); btnEraseKey.IsEnabled = false; btnClose.IsEnabled = false; } }
public SaltInputWindow() { InitializeComponent(); if (MSPWDStorage.MasterKeyFileExists()) { btnEraseKey.IsEnabled = true; btnClose.IsEnabled = true; } }
/// <summary> /// Creates a password with special characters, using the specified string as a seed /// </summary> /// <param name="input"></param> /// <returns></returns> public static string CreatePassword_Special(string input) { // Convert the given string to a byte array so we can work with it byte[] inputBytes = Encoding.Unicode.GetBytes(input); // Retreive the user's master key byte[] MasterKey = MSPWDStorage.GetMasterKey(); return(GenPasswordWithThisHash(characterArray_Special, SHA256(CombineByteArrays(inputBytes, MasterKey)))); }
public MainWindow() { InitializeComponent(); // Check to see if a key exists already, and prompt the user to create one if it does not. if (!MSPWDStorage.MasterKeyFileExists()) { SaltInputWindow SaltInputWindow1 = new SaltInputWindow(); SaltInputWindow1.Show(); SaltInputWindow1.Activate(); } }
private void GenerateButton_Click(object sender, RoutedEventArgs e) { if (MSPWDStorage.MasterKeyFileExists()) { txtOutput_Alpha.Text = MSPWDCrypto.CreatePassword_Alpha(txtInput.Text); txtOutput_Special.Text = MSPWDCrypto.CreatePassword_Special(txtInput.Text); enableClipboardButtons(true); } else { MessageBox.Show("Master key not present - set the master key before generating passwords"); } }
private void btn_SaveButton_Click(object sender, RoutedEventArgs e) { string newSalt = txtSaltInput.Text.Trim(); if (string.IsNullOrEmpty(newSalt)) { // Don't let a short key be set MessageBox.Show("Key must be longer than 3 characters", "Key error", MessageBoxButton.OK, MessageBoxImage.Error); } else { MSPWDStorage.SetMasterKeyFile(MSPWDCrypto.CreateMasterKey(newSalt)); Close(); } }