2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net> and
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 #include <glib/gi18n.h>
38 #include <plugins/pgpcore/sgpgme.h>
39 #include <plugins/pgpcore/prefs_gpg.h>
40 #include <plugins/pgpcore/passphrase.h>
42 #include "alertpanel.h"
43 #include "prefs_common.h"
47 typedef struct _PrivacyDataPGP PrivacyDataPGP;
49 struct _PrivacyDataPGP
53 gboolean done_sigtest;
55 gpgme_verify_result_t sigstatus;
59 static PrivacySystem smime_system;
61 static gint smime_check_signature(MimeInfo *mimeinfo);
63 static PrivacyDataPGP *smime_new_privacydata()
67 data = g_new0(PrivacyDataPGP, 1);
68 data->data.system = &smime_system;
69 data->done_sigtest = FALSE;
70 data->is_signed = FALSE;
71 data->sigstatus = NULL;
72 gpgme_new(&data->ctx);
77 static void smime_free_privacydata(PrivacyData *_data)
79 PrivacyDataPGP *data = (PrivacyDataPGP *) _data;
80 gpgme_release(data->ctx);
84 static gboolean smime_is_signed(MimeInfo *mimeinfo)
88 const gchar *protocol, *tmpstr;
89 PrivacyDataPGP *data = NULL;
91 g_return_val_if_fail(mimeinfo != NULL, FALSE);
92 if (mimeinfo->privacy != NULL) {
93 data = (PrivacyDataPGP *) mimeinfo->privacy;
94 if (data->done_sigtest)
95 return data->is_signed;
98 if (!g_ascii_strcasecmp(mimeinfo->subtype, "pkcs7-mime") ||
99 !g_ascii_strcasecmp(mimeinfo->subtype, "x-pkcs7-mime")) {
100 tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
101 if (tmpstr && !g_ascii_strcasecmp(tmpstr, "signed-data")) {
103 data = smime_new_privacydata();
104 mimeinfo->privacy = (PrivacyData *) data;
107 data->done_sigtest = TRUE;
108 data->is_signed = TRUE;
109 smime_check_signature(mimeinfo);
115 parent = procmime_mimeinfo_parent(mimeinfo);
119 if ((parent->type != MIMETYPE_MULTIPART) ||
120 g_ascii_strcasecmp(parent->subtype, "signed"))
122 protocol = procmime_mimeinfo_get_parameter(parent, "protocol");
123 if ((protocol == NULL) ||
124 (g_ascii_strcasecmp(protocol, "application/pkcs7-signature") &&
125 g_ascii_strcasecmp(protocol, "application/x-pkcs7-signature")))
128 /* check if mimeinfo is the first child */
129 if (parent->node->children->data != mimeinfo)
133 /* check signature */
134 signature = parent->node->children->next != NULL ?
135 (MimeInfo *) parent->node->children->next->data : NULL;
136 if (signature == NULL)
138 if ((signature->type != MIMETYPE_APPLICATION) ||
139 (g_ascii_strcasecmp(signature->subtype, "pkcs7-signature") &&
140 g_ascii_strcasecmp(signature->subtype, "x-pkcs7-signature")))
144 data = smime_new_privacydata();
145 mimeinfo->privacy = (PrivacyData *) data;
148 data->done_sigtest = TRUE;
149 data->is_signed = TRUE;
154 static gchar *get_canonical_content(FILE *fp, const gchar *boundary)
158 guint boundary_len = 0;
162 boundary_len = strlen(boundary);
163 while (fgets(buf, sizeof(buf), fp) != NULL)
164 if (IS_BOUNDARY(buf, boundary, boundary_len))
168 textbuffer = g_string_new("");
169 while (fgets(buf, sizeof(buf), fp) != NULL) {
172 if (boundary && IS_BOUNDARY(buf, boundary, boundary_len))
175 buf2 = canonicalize_str(buf);
176 g_string_append(textbuffer, buf2);
179 g_string_truncate(textbuffer, textbuffer->len - 2);
181 ret = textbuffer->str;
182 g_string_free(textbuffer, FALSE);
187 static gint smime_check_signature(MimeInfo *mimeinfo)
189 PrivacyDataPGP *data;
190 MimeInfo *parent, *signature;
193 gchar *textstr = NULL;
195 gpgme_data_t sigdata = NULL, textdata = NULL;
197 g_return_val_if_fail(mimeinfo != NULL, -1);
198 g_return_val_if_fail(mimeinfo->privacy != NULL, -1);
199 data = (PrivacyDataPGP *) mimeinfo->privacy;
200 gpgme_new(&data->ctx);
201 EncodingType oldenc = ENC_BINARY;
203 debug_print("Checking S/MIME signature\n");
205 err = gpgme_set_protocol(data->ctx, GPGME_PROTOCOL_CMS);
208 debug_print ("gpgme_set_protocol failed: %s\n",
209 gpgme_strerror (err));
211 parent = procmime_mimeinfo_parent(mimeinfo);
213 fp = g_fopen(parent->data.filename, "rb");
214 g_return_val_if_fail(fp != NULL, SIGNATURE_INVALID);
216 boundary = g_hash_table_lookup(parent->typeparameters, "boundary");
218 gchar *tmpfile = get_tmp_file();
219 debug_print("no boundary\n");
221 if (mimeinfo->encoding_type != ENC_BASE64) {
222 procmime_encode_content(mimeinfo, ENC_BASE64);
224 oldenc = mimeinfo->encoding_type;
225 if (mimeinfo->encoding_type == ENC_BASE64)
226 mimeinfo->encoding_type = ENC_BINARY;
227 if (procmime_get_part(tmpfile, mimeinfo) == 0) {
228 textstr = file_read_to_str(tmpfile);
232 if (mimeinfo->encoding_type != oldenc)
233 mimeinfo->encoding_type = oldenc;
237 textstr = get_canonical_content(fp, boundary);
239 err = gpgme_data_new_from_mem(&textdata, textstr, strlen(textstr), 0);
242 debug_print ("gpgme_data_new_from_mem failed: %s\n",
243 gpgme_strerror (err));
246 if (!g_ascii_strcasecmp(mimeinfo->subtype, "pkcs7-mime") ||
247 !g_ascii_strcasecmp(mimeinfo->subtype, "x-pkcs7-mime")) {
248 tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
249 if (tmpstr && !g_ascii_strcasecmp(tmpstr, "signed-data")) {
252 if (oldenc == ENC_BASE64)
253 gpgme_data_set_encoding (textdata, GPGME_DATA_ENCODING_BASE64);
254 gpgme_data_new(&cipher);
256 sgpgme_verify_signature (data->ctx, textdata, NULL, cipher);
257 gpgme_data_release(textdata);
259 gpgme_data_rewind(cipher);
260 textstr = sgpgme_data_release_and_get_mem(cipher, &len);
262 if (textstr && len > 0)
265 if (textstr && len) {
266 gchar *tmp_file = get_tmp_file();
267 MimeInfo *newinfo = NULL, *decinfo = NULL, *parentinfo = NULL;
268 gint childnumber = 0;
270 str_write_to_file(textstr, tmp_file);
271 newinfo = procmime_scan_file(tmp_file);
272 decinfo = g_node_first_child(newinfo->node) != NULL ?
273 g_node_first_child(newinfo->node)->data : NULL;
274 g_node_unlink(decinfo->node);
275 procmime_mimeinfo_free_all(newinfo);
277 parentinfo = procmime_mimeinfo_parent(mimeinfo);
278 childnumber = g_node_child_index(parentinfo->node, mimeinfo);
279 if (parentinfo->type == MIMETYPE_MESSAGE &&
280 !strcmp(parentinfo->subtype, "rfc822")) {
281 procmime_decode_content(parentinfo);
282 procmime_encode_content(parentinfo, ENC_BASE64);
283 procmime_encode_content(parentinfo, ENC_8BIT);
284 if (parentinfo->content == MIMECONTENT_MEM) {
286 (gint)(strstr(parentinfo->data.mem, "\n\n") - parentinfo->data.mem);
288 parentinfo->length = newlen;
291 g_node_prepend(parentinfo->node, decinfo->node);
299 signature = (MimeInfo *) mimeinfo->node->next->data;
300 sigdata = sgpgme_data_from_mimeinfo(signature);
303 if (signature->encoding_type == ENC_BASE64) {
304 err = gpgme_data_set_encoding (sigdata, GPGME_DATA_ENCODING_BASE64);
308 debug_print ("gpgme_data_set_encoding failed: %s\n",
309 gpgme_strerror (err));
313 sgpgme_verify_signature (data->ctx, sigdata, textdata, NULL);
315 gpgme_data_release(sigdata);
316 gpgme_data_release(textdata);
323 static SignatureStatus smime_get_sig_status(MimeInfo *mimeinfo)
325 PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
327 g_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
329 if (data->sigstatus == NULL &&
330 prefs_gpg_get_config()->auto_check_signatures)
331 smime_check_signature(mimeinfo);
333 return sgpgme_sigstat_gpgme_to_privacy(data->ctx, data->sigstatus);
336 static gchar *smime_get_sig_info_short(MimeInfo *mimeinfo)
338 PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
340 g_return_val_if_fail(data != NULL, g_strdup("Error"));
342 if (data->sigstatus == NULL &&
343 prefs_gpg_get_config()->auto_check_signatures)
344 smime_check_signature(mimeinfo);
346 return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
349 static gchar *smime_get_sig_info_full(MimeInfo *mimeinfo)
351 PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
353 g_return_val_if_fail(data != NULL, g_strdup("Error"));
355 if (data->sigstatus == NULL &&
356 prefs_gpg_get_config()->auto_check_signatures)
357 smime_check_signature(mimeinfo);
359 return sgpgme_sigstat_info_full(data->ctx, data->sigstatus);
362 static gboolean smime_is_encrypted(MimeInfo *mimeinfo)
366 if (mimeinfo->type != MIMETYPE_APPLICATION)
368 if (!g_ascii_strcasecmp(mimeinfo->subtype, "pkcs7-mime")) {
369 tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
370 if (tmpstr && g_ascii_strcasecmp(tmpstr, "enveloped-data"))
375 } else if (!g_ascii_strcasecmp(mimeinfo->subtype, "x-pkcs7-mime")) {
376 tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
377 if (tmpstr && g_ascii_strcasecmp(tmpstr, "enveloped-data"))
385 static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
387 MimeInfo *encinfo, *decinfo, *parseinfo;
388 gpgme_data_t cipher = NULL, plain = NULL;
392 gpgme_verify_result_t sigstat = NULL;
393 PrivacyDataPGP *data = NULL;
399 g_return_val_if_fail(smime_is_encrypted(mimeinfo), NULL);
401 if ((err = gpgme_new(&ctx)) != GPG_ERR_NO_ERROR) {
402 privacy_set_error(_("Couldn't initialize GPG context, %s"), gpgme_strerror(err));
406 err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
408 debug_print ("gpgme_set_protocol failed: %s\n",
409 gpgme_strerror (err));
410 privacy_set_error(_("Couldn't set GPG protocol, %s"), gpgme_strerror(err));
414 gpgme_set_armor(ctx, TRUE);
418 cipher = sgpgme_data_from_mimeinfo(encinfo);
419 gpgme_data_set_encoding(cipher, GPGME_DATA_ENCODING_BASE64);
420 plain = sgpgme_decrypt_verify(cipher, &sigstat, ctx);
422 gpgme_data_release(cipher);
424 debug_print("plain is null!\n");
429 fname = g_strdup_printf("%s%cplaintext.%08x",
430 get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id);
432 if ((dstfp = g_fopen(fname, "wb")) == NULL) {
433 FILE_OP_ERROR(fname, "fopen");
435 gpgme_data_release(plain);
437 debug_print("can't open!\n");
438 privacy_set_error(_("Couldn't open temporary file"));
442 if (fprintf(dstfp, "MIME-Version: 1.0\n") < 0) {
443 FILE_OP_ERROR(fname, "fprintf");
445 gpgme_data_release(plain);
447 debug_print("can't close!\n");
448 privacy_set_error(_("Couldn't write to temporary file"));
452 chars = sgpgme_data_release_and_get_mem(plain, &len);
455 if (fwrite(chars, 1, len, dstfp) < len) {
456 FILE_OP_ERROR(fname, "fwrite");
459 gpgme_data_release(plain);
461 debug_print("can't write!\n");
462 privacy_set_error(_("Couldn't write to temporary file"));
466 if (fclose(dstfp) == EOF) {
467 FILE_OP_ERROR(fname, "fclose");
470 gpgme_data_release(plain);
472 debug_print("can't close!\n");
473 privacy_set_error(_("Couldn't close temporary file"));
478 parseinfo = procmime_scan_file(fname);
480 if (parseinfo == NULL) {
481 privacy_set_error(_("Couldn't parse decrypted file."));
485 decinfo = g_node_first_child(parseinfo->node) != NULL ?
486 g_node_first_child(parseinfo->node)->data : NULL;
487 if (decinfo == NULL) {
488 privacy_set_error(_("Couldn't parse decrypted file parts."));
493 g_node_unlink(decinfo->node);
494 procmime_mimeinfo_free_all(parseinfo);
498 if (sigstat != NULL && sigstat->signatures != NULL) {
499 if (decinfo->privacy != NULL) {
500 data = (PrivacyDataPGP *) decinfo->privacy;
502 data = smime_new_privacydata();
503 decinfo->privacy = (PrivacyData *) data;
505 data->done_sigtest = TRUE;
506 data->is_signed = TRUE;
507 data->sigstatus = sigstat;
509 gpgme_release(data->ctx);
519 gboolean smime_sign(MimeInfo *mimeinfo, PrefsAccount *account)
521 MimeInfo *msgcontent, *sigmultipart, *newinfo;
522 gchar *textstr, *micalg;
524 gchar *boundary = NULL;
527 gpgme_data_t gpgtext, gpgsig;
530 struct passphrase_cb_info_s info;
531 gpgme_sign_result_t result = NULL;
533 gchar *real_content = NULL;
537 perror("my_tmpfile");
540 procmime_write_mimeinfo(mimeinfo, fp);
543 /* read temporary file into memory */
544 test_msg = file_read_stream_to_str(fp);
547 memset (&info, 0, sizeof info);
549 /* remove content node from message */
550 msgcontent = (MimeInfo *) mimeinfo->node->children->data;
551 g_node_unlink(msgcontent->node);
553 /* create temporary multipart for content */
554 sigmultipart = procmime_mimeinfo_new();
555 sigmultipart->type = MIMETYPE_MULTIPART;
556 sigmultipart->subtype = g_strdup("signed");
561 boundary = generate_mime_boundary("Sig");
562 } while (strstr(test_msg, boundary) != NULL);
566 g_hash_table_insert(sigmultipart->typeparameters, g_strdup("boundary"),
568 g_hash_table_insert(sigmultipart->typeparameters, g_strdup("protocol"),
569 g_strdup("application/pkcs7-signature"));
570 g_node_append(sigmultipart->node, msgcontent->node);
571 g_node_append(mimeinfo->node, sigmultipart->node);
573 /* write message content to temporary file */
576 perror("my_tmpfile");
579 procmime_write_mimeinfo(sigmultipart, fp);
582 /* read temporary file into memory */
583 textstr = get_canonical_content(fp, boundary);
589 gpgme_data_new_from_mem(&gpgtext, textstr, strlen(textstr), 0);
590 gpgme_data_new(&gpgsig);
592 gpgme_set_armor(ctx, TRUE);
593 gpgme_signers_clear (ctx);
595 err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
598 debug_print ("gpgme_set_protocol failed: %s\n",
599 gpgme_strerror (err));
600 gpgme_data_release(gpgtext);
605 if (!sgpgme_setup_signers(ctx, account)) {
606 debug_print("setup_signers failed\n");
607 gpgme_data_release(gpgtext);
613 prefs_gpg_enable_agent(TRUE);
614 gpgme_set_passphrase_cb (ctx, NULL, &info);
616 err = gpgme_op_sign(ctx, gpgtext, gpgsig, GPGME_SIG_MODE_DETACH);
617 if (err != GPG_ERR_NO_ERROR) {
618 alertpanel_error("S/MIME : Cannot sign, %s (%d)", gpg_strerror(err), gpg_err_code(err));
619 gpgme_data_release(gpgtext);
623 result = gpgme_op_sign_result(ctx);
624 if (result && result->signatures) {
625 if (gpgme_get_protocol(ctx) == GPGME_PROTOCOL_OpenPGP) {
626 micalg = g_strdup_printf("PGP-%s", gpgme_hash_algo_name(
627 result->signatures->hash_algo));
629 micalg = g_strdup(gpgme_hash_algo_name(
630 result->signatures->hash_algo));
633 /* can't get result (maybe no signing key?) */
634 debug_print("gpgme_op_sign_result error\n");
639 sigcontent = sgpgme_data_release_and_get_mem(gpgsig, &len);
640 gpgme_data_release(gpgtext);
647 real_content = sigcontent+strlen("-----BEGIN SIGNED MESSAGE-----\n");
648 if (!strstr(real_content, "-----END SIGNED MESSAGE-----")) {
649 debug_print("missing end\n");
653 *strstr(real_content, "-----END SIGNED MESSAGE-----") = '\0';
655 g_hash_table_insert(sigmultipart->typeparameters, g_strdup("micalg"),
658 newinfo = procmime_mimeinfo_new();
659 newinfo->type = MIMETYPE_APPLICATION;
660 newinfo->subtype = g_strdup("pkcs7-signature");
661 g_hash_table_insert(newinfo->typeparameters, g_strdup("name"),
662 g_strdup("smime.p7s"));
663 newinfo->content = MIMECONTENT_MEM;
664 newinfo->disposition = DISPOSITIONTYPE_ATTACHMENT;
665 g_hash_table_insert(newinfo->dispositionparameters, g_strdup("filename"),
666 g_strdup("smime.p7s"));
667 newinfo->data.mem = g_malloc(len + 1);
668 g_memmove(newinfo->data.mem, real_content, len);
669 newinfo->data.mem[len] = '\0';
670 newinfo->encoding_type = ENC_BASE64;
671 g_node_append(sigmultipart->node, newinfo->node);
677 gchar *smime_get_encrypt_data(GSList *recp_names)
679 return sgpgme_get_encrypt_data(recp_names, GPGME_PROTOCOL_CMS);
682 static const gchar *smime_get_encrypt_warning(void)
684 if (prefs_gpg_should_skip_encryption_warning(smime_system.id))
687 return _("Please note that email headers, like Subject, "
688 "are not encrypted by the S/MIME system.");
691 static void smime_inhibit_encrypt_warning(gboolean inhibit)
694 prefs_gpg_add_skip_encryption_warning(smime_system.id);
696 prefs_gpg_remove_skip_encryption_warning(smime_system.id);
699 static gchar *fp_read_noconv(FILE *fp)
704 gchar *result = NULL;
708 array = g_byte_array_new();
710 while ((n_read = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
711 if (n_read < sizeof(buf) && ferror(fp))
713 g_byte_array_append(array, buf, n_read);
717 FILE_OP_ERROR("file stream", "fread");
718 g_byte_array_free(array, TRUE);
723 g_byte_array_append(array, buf, 1);
724 result = (gchar *)array->data;
725 g_byte_array_free(array, FALSE);
730 gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
732 MimeInfo *msgcontent, *encmultipart;
736 gchar *textstr = NULL;
737 gpgme_data_t gpgtext = NULL, gpgenc = NULL;
738 gpgme_ctx_t ctx = NULL;
739 gpgme_key_t *kset = NULL;
740 gchar **fprs = g_strsplit(encrypt_data, " ", -1);
743 gchar *tmpfile = NULL;
745 while (fprs[i] && strlen(fprs[i])) {
751 err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
754 debug_print ("gpgme_set_protocol failed: %s\n",
755 gpgme_strerror (err));
759 kset = g_malloc(sizeof(gpgme_key_t)*(i+1));
760 memset(kset, 0, sizeof(gpgme_key_t)*(i+1));
763 while (fprs[i] && strlen(fprs[i])) {
766 err = gpgme_get_key(ctx, fprs[i], &key, 0);
768 debug_print("can't add key '%s'[%d] (%s)\n", fprs[i],i, gpgme_strerror(err));
771 debug_print("found %s at %d\n", fprs[i], i);
776 debug_print("Encrypting message content\n");
778 /* remove content node from message */
779 msgcontent = (MimeInfo *) mimeinfo->node->children->data;
780 g_node_unlink(msgcontent->node);
783 /* create temporary multipart for content */
784 encmultipart = procmime_mimeinfo_new();
785 encmultipart->type = MIMETYPE_APPLICATION;
786 encmultipart->subtype = g_strdup("x-pkcs7-mime");
787 g_hash_table_insert(encmultipart->typeparameters, g_strdup("name"),
788 g_strdup("smime.p7m"));
790 encmultipart->disposition = DISPOSITIONTYPE_ATTACHMENT;
791 g_hash_table_insert(encmultipart->dispositionparameters, g_strdup("filename"),
792 g_strdup("smime.p7m"));
794 g_node_append(encmultipart->node, msgcontent->node);
796 /* write message content to temporary file */
797 tmpfile = get_tmp_file();
798 fp = fopen(tmpfile, "wb");
800 perror("get_tmp_file");
803 procmime_decode_content(msgcontent);
804 procmime_write_mime_header(msgcontent, fp);
805 procmime_write_mimeinfo(msgcontent, fp);
807 canonicalize_file_replace(tmpfile);
808 fp = fopen(tmpfile, "rb");
810 perror("get_tmp_file");
815 /* read temporary file into memory */
816 textstr = fp_read_noconv(fp);
821 gpgme_data_new_from_mem(&gpgtext, textstr, strlen(textstr), 0);
822 gpgme_data_new(&gpgenc);
823 gpgme_data_rewind(gpgtext);
825 gpgme_data_set_encoding(gpgenc, GPGME_DATA_ENCODING_BASE64);
826 gpgme_op_encrypt(ctx, kset, GPGME_ENCRYPT_ALWAYS_TRUST, gpgtext, gpgenc);
829 enccontent = sgpgme_data_release_and_get_mem(gpgenc, &len);
832 g_warning("no enccontent\n");
836 tmpfile = get_tmp_file();
837 fp = fopen(tmpfile, "wb");
839 if (fwrite(enccontent, 1, len, fp) < len) {
840 FILE_OP_ERROR(tmpfile, "fwrite");
842 claws_unlink(tmpfile);
846 if (fclose(fp) == EOF) {
847 FILE_OP_ERROR(tmpfile, "fclose");
848 claws_unlink(tmpfile);
853 perror("get_tmp_file");
857 gpgme_data_release(gpgtext);
860 /* create encrypted multipart */
861 procmime_mimeinfo_free_all(msgcontent);
862 g_node_append(mimeinfo->node, encmultipart->node);
864 encmultipart->content = MIMECONTENT_FILE;
865 encmultipart->data.filename = tmpfile;
866 procmime_encode_content(encmultipart, ENC_BASE64);
873 static PrivacySystem smime_system = {
877 smime_free_privacydata, /* free_privacydata */
879 smime_is_signed, /* is_signed(MimeInfo *) */
880 smime_check_signature, /* check_signature(MimeInfo *) */
881 smime_get_sig_status, /* get_sig_status(MimeInfo *) */
882 smime_get_sig_info_short, /* get_sig_info_short(MimeInfo *) */
883 smime_get_sig_info_full, /* get_sig_info_full(MimeInfo *) */
885 smime_is_encrypted, /* is_encrypted(MimeInfo *) */
886 smime_decrypt, /* decrypt(MimeInfo *) */
892 smime_get_encrypt_data,
894 smime_get_encrypt_warning,
895 smime_inhibit_encrypt_warning,
900 privacy_register_system(&smime_system);
905 privacy_unregister_system(&smime_system);
908 struct PluginFeature *plugin_provides(void)
910 static struct PluginFeature features[] =
911 { {PLUGIN_PRIVACY, N_("S/MIME")},
912 {PLUGIN_NOTHING, NULL}};
915 #endif /* USE_GPGME */