aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-02-06 06:23:04 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-02-06 06:23:04 +0800
commit4e52135a248adec2dfc132d63c01800f3c7135f5 (patch)
tree24a59b0b494bffe90e60a9169fcf0db2e61fc998 /mail/mail-format.c
parentbf2f40a85a1c87246e5f0a7fb4bd32df02207ff1 (diff)
downloadgsoc2013-evolution-4e52135a248adec2dfc132d63c01800f3c7135f5.tar
gsoc2013-evolution-4e52135a248adec2dfc132d63c01800f3c7135f5.tar.gz
gsoc2013-evolution-4e52135a248adec2dfc132d63c01800f3c7135f5.tar.bz2
gsoc2013-evolution-4e52135a248adec2dfc132d63c01800f3c7135f5.tar.lz
gsoc2013-evolution-4e52135a248adec2dfc132d63c01800f3c7135f5.tar.xz
gsoc2013-evolution-4e52135a248adec2dfc132d63c01800f3c7135f5.tar.zst
gsoc2013-evolution-4e52135a248adec2dfc132d63c01800f3c7135f5.zip
New function to handle inline pgp-signatures.
2001-02-05 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (try_inline_pgp_sig): New function to handle inline pgp-signatures. svn path=/trunk/; revision=7996
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c63
1 files changed, 55 insertions, 8 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index faea36f633..5645134ae7 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -45,6 +45,7 @@
static char *get_data_wrapper_text (CamelDataWrapper *data);
static char *try_inline_pgp (char *start, MailDisplay *md);
+static char *try_inline_pgp_sig (char *start, MailDisplay *md);
static char *try_uudecoding (char *start, MailDisplay *md);
static char *try_inline_binhex (char *start, MailDisplay *md);
@@ -763,6 +764,7 @@ struct {
char * (*handler) (char *start, MailDisplay *md);
} text_specials[] = {
{ "-----BEGIN PGP MESSAGE-----\n", try_inline_pgp },
+ { "-----BEGIN PGP SIGNED MESSAGE-----\n", try_inline_pgp_sig },
{ "begin ", try_uudecoding },
{ "(This file must be converted with BinHex 4.0)\n", try_inline_binhex }
};
@@ -957,15 +959,13 @@ try_inline_pgp (char *start, MailDisplay *md)
{
char *end, *ciphertext, *plaintext;
int outlen;
-
- /* FIXME: This should deal with signed data as well. */
-
+
end = strstr (start, "-----END PGP MESSAGE-----");
if (!end)
return start;
-
+
end += strlen ("-----END PGP MESSAGE-----") - 1;
-
+
mail_html_write (md->html, md->stream, "<hr>");
/* FIXME: uhm, pgp decrypted data doesn't have to be plaintext
@@ -981,7 +981,57 @@ try_inline_pgp (char *start, MailDisplay *md)
mail_html_write (md->html, md->stream, "</td></tr></table>");
g_free (plaintext);
}
+
+ return end;
+}
+static char *
+try_inline_pgp_sig (char *start, MailDisplay *md)
+{
+ char *end, *ciphertext;
+ CamelException *ex;
+ gboolean valid;
+
+ end = strstr (start, "-----END PGP SIGNATURE-----");
+ if (!end)
+ return start;
+
+ end += strlen ("-----END PGP SIGNATURE-----") - 1;
+
+ mail_html_write (md->html, md->stream, "<hr>");
+
+ ciphertext = g_strndup (start, end - start);
+ ex = camel_exception_new ();
+ valid = openpgp_verify (ciphertext, end - start, NULL, 0, ex);
+ g_free (ciphertext);
+
+ mail_text_write (md->html, md->stream, "%s", start);
+
+ /* Now display the "seal-of-authenticity" or something... */
+ if (valid) {
+ mail_html_write (md->html, md->stream,
+ "<hr>\n<table><tr valign=top>"
+ "<td><img src=\"%s\"></td>"
+ "<td><font size=-1>%s<br><br></font></td></table>",
+ get_url_for_icon ("wax-seal2.png", md),
+ _("This message is digitally signed and "
+ "has been found to be authentic."));
+ } else {
+ mail_html_write (md->html, md->stream,
+ "<hr>\n<table><tr valign=top>"
+ "<td><img src=\"%s\"></td>"
+ "<td><font size=-1>%s<br><br>",
+ get_url_for_icon ("wax-seal-broken.png", md),
+ _("This message is digitally signed but can "
+ "not be proven to be authentic."));
+ mail_error_write (md->html, md->stream,
+ camel_exception_get_description (ex));
+ mail_html_write (md->html, md->stream,
+ "<br><br></font></td></table>");
+ }
+
+ camel_exception_free (ex);
+
return end;
}
@@ -1339,9 +1389,6 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
/* Now display the "seal-of-authenticity" or something... */
if (valid) {
- /* FIXME: maybe the pgp verify func should ALWAYS set
- an exception so that we can get more details even
- if it did pass the check. */
mail_html_write (md->html, md->stream,
"<hr>\n<table><tr valign=top>"
"<td><img src=\"%s\"></td>"