aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-crypto.c
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/mail-crypto.c
parentfb099f5619f60f6c47658c052fae8d9a597b86d6 (diff)
downloadgsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.tar
gsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.tar.gz
gsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.tar.bz2
gsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.tar.lz
gsoc2013-evolution-e6b36266c76dcdd4eca1c0e2e6f682ca0b9f7dcc.tar.xz
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/mail-crypto.c')
-rw-r--r--mail/mail-crypto.c130
1 files changed, 88 insertions, 42 deletions
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;
}