private async void InitialSetupButton_Click(object sender, RoutedEventArgs e) { String PWD = SetupAPasswordBox.Password; Debug.WriteLine(PWD); Key = CryptoInterface.GestAesKey(PWD); IBuffer X = CryptoInterface.CreateTestfile(); await StorageInterface.WriteBufferToRoamingFolder("PWM/A", X); await StorageInterface.WriteBufferToRoamingFolder("PWM/B", CryptoInterface.EncryptAes(Key, X)); await CryptoInterface.InitialSetup(Key); await CryptoInterface.StorePasswords("Dieser Passwortmanager" + INTRASPLIT + "Kein Benutzername" + INTRASPLIT + PWD + INTERSPLIT, Key); Debug.WriteLine("HAVE DONE SETUP WITH PASSWORD"); MODE_REGULAR.Visibility = MODE_REGULAR_BAR.Visibility = Visibility.Visible; MODE_LOGIN.Visibility = MODE_SETUP.Visibility = Visibility.Collapsed; await Refresh(); }
public static async Task StorePasswords(String Passwords, CryptographicKey AesKey) { CryptographicKey k = await GetRasKey(AesKey); int a = int.Parse(await StorageInterface.ReadFromRoamingFolder("PWM/INDEX")); for (int i = 0; i < a; i++) { await StorageInterface.DeleteFromRoamingFolder("PWM/Passwords" + i); } String[] PWD = Passwords.DivideToLength(768); await StorageInterface.WriteToRoamingFolder("PWM/INDEX", PWD.Length.ToString()); for (int i = 0; i < PWD.Length; i++) { IBuffer plain = CryptographicBuffer.ConvertStringToBinary(PWD[i], BinaryStringEncoding.Utf8); IBuffer cryptic = CryptographicEngine.Encrypt(k, plain, null); await StorageInterface.WriteBufferToRoamingFolder("PWM/Passwords" + i, cryptic); } }
private static async void StoreRsaKey(CryptographicKey key, CryptographicKey aesKey) { await StorageInterface.WriteBufferToRoamingFolder("PWM/RsaKey", EncryptAes(aesKey, key.Export())); }