diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-12-12 07:07:01 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-12-12 07:07:01 +0800 |
commit | 6f20275b96e58ece5cf300bd382ba47d04398bd0 (patch) | |
tree | e5b8a648f32ea1e62f55d99b1d4c45a74707db4d /mail/mail-format.c | |
parent | 26eee7328031f78b063ab71265ef4fddc8619c72 (diff) | |
download | gsoc2013-evolution-6f20275b96e58ece5cf300bd382ba47d04398bd0.tar.gz gsoc2013-evolution-6f20275b96e58ece5cf300bd382ba47d04398bd0.tar.zst gsoc2013-evolution-6f20275b96e58ece5cf300bd382ba47d04398bd0.zip |
Updated to reflect arguments to the openpgp functions - now also takes an
2000-12-11 Jeffrey Stedfast <fejj@helixcode.com>
* mail-format.c (decode_pgp): Updated to reflect arguments to the
openpgp functions - now also takes an outlen argument.
(try_inline_pgp): Updated.
(handle_multipart_encrypted): Updated here too.
* mail-crypto.c (crypto_exec_with_passwd): Updated to handle
binary streams and such.
(mail_crypto_openpgp_encrypt): Always initialize the passwd_fds
even if we don't plan on signing. Added an 'inlen' to specify the
length of the input data (as it could be binary). Also added a
'userid' argument for cases when we want to sign as well as
encrypt.
(mail_crypto_openpgp_decrypt): Updated to take an outlen argument
in case the ciphertext is encrypted binary data.
(mail_crypto_openpgp_clearsign): Added a 'hash' and 'detach'
arguments. 'hash' allows the program to specify the preferred hash
function (which will come in handy when generating
PGP/MIME). 'detach' allows the program to specify whether it wants
a detached signature or the entire signed text.
svn path=/trunk/; revision=6921
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r-- | mail/mail-format.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c index b53c811068..b7eb7dbea0 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -827,16 +827,16 @@ destroy_part (CamelObject *root, gpointer event_data, gpointer user_data) } static char * -decode_pgp (const char *ciphertext, MailDisplay *md) +decode_pgp (const char *ciphertext, int *outlen, MailDisplay *md) { CamelException ex; char *plaintext; - + camel_exception_init (&ex); #ifdef PGP_PROGRAM /* FIXME: multipart parts */ if (g_datalist_get_data (md->data, "show_pgp")) { - plaintext = mail_crypto_openpgp_decrypt (ciphertext, &ex); + plaintext = mail_crypto_openpgp_decrypt (ciphertext, outlen, &ex); if (plaintext) return plaintext; } @@ -872,6 +872,7 @@ static char * try_inline_pgp (char *start, MailDisplay *md) { char *end, *ciphertext, *plaintext; + int outlen; /* FIXME: This should deal with signed data as well. */ @@ -882,11 +883,12 @@ try_inline_pgp (char *start, MailDisplay *md) end += sizeof ("-----END PGP MESSAGE-----") - 1; mail_html_write (md->html, md->stream, "<hr>"); - + + /* FIXME: uhm, pgp decrypted data doesn't have to be plaintext */ ciphertext = g_strndup (start, end - start); - plaintext = decode_pgp (ciphertext, md); + plaintext = decode_pgp (ciphertext, &outlen, md); g_free (ciphertext); - if (plaintext) { + if (plaintext && outlen > 0) { mail_html_write (md->html, md->stream, "<table width=\"100%%\" border=2 " "cellpadding=4><tr><td>"); @@ -1233,6 +1235,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, camel_medium_get_content_object (CAMEL_MEDIUM (part)); CamelMultipart *mp; char *ciphertext, *plaintext; + int outlen; g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); mp = CAMEL_MULTIPART (wrapper); @@ -1246,8 +1249,9 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, ciphertext = get_data_wrapper_text (wrapper); if (!ciphertext) return FALSE; - - plaintext = decode_pgp (ciphertext, md); + + /* FIXME: please note that decrypted data does NOT have to be plaintext */ + plaintext = decode_pgp (ciphertext, &outlen, md); if (plaintext) { CamelStream *memstream; |