aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-06-01 04:37:06 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-06-01 04:37:06 +0800
commite6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc (patch)
treedea3949c456568b65e35be3a4d688ca9841ce9c7 /mail
parentfb099f5619f60f6c47658c052fae8d9a597b86d6 (diff)
downloadgsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.tar.gz
gsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.tar.zst
gsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.zip
Removed the code to check for the validity of an S/MIME part. Stuff works
2001-05-31 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (handle_multipart_signed): Removed the code to check for the validity of an S/MIME part. Stuff works differently now. * mail-crypto.c: Rewrote how the S/MIME stuff is going to work. svn path=/trunk/; revision=10066
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/mail-crypto.c130
-rw-r--r--mail/mail-crypto.h25
-rw-r--r--mail/mail-format.c2
4 files changed, 109 insertions, 56 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 60a41502c2..b04ea273ce 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2001-05-31 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-format.c (handle_multipart_signed): Removed the code to
+ check for the validity of an S/MIME part. Stuff works differently
+ now.
+
+ * mail-crypto.c: Rewrote how the S/MIME stuff is going to work.
+
2001-05-30 Dan Winship <danw@ximian.com>
* mail-config.glade: Rename the "PGP" page back to "Other" and add
diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c
index 0043e0a7f6..bad81e5539 100644
--- a/mail/mail-crypto.c
+++ b/mail/mail-crypto.c
@@ -142,113 +142,159 @@ mail_crypto_pgp_mime_part_decrypt (CamelMimePart *mime_part, CamelException *ex)
/**
- * mail_crypto_smime_part_sign:
- * @mime_part: a MIME part that will be replaced by a S/MIME signed part
+ * mail_crypto_smime_sign:
+ * @message: MIME message to sign
* @userid: userid to sign with
- * @hash: one of CAMEL_CIPHER_HASH_MD5 or CAMEL_CIPHER_HASH_SHA1
+ * @signing_time: Include signing time
+ * @detached: create detached signature
* @ex: exception which will be set if there are any errors.
*
- * Constructs a S/MIME multipart in compliance with rfc2633 and
- * replaces #part with the generated multipart/signed. On failure,
- * #ex will be set and #part will remain untouched.
+ * Returns a S/MIME message in compliance with rfc2633. Returns %NULL
+ * on failure and @ex will be set.
**/
-void
-mail_crypto_smime_part_sign (CamelMimePart **mime_part, const char *userid, CamelCipherHash hash, CamelException *ex)
+CamelMimeMessage *
+mail_crypto_smime_sign (CamelMimeMessage *message, const char *userid,
+ gboolean signing_time, gboolean detached,
+ CamelException *ex)
{
CamelSMimeContext *context = NULL;
+ CamelMimeMessage *mesg = NULL;
#ifdef HAVE_NSS
- context = camel_smime_context_new (session);
+ context = camel_smime_context_new (session, NULL);
#endif
if (context) {
- camel_smime_part_sign (context, mime_part, userid, hash, ex);
+ mesg = camel_cms_sign (CAMEL_CMS_CONTEXT (context), message,
+ userid, signing_time, detached, ex);
camel_object_unref (CAMEL_OBJECT (context));
} else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Could not create a S/MIME signature context."));
+
+ return mesg;
}
/**
- * mail_crypto_smime_part_verify:
- * @mime_part: a multipart/signed S/MIME Part
+ * mail_crypto_smime_certsonly:
+ * @message: MIME message
+ * @userid: userid
+ * @recipients: recipients
* @ex: exception
*
- * Returns a CamelCipherValidity on success or NULL on fail.
+ * Returns a S/MIME message.
**/
-CamelCipherValidity *
-mail_crypto_smime_part_verify (CamelMimePart *mime_part, CamelException *ex)
+CamelMimeMessage *
+mail_crypto_smime_certsonly (CamelMimeMessage *message, const char *userid,
+ GPtrArray *recipients, CamelException *ex)
{
- CamelCipherValidity *valid = NULL;
CamelSMimeContext *context = NULL;
+ CamelMimeMessage *mesg = NULL;
#ifdef HAVE_NSS
- context = camel_smime_context_new (session);
+ context = camel_smime_context_new (session, NULL);
#endif
if (context) {
- valid = camel_smime_part_verify (context, mime_part, ex);
+ mesg = camel_cms_certsonly (CAMEL_CMS_CONTEXT (context), message,
+ userid, recipients, ex);
camel_object_unref (CAMEL_OBJECT (context));
} else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create a S/MIME verification context."));
+ _("Could not create a S/MIME certsonly context."));
- return valid;
+ return mesg;
}
-
/**
- * mail_crypto_smime_part_encrypt:
- * @mime_part: a MIME part that will be replaced by a S/MIME encrypted part
- * @recipients: list of recipient S/MIME encryption certificates
- * @ex: exception which will be set if there are any errors.
+ * mail_crypto_smime_encrypt:
+ * @message: MIME message
+ * @userid: userid
+ * @recipients: recipients
+ * @ex: exception
*
- * Constructs a S/MIME multipart in compliance with rfc2633 and
- * replaces #mime_part with the generated part. On failure,
- * #ex will be set and #part will remain untouched.
+ * Returns a S/MIME message.
**/
-void
-mail_crypto_smime_part_encrypt (CamelMimePart **mime_part, GPtrArray *recipients, CamelException *ex)
+CamelMimeMessage *
+mail_crypto_smime_encrypt (CamelMimeMessage *message, const char *userid,
+ GPtrArray *recipients, CamelException *ex)
{
CamelSMimeContext *context = NULL;
+ CamelMimeMessage *mesg = NULL;
#ifdef HAVE_NSS
- context = camel_smime_context_new (session);
+ context = camel_smime_context_new (session, NULL);
#endif
if (context) {
- camel_smime_part_encrypt (context, mime_part, recipients, ex);
+ mesg = camel_cms_encrypt (CAMEL_CMS_CONTEXT (context), message,
+ userid, recipients, ex);
camel_object_unref (CAMEL_OBJECT (context));
} else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Could not create a S/MIME encryption context."));
+
+ return mesg;
}
+/**
+ * mail_crypto_smime_envelope:
+ * @message: MIME message
+ * @userid: userid
+ * @recipients: recipients
+ * @ex: exception
+ *
+ * Returns a S/MIME message.
+ **/
+CamelMimeMessage *
+mail_crypto_smime_envelope (CamelMimeMessage *message, const char *userid,
+ GPtrArray *recipients, CamelException *ex)
+{
+ CamelSMimeContext *context = NULL;
+ CamelMimeMessage *mesg = NULL;
+
+#ifdef HAVE_NSS
+ context = camel_smime_context_new (session, NULL);
+#endif
+
+ if (context) {
+ mesg = camel_cms_envelope (CAMEL_CMS_CONTEXT (context), message,
+ userid, recipients, ex);
+ camel_object_unref (CAMEL_OBJECT (context));
+ } else
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not create a S/MIME envelope context."));
+
+ return mesg;
+}
/**
- * mail_crypto_smime_part_decrypt:
- * @mime_part: an S/MIME encrypted Part
+ * mail_crypto_smime_decode:
+ * @message: MIME message
+ * @info: pointer to a CamelCMSValidityInfo structure (or %NULL)
* @ex: exception
*
- * Returns the decrypted MIME Part on success or NULL on fail.
+ * Returns a decoded S/MIME message.
**/
-CamelMimePart *
-mail_crypto_smime_part_decrypt (CamelMimePart *mime_part, CamelException *ex)
+CamelMimeMessage *
+mail_crypto_smime_decode (CamelMimeMessage *message, CamelCMSValidityInfo **info,
+ CamelException *ex)
{
CamelSMimeContext *context = NULL;
- CamelMimePart *part = NULL;
+ CamelMimeMessage *mesg = NULL;
#ifdef HAVE_NSS
- context = camel_smime_context_new (session);
+ context = camel_smime_context_new (session, NULL);
#endif
if (context) {
- part = camel_smime_part_decrypt (context, mime_part, ex);
+ mesg = camel_cms_decode (CAMEL_CMS_CONTEXT (context),
+ message, info, ex);
camel_object_unref (CAMEL_OBJECT (context));
} else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create a S/MIME decryption context."));
+ _("Could not create a S/MIME decode context."));
- return part;
+ return mesg;
}
diff --git a/mail/mail-crypto.h b/mail/mail-crypto.h
index 806430173e..2508d77304 100644
--- a/mail/mail-crypto.h
+++ b/mail/mail-crypto.h
@@ -48,21 +48,22 @@ void mail_crypto_pgp_mime_part_encrypt (CamelMimePart **mime_part,
CamelMimePart *mail_crypto_pgp_mime_part_decrypt (CamelMimePart *mime_part,
CamelException *ex);
-/* S/MIME convenience wrappers */
-void mail_crypto_smime_part_sign (CamelMimePart **mime_part,
- const char *userid,
- CamelCipherHash hash,
- CamelException *ex);
+/* S/MIME v3 convenience wrappers */
+CamelMimeMessage *mail_crypto_smime_sign (CamelMimeMessage *message, const char *userid,
+ gboolean signing_time, gboolean detached,
+ CamelException *ex);
-CamelCipherValidity *mail_crypto_smime_part_verify (CamelMimePart *mime_part,
- CamelException *ex);
+CamelMimeMessage *mail_crypto_smime_certsonly (CamelMimeMessage *message, const char *userid,
+ GPtrArray *recipients, CamelException *ex);
-void mail_crypto_smime_part_encrypt (CamelMimePart **mime_part,
- GPtrArray *recipients,
- CamelException *ex);
+CamelMimeMessage *mail_crypto_smime_encrypt (CamelMimeMessage *message, const char *userid,
+ GPtrArray *recipients, CamelException *ex);
-CamelMimePart *mail_crypto_smime_part_decrypt (CamelMimePart *mime_part,
- CamelException *ex);
+CamelMimeMessage *mail_crypto_smime_envelope (CamelMimeMessage *message, const char *userid,
+ GPtrArray *recipients, CamelException *ex);
+
+CamelMimeMessage *mail_crypto_smime_decode (CamelMimeMessage *message,
+ CamelCMSValidityInfo **info, CamelException *ex);
#ifdef __cplusplus
}
diff --git a/mail/mail-format.c b/mail/mail-format.c
index af6a870b22..d7d66bed49 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1576,8 +1576,6 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
if (camel_pgp_mime_is_rfc2015_signed (part)) {
valid = mail_crypto_pgp_mime_part_verify (part, ex);
- } else if (camel_smime_is_smime_v3_signed (part)) {
- valid = mail_crypto_smime_part_verify (part, ex);
} else {
camel_exception_free (ex);
return handle_multipart_mixed (part, mime_type, md);