private string EncryptEmail(byte[] data, IList<string> recipients) { try { var context = new CryptoContext(); var crypto = new PgpCrypto(context); var headers = new Dictionary<string, string>(); headers["Version"] = "Outlook Privacy Plugin"; headers["Charset"] = _encoding.WebName; return crypto.Encrypt(data, recipients, headers); } catch (CryptoException ex) { this.Passphrase = null; WriteErrorData("EncryptEmail", ex); MessageBox.Show( ex.Message, "Outlook Privacy Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } catch (Exception e) { this.Passphrase = null; WriteErrorData("EncryptEmail", e); MessageBox.Show( e.Message, "Outlook Privacy Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } }
private string EncryptEmail(byte[] data, IList<string> recipients) { try { var context = new CryptoContext(PasswordCallback, _settings.Cipher, _settings.Digest); var crypto = new PgpCrypto(context); var headers = new Dictionary<string, string>(); headers["Version"] = Localized.DialogTitle; headers["Charset"] = _encoding.WebName; return crypto.Encrypt(data, recipients, headers); } catch (CryptoException ex) { WriteErrorData("EncryptEmail", ex); MessageBox.Show( ex.Message, Localized.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } catch (Exception e) { WriteErrorData("EncryptEmail", e); MessageBox.Show( e.Message, Localized.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } }