2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2009 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 cm_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 cm_return_val_if_fail(mimeinfo != NULL, -1);
198 cm_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 cm_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, textstr?strlen(textstr):0, 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 cm_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;
278 g_node_unlink(decinfo->node);
279 procmime_mimeinfo_free_all(newinfo);
281 parentinfo = procmime_mimeinfo_parent(mimeinfo);
282 childnumber = g_node_child_index(parentinfo->node, mimeinfo);
283 if (parentinfo->type == MIMETYPE_MESSAGE &&
284 !strcmp(parentinfo->subtype, "rfc822")) {
285 procmime_decode_content(parentinfo);
286 procmime_encode_content(parentinfo, ENC_BASE64);
287 procmime_encode_content(parentinfo, ENC_8BIT);
288 if (parentinfo->content == MIMECONTENT_MEM) {
290 (gint)(strstr(parentinfo->data.mem, "\n\n") - parentinfo->data.mem);
292 parentinfo->length = newlen;
295 g_node_prepend(parentinfo->node, decinfo->node);
303 signature = (MimeInfo *) mimeinfo->node->next->data;
304 sigdata = sgpgme_data_from_mimeinfo(signature);
307 if (signature->encoding_type == ENC_BASE64) {
308 err = gpgme_data_set_encoding (sigdata, GPGME_DATA_ENCODING_BASE64);
312 debug_print ("gpgme_data_set_encoding failed: %s\n",
313 gpgme_strerror (err));
317 sgpgme_verify_signature (data->ctx, sigdata, textdata, NULL);
319 gpgme_data_release(sigdata);
320 gpgme_data_release(textdata);
327 static SignatureStatus smime_get_sig_status(MimeInfo *mimeinfo)
329 PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
331 cm_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
333 if (data->sigstatus == NULL &&
334 prefs_gpg_get_config()->auto_check_signatures)
335 smime_check_signature(mimeinfo);
337 return sgpgme_sigstat_gpgme_to_privacy(data->ctx, data->sigstatus);
340 static gchar *smime_get_sig_info_short(MimeInfo *mimeinfo)
342 PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
344 cm_return_val_if_fail(data != NULL, g_strdup("Error"));
346 if (data->sigstatus == NULL &&
347 prefs_gpg_get_config()->auto_check_signatures)
348 smime_check_signature(mimeinfo);
350 return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
353 static gchar *smime_get_sig_info_full(MimeInfo *mimeinfo)
355 PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
357 cm_return_val_if_fail(data != NULL, g_strdup("Error"));
359 if (data->sigstatus == NULL &&
360 prefs_gpg_get_config()->auto_check_signatures)
361 smime_check_signature(mimeinfo);
363 return sgpgme_sigstat_info_full(data->ctx, data->sigstatus);
366 static gboolean smime_is_encrypted(MimeInfo *mimeinfo)
370 if (mimeinfo->type != MIMETYPE_APPLICATION)
372 if (!g_ascii_strcasecmp(mimeinfo->subtype, "pkcs7-mime")) {
373 tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
374 if (tmpstr && g_ascii_strcasecmp(tmpstr, "enveloped-data"))
379 } else if (!g_ascii_strcasecmp(mimeinfo->subtype, "x-pkcs7-mime")) {
380 tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
381 if (tmpstr && g_ascii_strcasecmp(tmpstr, "enveloped-data"))
389 static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
391 MimeInfo *encinfo, *decinfo, *parseinfo;
392 gpgme_data_t cipher = NULL, plain = NULL;
396 gpgme_verify_result_t sigstat = NULL;
397 PrivacyDataPGP *data = NULL;
403 cm_return_val_if_fail(smime_is_encrypted(mimeinfo), NULL);
405 if ((err = gpgme_new(&ctx)) != GPG_ERR_NO_ERROR) {
406 privacy_set_error(_("Couldn't initialize GPG context, %s"), gpgme_strerror(err));
410 err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
412 debug_print ("gpgme_set_protocol failed: %s\n",
413 gpgme_strerror (err));
414 privacy_set_error(_("Couldn't set GPG protocol, %s"), gpgme_strerror(err));
418 gpgme_set_armor(ctx, TRUE);
422 cipher = sgpgme_data_from_mimeinfo(encinfo);
424 plain = sgpgme_decrypt_verify(cipher, &sigstat, ctx);
426 gpgme_data_release(cipher);
428 debug_print("plain is null!\n");
433 fname = g_strdup_printf("%s%cplaintext.%08x",
434 get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id);
436 if ((dstfp = g_fopen(fname, "wb")) == NULL) {
437 FILE_OP_ERROR(fname, "g_fopen");
439 gpgme_data_release(plain);
441 debug_print("can't open!\n");
442 privacy_set_error(_("Couldn't open temporary file"));
446 if (fprintf(dstfp, "MIME-Version: 1.0\n") < 0) {
447 FILE_OP_ERROR(fname, "fprintf");
450 gpgme_data_release(plain);
452 debug_print("can't close!\n");
453 privacy_set_error(_("Couldn't write to temporary file"));
457 chars = sgpgme_data_release_and_get_mem(plain, &len);
460 if (fwrite(chars, 1, len, dstfp) < len) {
461 FILE_OP_ERROR(fname, "fwrite");
464 gpgme_data_release(plain);
466 debug_print("can't write!\n");
467 privacy_set_error(_("Couldn't write to temporary file"));
471 if (fclose(dstfp) == EOF) {
472 FILE_OP_ERROR(fname, "fclose");
475 gpgme_data_release(plain);
477 debug_print("can't close!\n");
478 privacy_set_error(_("Couldn't close temporary file"));
483 parseinfo = procmime_scan_file(fname);
485 if (parseinfo == NULL) {
486 privacy_set_error(_("Couldn't parse decrypted file."));
490 decinfo = g_node_first_child(parseinfo->node) != NULL ?
491 g_node_first_child(parseinfo->node)->data : NULL;
492 if (decinfo == NULL) {
493 privacy_set_error(_("Couldn't parse decrypted file parts."));
498 g_node_unlink(decinfo->node);
499 procmime_mimeinfo_free_all(parseinfo);
503 if (sigstat != NULL && sigstat->signatures != NULL) {
504 if (decinfo->privacy != NULL) {
505 data = (PrivacyDataPGP *) decinfo->privacy;
507 data = smime_new_privacydata();
508 decinfo->privacy = (PrivacyData *) data;
510 data->done_sigtest = TRUE;
511 data->is_signed = TRUE;
512 data->sigstatus = sigstat;
514 gpgme_release(data->ctx);
524 gboolean smime_sign(MimeInfo *mimeinfo, PrefsAccount *account, const gchar *from_addr)
526 MimeInfo *msgcontent, *sigmultipart, *newinfo;
527 gchar *textstr, *micalg;
529 gchar *boundary = NULL;
532 gpgme_data_t gpgtext, gpgsig;
535 struct passphrase_cb_info_s info;
536 gpgme_sign_result_t result = NULL;
538 gchar *real_content = NULL;
542 perror("my_tmpfile");
545 procmime_write_mimeinfo(mimeinfo, fp);
548 /* read temporary file into memory */
549 test_msg = file_read_stream_to_str(fp);
552 memset (&info, 0, sizeof info);
554 /* remove content node from message */
555 msgcontent = (MimeInfo *) mimeinfo->node->children->data;
556 g_node_unlink(msgcontent->node);
558 /* create temporary multipart for content */
559 sigmultipart = procmime_mimeinfo_new();
560 sigmultipart->type = MIMETYPE_MULTIPART;
561 sigmultipart->subtype = g_strdup("signed");
566 boundary = generate_mime_boundary("Sig");
567 } while (strstr(test_msg, boundary) != NULL);
571 g_hash_table_insert(sigmultipart->typeparameters, g_strdup("boundary"),
573 g_hash_table_insert(sigmultipart->typeparameters, g_strdup("protocol"),
574 g_strdup("application/pkcs7-signature"));
575 g_node_append(sigmultipart->node, msgcontent->node);
576 g_node_append(mimeinfo->node, sigmultipart->node);
578 /* write message content to temporary file */
581 perror("my_tmpfile");
584 procmime_write_mimeinfo(sigmultipart, fp);
587 /* read temporary file into memory */
588 textstr = get_canonical_content(fp, boundary);
594 gpgme_data_new_from_mem(&gpgtext, textstr, textstr?strlen(textstr):0, 0);
595 gpgme_data_new(&gpgsig);
597 gpgme_set_armor(ctx, TRUE);
598 gpgme_signers_clear (ctx);
600 err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
603 debug_print ("gpgme_set_protocol failed: %s\n",
604 gpgme_strerror (err));
605 gpgme_data_release(gpgtext);
610 if (!sgpgme_setup_signers(ctx, account, from_addr)) {
611 debug_print("setup_signers failed\n");
612 gpgme_data_release(gpgtext);
618 prefs_gpg_enable_agent(TRUE);
619 gpgme_set_passphrase_cb (ctx, NULL, &info);
621 err = gpgme_op_sign(ctx, gpgtext, gpgsig, GPGME_SIG_MODE_DETACH);
622 if (err != GPG_ERR_NO_ERROR) {
623 alertpanel_error("S/MIME : Cannot sign, %s (%d)", gpg_strerror(err), gpg_err_code(err));
624 gpgme_data_release(gpgtext);
628 result = gpgme_op_sign_result(ctx);
629 if (result && result->signatures) {
630 if (gpgme_get_protocol(ctx) == GPGME_PROTOCOL_OpenPGP) {
631 micalg = g_strdup_printf("PGP-%s", gpgme_hash_algo_name(
632 result->signatures->hash_algo));
634 micalg = g_strdup(gpgme_hash_algo_name(
635 result->signatures->hash_algo));
638 /* can't get result (maybe no signing key?) */
639 debug_print("gpgme_op_sign_result error\n");
644 sigcontent = sgpgme_data_release_and_get_mem(gpgsig, &len);
645 gpgme_data_release(gpgtext);
652 real_content = sigcontent+strlen("-----BEGIN SIGNED MESSAGE-----\n");
653 if (!strstr(real_content, "-----END SIGNED MESSAGE-----")) {
654 debug_print("missing end\n");
658 *strstr(real_content, "-----END SIGNED MESSAGE-----") = '\0';
660 g_hash_table_insert(sigmultipart->typeparameters, g_strdup("micalg"),
663 newinfo = procmime_mimeinfo_new();
664 newinfo->type = MIMETYPE_APPLICATION;
665 newinfo->subtype = g_strdup("pkcs7-signature");
666 g_hash_table_insert(newinfo->typeparameters, g_strdup("name"),
667 g_strdup("smime.p7s"));
668 newinfo->content = MIMECONTENT_MEM;
669 newinfo->disposition = DISPOSITIONTYPE_ATTACHMENT;
670 g_hash_table_insert(newinfo->dispositionparameters, g_strdup("filename"),
671 g_strdup("smime.p7s"));
672 newinfo->data.mem = g_malloc(len + 1);
673 g_memmove(newinfo->data.mem, real_content, len);
674 newinfo->data.mem[len] = '\0';
675 newinfo->encoding_type = ENC_BASE64;
676 g_node_append(sigmultipart->node, newinfo->node);
682 gchar *smime_get_encrypt_data(GSList *recp_names)
684 return sgpgme_get_encrypt_data(recp_names, GPGME_PROTOCOL_CMS);
687 static const gchar *smime_get_encrypt_warning(void)
689 if (prefs_gpg_should_skip_encryption_warning(smime_system.id))
692 return _("Please note that email headers, like Subject, "
693 "are not encrypted by the S/MIME system.");
696 static void smime_inhibit_encrypt_warning(gboolean inhibit)
699 prefs_gpg_add_skip_encryption_warning(smime_system.id);
701 prefs_gpg_remove_skip_encryption_warning(smime_system.id);
704 static gchar *fp_read_noconv(FILE *fp)
709 gchar *result = NULL;
713 array = g_byte_array_new();
715 while ((n_read = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
716 if (n_read < sizeof(buf) && ferror(fp))
718 g_byte_array_append(array, buf, n_read);
722 FILE_OP_ERROR("file stream", "fread");
723 g_byte_array_free(array, TRUE);
728 g_byte_array_append(array, buf, 1);
729 result = (gchar *)array->data;
730 g_byte_array_free(array, FALSE);
735 gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
737 MimeInfo *msgcontent, *encmultipart;
741 gchar *textstr = NULL;
742 gpgme_data_t gpgtext = NULL, gpgenc = NULL;
743 gpgme_ctx_t ctx = NULL;
744 gpgme_key_t *kset = NULL;
745 gchar **fprs = g_strsplit(encrypt_data, " ", -1);
748 gchar *tmpfile = NULL;
750 while (fprs[i] && strlen(fprs[i])) {
756 err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
759 debug_print ("gpgme_set_protocol failed: %s\n",
760 gpgme_strerror (err));
764 kset = g_malloc(sizeof(gpgme_key_t)*(i+1));
765 memset(kset, 0, sizeof(gpgme_key_t)*(i+1));
768 while (fprs[i] && strlen(fprs[i])) {
771 err = gpgme_get_key(ctx, fprs[i], &key, 0);
773 debug_print("can't add key '%s'[%d] (%s)\n", fprs[i],i, gpgme_strerror(err));
776 debug_print("found %s at %d\n", fprs[i], i);
781 debug_print("Encrypting message content\n");
783 /* remove content node from message */
784 msgcontent = (MimeInfo *) mimeinfo->node->children->data;
785 g_node_unlink(msgcontent->node);
788 /* create temporary multipart for content */
789 encmultipart = procmime_mimeinfo_new();
790 encmultipart->type = MIMETYPE_APPLICATION;
791 encmultipart->subtype = g_strdup("x-pkcs7-mime");
792 g_hash_table_insert(encmultipart->typeparameters, g_strdup("name"),
793 g_strdup("smime.p7m"));
794 g_hash_table_insert(encmultipart->typeparameters,
795 g_strdup("smime-type"),
796 g_strdup("enveloped-data"));
798 encmultipart->disposition = DISPOSITIONTYPE_ATTACHMENT;
799 g_hash_table_insert(encmultipart->dispositionparameters, g_strdup("filename"),
800 g_strdup("smime.p7m"));
802 g_node_append(encmultipart->node, msgcontent->node);
804 /* write message content to temporary file */
805 tmpfile = get_tmp_file();
806 fp = g_fopen(tmpfile, "wb");
808 perror("get_tmp_file");
811 procmime_decode_content(msgcontent);
812 procmime_write_mime_header(msgcontent, fp);
813 procmime_write_mimeinfo(msgcontent, fp);
815 canonicalize_file_replace(tmpfile);
816 fp = g_fopen(tmpfile, "rb");
818 perror("get_tmp_file");
823 /* read temporary file into memory */
824 textstr = fp_read_noconv(fp);
829 gpgme_data_new_from_mem(&gpgtext, textstr, textstr?strlen(textstr):0, 0);
830 gpgme_data_new(&gpgenc);
831 cm_gpgme_data_rewind(gpgtext);
833 gpgme_op_encrypt(ctx, kset, GPGME_ENCRYPT_ALWAYS_TRUST, gpgtext, gpgenc);
836 enccontent = sgpgme_data_release_and_get_mem(gpgenc, &len);
839 g_warning("no enccontent\n");
843 tmpfile = get_tmp_file();
844 fp = g_fopen(tmpfile, "wb");
846 if (fwrite(enccontent, 1, len, fp) < len) {
847 FILE_OP_ERROR(tmpfile, "fwrite");
849 claws_unlink(tmpfile);
853 if (fclose(fp) == EOF) {
854 FILE_OP_ERROR(tmpfile, "fclose");
855 claws_unlink(tmpfile);
860 perror("get_tmp_file");
864 gpgme_data_release(gpgtext);
867 /* create encrypted multipart */
868 procmime_mimeinfo_free_all(msgcontent);
869 g_node_append(mimeinfo->node, encmultipart->node);
871 encmultipart->content = MIMECONTENT_FILE;
872 encmultipart->data.filename = tmpfile;
873 procmime_encode_content(encmultipart, ENC_BASE64);
880 static PrivacySystem smime_system = {
884 smime_free_privacydata, /* free_privacydata */
886 smime_is_signed, /* is_signed(MimeInfo *) */
887 smime_check_signature, /* check_signature(MimeInfo *) */
888 smime_get_sig_status, /* get_sig_status(MimeInfo *) */
889 smime_get_sig_info_short, /* get_sig_info_short(MimeInfo *) */
890 smime_get_sig_info_full, /* get_sig_info_full(MimeInfo *) */
892 smime_is_encrypted, /* is_encrypted(MimeInfo *) */
893 smime_decrypt, /* decrypt(MimeInfo *) */
899 smime_get_encrypt_data,
901 smime_get_encrypt_warning,
902 smime_inhibit_encrypt_warning,
907 privacy_register_system(&smime_system);
912 privacy_unregister_system(&smime_system);
915 struct PluginFeature *plugin_provides(void)
917 static struct PluginFeature features[] =
918 { {PLUGIN_PRIVACY, N_("S/MIME")},
919 {PLUGIN_NOTHING, NULL}};
922 #endif /* USE_GPGME */