private string SignAndEncryptAttachment(byte[] data, string key, IList<string> recipients) { try { if (!PromptForPasswordAndKey()) return null; var context = new CryptoContext(this.Passphrase); var crypto = new PgpCrypto(context); var headers = new Dictionary<string, string>(); headers["Version"] = "Outlook Privacy Plugin"; headers["Charset"] = _encoding.WebName; return crypto.SignAndEncryptBinary(data, key, recipients, headers); } catch (Exception ex) { this.Passphrase = null; MessageBox.Show( ex.Message, "Outlook Privacy Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
private string SignAndEncryptAttachment(byte[] data, string key, 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.SignAndEncryptBinary(data, key, recipients, headers); } catch (Exception ex) { MessageBox.Show( ex.Message, Localized.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }