aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-crypto.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-01-24 05:14:47 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-01-24 05:14:47 +0800
commit62a7c2c37017f209e2d9be12cf5ce19c16cb91d2 (patch)
treed135df45fc0b8c2b3f5136489bf04fee53b761dd /mail/mail-crypto.c
parent4b207455eeec18dbaf3c6c448eb6d2d5d09d9490 (diff)
downloadgsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar
gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar.gz
gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar.bz2
gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar.lz
gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar.xz
gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar.zst
gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.zip
A few minor tweaks.
2001-01-23 Jeffrey Stedfast <fejj@ximian.com> * openpgp-utils.c: * mail-crypto.c: A few minor tweaks. svn path=/trunk/; revision=7755
Diffstat (limited to 'mail/mail-crypto.c')
-rw-r--r--mail/mail-crypto.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c
index b343e8cda8..7d7369c488 100644
--- a/mail/mail-crypto.c
+++ b/mail/mail-crypto.c
@@ -259,9 +259,10 @@ pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex)
CamelMimePart *part, *sigpart;
CamelStreamFilter *filtered_stream;
CamelMimeFilter *crlf_filter;
+ CamelStream *stream;
+ GByteArray *content, *signature;
gboolean valid = FALSE;
- CamelStreamMem *sigstream, *cstream;
-
+
g_return_val_if_fail (mime_part != NULL, FALSE);
g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), FALSE);
@@ -273,25 +274,31 @@ pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex)
/* get the plain part */
part = camel_multipart_get_part (multipart, 0);
- cstream = (CamelStreamMem *)camel_stream_mem_new ();
+ content = g_byte_array_new ();
+ stream = camel_stream_mem_new ();
+ camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), content);
crlf_filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
- filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *)cstream);
+ filtered_stream = camel_stream_filter_new_with_stream (stream);
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlf_filter));
camel_object_unref (CAMEL_OBJECT (crlf_filter));
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (part), CAMEL_STREAM (filtered_stream));
camel_object_unref (CAMEL_OBJECT (filtered_stream));
+ camel_object_unref (CAMEL_OBJECT (stream));
/* get the signed part */
sigpart = camel_multipart_get_part (multipart, 1);
- sigstream = (CamelStreamMem *)camel_stream_mem_new ();
- camel_data_wrapper_write_to_stream (camel_medium_get_content_object (CAMEL_MEDIUM (sigpart)), (CamelStream *)sigstream);
+ signature = g_byte_array_new ();
+ stream = camel_stream_mem_new ();
+ camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), signature);
+ camel_data_wrapper_write_to_stream (camel_medium_get_content_object (CAMEL_MEDIUM (sigpart)), stream);
+ camel_object_unref (CAMEL_OBJECT (stream));
/* verify */
- valid = openpgp_verify (cstream->buffer->data, cstream->buffer->len,
- sigstream->buffer->data, sigstream->buffer->len, ex);
-
- camel_object_unref (CAMEL_OBJECT (sigstream));
- camel_object_unref (CAMEL_OBJECT (cstream));
+ valid = openpgp_verify (content->data, content->len,
+ signature->data, signature->len, ex);
+
+ g_byte_array_free (content, TRUE);
+ g_byte_array_free (signature, TRUE);
return valid;
}