private async void btnDecrypt_Click(object sender, RoutedEventArgs e) { try { ChoPGPEncryptDecrypt pgp = PGPOptions.NewPGPEncryptDecrypt(); await pgp.DecryptFileAsync(PGPDecryptFileOptions.InputFilePath, PGPDecryptFileOptions.OutputFilePath, PGPDecryptFileOptions.PrivateKeyFilePath, PGPDecryptFileOptions.PassPhrase); MessageBox.Show("PGP decryption successful.", Title, MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show("Error occurred during PGP decryption. " + ex.Message, Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
private async void btnGenerateKey_Click(object sender, RoutedEventArgs e) { try { ChoPGPEncryptDecrypt pgp = PGPOptions.NewPGPEncryptDecrypt(); await pgp.GenerateKeyAsync(PGPGenerateKeyOptions.PublicKeyFilePath, PGPGenerateKeyOptions.PrivateKeyFilePath, PGPGenerateKeyOptions.Identity, PGPGenerateKeyOptions.PassPhrase, PGPGenerateKeyOptions.Strength, PGPGenerateKeyOptions.Certainty); MessageBox.Show("PGP key generation successful.", Title, MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show("Error occurred during PGP key generation. " + ex.Message, Title, MessageBoxButton.OK, MessageBoxImage.Error); } }