aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-smime.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-05-15 06:25:02 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-05-15 06:25:02 +0800
commit2798919c3c8031d9bff195b83feeb61a4583d8ee (patch)
treeaadb5b0db44aa5993868b2f3ea5a1e04ffccaba6 /camel/camel-smime.c
parentdbeec96be886a5253455f804683c1c3b3c711fc8 (diff)
downloadgsoc2013-evolution-2798919c3c8031d9bff195b83feeb61a4583d8ee.tar
gsoc2013-evolution-2798919c3c8031d9bff195b83feeb61a4583d8ee.tar.gz
gsoc2013-evolution-2798919c3c8031d9bff195b83feeb61a4583d8ee.tar.bz2
gsoc2013-evolution-2798919c3c8031d9bff195b83feeb61a4583d8ee.tar.lz
gsoc2013-evolution-2798919c3c8031d9bff195b83feeb61a4583d8ee.tar.xz
gsoc2013-evolution-2798919c3c8031d9bff195b83feeb61a4583d8ee.tar.zst
gsoc2013-evolution-2798919c3c8031d9bff195b83feeb61a4583d8ee.zip
Lots of fixes to get this to almost compile. Still struggling with the
2001-05-14 Jeffrey Stedfast <fejj@ximian.com> * camel-smime-context.c: Lots of fixes to get this to almost compile. Still struggling with the fact that CERTCertDBHandle is an "incomplete type". *sigh*. * camel-smime.c (camel_smime_part_verify): Updated to pass in a hash argument to camel_smime_verify(). * camel-pgp-mime.c (camel_pgp_mime_part_verify): Update according to the changes in the context API. * camel-pgp-context.c (pgp_verify): Updated to take a CamelCipherHash argument. * camel-cipher-context.c (camel_cipher_verify): Now takes a hash argument since the S/MIME code needs this. svn path=/trunk/; revision=9804
Diffstat (limited to 'camel/camel-smime.c')
-rw-r--r--camel/camel-smime.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/camel/camel-smime.c b/camel/camel-smime.c
index 291329fb53..587fcb6057 100644
--- a/camel/camel-smime.c
+++ b/camel/camel-smime.c
@@ -307,6 +307,28 @@ camel_smime_part_sign (CamelSMimeContext *context, CamelMimePart **mime_part, co
camel_object_unref (CAMEL_OBJECT (multipart));
}
+struct {
+ char *name;
+ CamelCipherHash hash;
+} known_hash_types[] = {
+ { "md5", CAMEL_CIPHER_HASH_MD5 },
+ { "rsa-md5", CAMEL_CIPHER_HASH_MD5 },
+ { "sha1", CAMEL_CIPHER_HASH_SHA1 },
+ { "rsa-sha1", CAMEL_CIPHER_HASH_SHA1 },
+ { NULL, CAMEL_CIPHER_HASH_DEFAULT }
+};
+
+static CamelCipherHash
+get_hash_type (const char *string)
+{
+ int i;
+
+ for (i = 0; known_hash_types[i].name; i++)
+ if (!g_strcasecmp (known_hash_types[i].name, string))
+ return known_hash_types[i].hash;
+
+ return CAMEL_CIPHER_HASH_DEFAULT;
+}
/**
* camel_smime_part_verify:
@@ -325,7 +347,10 @@ camel_smime_part_verify (CamelSMimeContext *context, CamelMimePart *mime_part, C
CamelStreamFilter *filtered_stream;
CamelMimeFilter *crlf_filter, *from_filter;
CamelStream *stream, *sigstream;
+ CamelContentType *type;
CamelCipherValidity *valid;
+ CamelCipherHash hash;
+ const char *hash_str;
g_return_val_if_fail (mime_part != NULL, NULL);
g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), NULL);
@@ -359,7 +384,10 @@ camel_smime_part_verify (CamelSMimeContext *context, CamelMimePart *mime_part, C
camel_stream_reset (sigstream);
/* verify */
- valid = camel_smime_verify (context, stream, sigstream, ex);
+ type = camel_mime_part_get_content_type (sigpart);
+ hash_str = header_content_type_param (type, "micalg");
+ hash = get_hash_type (hash_str);
+ valid = camel_smime_verify (context, hash, stream, sigstream, ex);
camel_object_unref (CAMEL_OBJECT (sigstream));
camel_object_unref (CAMEL_OBJECT (stream));