2006-04-05 [colin] 2.1.0cvs1
[claws.git] / src / plugins / pgpmime / pgpmime.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2006 Hiroyuki Yamamoto & the Sylpheed-Claws team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #ifdef HAVE_CONFIG_H
21 #  include "config.h"
22 #endif
23
24 #ifdef USE_GPGME
25
26 #include "defs.h"
27 #include <glib.h>
28 #include <gpgme.h>
29 #include <ctype.h>
30
31 #include "utils.h"
32 #include "privacy.h"
33 #include "procmime.h"
34
35 #include "pgpmime.h"
36 #include <plugins/pgpcore/sgpgme.h>
37 #include <plugins/pgpcore/prefs_gpg.h>
38 #include <plugins/pgpcore/passphrase.h>
39
40 #include "prefs_common.h"
41
42 typedef struct _PrivacyDataPGP PrivacyDataPGP;
43
44 struct _PrivacyDataPGP
45 {
46         PrivacyData     data;
47         
48         gboolean        done_sigtest;
49         gboolean        is_signed;
50         gpgme_verify_result_t   sigstatus;
51         gpgme_ctx_t     ctx;
52 };
53
54 static PrivacySystem pgpmime_system;
55
56 static gint pgpmime_check_signature(MimeInfo *mimeinfo);
57
58 static PrivacyDataPGP *pgpmime_new_privacydata()
59 {
60         PrivacyDataPGP *data;
61
62         data = g_new0(PrivacyDataPGP, 1);
63         data->data.system = &pgpmime_system;
64         data->done_sigtest = FALSE;
65         data->is_signed = FALSE;
66         data->sigstatus = NULL;
67         gpgme_new(&data->ctx);
68         
69         return data;
70 }
71
72 static void pgpmime_free_privacydata(PrivacyData *_data)
73 {
74         PrivacyDataPGP *data = (PrivacyDataPGP *) _data;
75         gpgme_release(data->ctx);
76         g_free(data);
77 }
78
79 static gboolean pgpmime_is_signed(MimeInfo *mimeinfo)
80 {
81         MimeInfo *parent;
82         MimeInfo *signature;
83         const gchar *protocol;
84         PrivacyDataPGP *data = NULL;
85         
86         g_return_val_if_fail(mimeinfo != NULL, FALSE);
87         if (mimeinfo->privacy != NULL) {
88                 data = (PrivacyDataPGP *) mimeinfo->privacy;
89                 if (data->done_sigtest)
90                         return data->is_signed;
91         }
92         
93         /* check parent */
94         parent = procmime_mimeinfo_parent(mimeinfo);
95         if (parent == NULL)
96                 return FALSE;
97         if ((parent->type != MIMETYPE_MULTIPART) ||
98             g_ascii_strcasecmp(parent->subtype, "signed"))
99                 return FALSE;
100         protocol = procmime_mimeinfo_get_parameter(parent, "protocol");
101         if ((protocol == NULL) || 
102             (g_ascii_strcasecmp(protocol, "application/pgp-signature")))
103                 return FALSE;
104
105         /* check if mimeinfo is the first child */
106         if (parent->node->children->data != mimeinfo)
107                 return FALSE;
108
109         /* check signature */
110         signature = parent->node->children->next != NULL ? 
111             (MimeInfo *) parent->node->children->next->data : NULL;
112         if (signature == NULL)
113                 return FALSE;
114         if ((signature->type != MIMETYPE_APPLICATION) ||
115             (g_ascii_strcasecmp(signature->subtype, "pgp-signature")))
116                 return FALSE;
117
118         if (data == NULL) {
119                 data = pgpmime_new_privacydata();
120                 mimeinfo->privacy = (PrivacyData *) data;
121         }
122         
123         data->done_sigtest = TRUE;
124         data->is_signed = TRUE;
125
126         return TRUE;
127 }
128
129 static gchar *get_canonical_content(FILE *fp, const gchar *boundary)
130 {
131         gchar *ret;
132         GString *textbuffer;
133         guint boundary_len;
134         gchar buf[BUFFSIZE];
135
136         boundary_len = strlen(boundary);
137         while (fgets(buf, sizeof(buf), fp) != NULL)
138                 if (IS_BOUNDARY(buf, boundary, boundary_len))
139                         break;
140
141         textbuffer = g_string_new("");
142         while (fgets(buf, sizeof(buf), fp) != NULL) {
143                 gchar *buf2;
144
145                 if (IS_BOUNDARY(buf, boundary, boundary_len))
146                         break;
147                 
148                 buf2 = canonicalize_str(buf);
149                 g_string_append(textbuffer, buf2);
150                 g_free(buf2);
151         }
152         g_string_truncate(textbuffer, textbuffer->len - 2);
153                 
154         ret = textbuffer->str;
155         g_string_free(textbuffer, FALSE);
156
157         return ret;
158 }
159
160 static gint pgpmime_check_signature(MimeInfo *mimeinfo)
161 {
162         PrivacyDataPGP *data;
163         MimeInfo *parent, *signature;
164         FILE *fp;
165         gchar *boundary;
166         gchar *textstr;
167         gpgme_data_t sigdata = NULL, textdata = NULL;
168         gpgme_error_t err;
169         g_return_val_if_fail(mimeinfo != NULL, -1);
170         g_return_val_if_fail(mimeinfo->privacy != NULL, -1);
171         data = (PrivacyDataPGP *) mimeinfo->privacy;
172         gpgme_new(&data->ctx);
173         
174         debug_print("Checking PGP/MIME signature\n");
175
176         err = gpgme_set_protocol(data->ctx, GPGME_PROTOCOL_OpenPGP);
177
178         if (err) {
179                 debug_print ("gpgme_set_protocol failed: %s\n",
180                    gpgme_strerror (err));
181         }
182         parent = procmime_mimeinfo_parent(mimeinfo);
183
184         fp = g_fopen(parent->data.filename, "rb");
185         g_return_val_if_fail(fp != NULL, SIGNATURE_INVALID);
186         
187         boundary = g_hash_table_lookup(parent->typeparameters, "boundary");
188         if (!boundary)
189                 return 0;
190
191         textstr = get_canonical_content(fp, boundary);
192
193         err = gpgme_data_new_from_mem(&textdata, textstr, strlen(textstr), 0);
194         if (err) {
195                 debug_print ("gpgme_data_new_from_mem failed: %s\n",
196                    gpgme_strerror (err));
197         }
198         signature = (MimeInfo *) mimeinfo->node->next->data;
199         sigdata = sgpgme_data_from_mimeinfo(signature);
200
201         err = 0;
202         if (signature->encoding_type == ENC_BASE64) {
203                 err = gpgme_data_set_encoding (sigdata, GPGME_DATA_ENCODING_BASE64);
204         }
205         
206         if (err) {
207                 debug_print ("gpgme_data_set_encoding failed: %s\n",
208                         gpgme_strerror (err));
209         }
210
211         data->sigstatus =
212                 sgpgme_verify_signature (data->ctx, sigdata, textdata, NULL);
213
214         gpgme_data_release(sigdata);
215         gpgme_data_release(textdata);
216         g_free(textstr);
217         fclose(fp);
218         
219         return 0;
220 }
221
222 static SignatureStatus pgpmime_get_sig_status(MimeInfo *mimeinfo)
223 {
224         PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
225         
226         g_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
227
228         if (data->sigstatus == NULL && 
229             prefs_gpg_get_config()->auto_check_signatures)
230                 pgpmime_check_signature(mimeinfo);
231         
232         return sgpgme_sigstat_gpgme_to_privacy(data->ctx, data->sigstatus);
233 }
234
235 static gchar *pgpmime_get_sig_info_short(MimeInfo *mimeinfo)
236 {
237         PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
238         
239         g_return_val_if_fail(data != NULL, g_strdup("Error"));
240
241         if (data->sigstatus == NULL && 
242             prefs_gpg_get_config()->auto_check_signatures)
243                 pgpmime_check_signature(mimeinfo);
244         
245         return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
246 }
247
248 static gchar *pgpmime_get_sig_info_full(MimeInfo *mimeinfo)
249 {
250         PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
251         
252         g_return_val_if_fail(data != NULL, g_strdup("Error"));
253
254         if (data->sigstatus == NULL && 
255             prefs_gpg_get_config()->auto_check_signatures)
256                 pgpmime_check_signature(mimeinfo);
257         
258         return sgpgme_sigstat_info_full(data->ctx, data->sigstatus);
259 }
260
261 static gboolean pgpmime_is_encrypted(MimeInfo *mimeinfo)
262 {
263         MimeInfo *tmpinfo;
264         const gchar *tmpstr;
265         
266         if (mimeinfo->type != MIMETYPE_MULTIPART)
267                 return FALSE;
268         if (g_ascii_strcasecmp(mimeinfo->subtype, "encrypted"))
269                 return FALSE;
270         tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "protocol");
271         if ((tmpstr == NULL) || g_ascii_strcasecmp(tmpstr, "application/pgp-encrypted"))
272                 return FALSE;
273         if (g_node_n_children(mimeinfo->node) != 2)
274                 return FALSE;
275         
276         tmpinfo = (MimeInfo *) g_node_nth_child(mimeinfo->node, 0)->data;
277         if (tmpinfo->type != MIMETYPE_APPLICATION)
278                 return FALSE;
279         if (g_ascii_strcasecmp(tmpinfo->subtype, "pgp-encrypted"))
280                 return FALSE;
281         
282         tmpinfo = (MimeInfo *) g_node_nth_child(mimeinfo->node, 1)->data;
283         if (tmpinfo->type != MIMETYPE_APPLICATION)
284                 return FALSE;
285         if (g_ascii_strcasecmp(tmpinfo->subtype, "octet-stream"))
286                 return FALSE;
287         
288         return TRUE;
289 }
290
291 static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
292 {
293         MimeInfo *encinfo, *decinfo, *parseinfo;
294         gpgme_data_t cipher = NULL, plain = NULL;
295         static gint id = 0;
296         FILE *dstfp;
297         gchar *fname;
298         gpgme_verify_result_t sigstat = NULL;
299         PrivacyDataPGP *data = NULL;
300         gpgme_ctx_t ctx;
301         gchar *chars;
302         size_t len;
303
304         if (gpgme_new(&ctx) != GPG_ERR_NO_ERROR)
305                 return NULL;
306
307         
308         g_return_val_if_fail(pgpmime_is_encrypted(mimeinfo), NULL);
309         
310         encinfo = (MimeInfo *) g_node_nth_child(mimeinfo->node, 1)->data;
311
312         cipher = sgpgme_data_from_mimeinfo(encinfo);
313         plain = sgpgme_decrypt_verify(cipher, &sigstat, ctx);
314
315         gpgme_data_release(cipher);
316         if (plain == NULL) {
317                 debug_print("plain is null!\n");
318                 gpgme_release(ctx);
319                 return NULL;
320         }
321
322         fname = g_strdup_printf("%s%cplaintext.%08x",
323                 get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id);
324
325         if ((dstfp = g_fopen(fname, "wb")) == NULL) {
326                 FILE_OP_ERROR(fname, "fopen");
327                 g_free(fname);
328                 gpgme_data_release(plain);
329                 gpgme_release(ctx);
330                 debug_print("can't open!\n");
331                 return NULL;
332         }
333
334         fprintf(dstfp, "MIME-Version: 1.0\n");
335
336         chars = gpgme_data_release_and_get_mem(plain, &len);
337         if (len > 0)
338                 fwrite(chars, len, 1, dstfp);
339         fclose(dstfp);
340
341         parseinfo = procmime_scan_file(fname);
342         g_free(fname);
343         if (parseinfo == NULL) {
344                 gpgme_release(ctx);
345                 return NULL;
346         }
347         decinfo = g_node_first_child(parseinfo->node) != NULL ?
348                 g_node_first_child(parseinfo->node)->data : NULL;
349         if (decinfo == NULL) {
350                 gpgme_release(ctx);
351                 return NULL;
352         }
353
354         g_node_unlink(decinfo->node);
355         procmime_mimeinfo_free_all(parseinfo);
356
357         decinfo->tmp = TRUE;
358
359         if (sigstat != NULL && sigstat->signatures != NULL) {
360                 if (decinfo->privacy != NULL) {
361                         data = (PrivacyDataPGP *) decinfo->privacy;
362                 } else {
363                         data = pgpmime_new_privacydata();
364                         decinfo->privacy = (PrivacyData *) data;        
365                 }
366                 data->done_sigtest = TRUE;
367                 data->is_signed = TRUE;
368                 data->sigstatus = sigstat;
369                 if (data->ctx)
370                         gpgme_release(data->ctx);
371                 data->ctx = ctx;
372         } else
373                 gpgme_release(ctx);
374
375         return decinfo;
376 }
377
378 gboolean pgpmime_sign(MimeInfo *mimeinfo, PrefsAccount *account)
379 {
380         MimeInfo *msgcontent, *sigmultipart, *newinfo;
381         gchar *textstr, *micalg;
382         FILE *fp;
383         gchar *boundary = NULL;
384         gchar *sigcontent;
385         gpgme_ctx_t ctx;
386         gpgme_data_t gpgtext, gpgsig;
387         gpgme_error_t err;
388         size_t len;
389         struct passphrase_cb_info_s info;
390         gpgme_sign_result_t result = NULL;
391         gchar *test_msg;
392         
393         fp = my_tmpfile();
394         if (fp == NULL) {
395                 perror("my_tmpfile");
396                 return FALSE;
397         }
398         procmime_write_mimeinfo(mimeinfo, fp);
399         rewind(fp);
400
401         /* read temporary file into memory */
402         test_msg = file_read_stream_to_str(fp);
403         fclose(fp);
404         
405         memset (&info, 0, sizeof info);
406
407         /* remove content node from message */
408         msgcontent = (MimeInfo *) mimeinfo->node->children->data;
409         g_node_unlink(msgcontent->node);
410
411         /* create temporary multipart for content */
412         sigmultipart = procmime_mimeinfo_new();
413         sigmultipart->type = MIMETYPE_MULTIPART;
414         sigmultipart->subtype = g_strdup("signed");
415         
416         do {
417                 if (boundary)
418                         g_free(boundary);
419                 boundary = generate_mime_boundary("Sig");
420         } while (strstr(test_msg, boundary) != NULL);
421         
422         g_free(test_msg);
423
424         g_hash_table_insert(sigmultipart->typeparameters, g_strdup("boundary"),
425                             g_strdup(boundary));
426         g_hash_table_insert(sigmultipart->typeparameters, g_strdup("protocol"),
427                             g_strdup("application/pgp-signature"));
428         g_node_append(sigmultipart->node, msgcontent->node);
429         g_node_append(mimeinfo->node, sigmultipart->node);
430
431         /* write message content to temporary file */
432         fp = my_tmpfile();
433         if (fp == NULL) {
434                 perror("my_tmpfile");
435                 return FALSE;
436         }
437         procmime_write_mimeinfo(sigmultipart, fp);
438         rewind(fp);
439
440         /* read temporary file into memory */
441         textstr = get_canonical_content(fp, boundary);
442
443         fclose(fp);
444
445         gpgme_data_new_from_mem(&gpgtext, textstr, strlen(textstr), 0);
446         gpgme_data_new(&gpgsig);
447         gpgme_new(&ctx);
448         gpgme_set_textmode(ctx, 1);
449         gpgme_set_armor(ctx, 1);
450         gpgme_signers_clear (ctx);
451
452         if (!sgpgme_setup_signers(ctx, account)) {
453                 gpgme_release(ctx);
454                 return FALSE;
455         }
456
457         if (getenv("GPG_AGENT_INFO")) {
458                 debug_print("GPG_AGENT_INFO environment defined, running without passphrase callback\n");
459         } else {
460                 info.c = ctx;
461                 gpgme_set_passphrase_cb (ctx, gpgmegtk_passphrase_cb, &info);
462         }
463
464         err = gpgme_op_sign(ctx, gpgtext, gpgsig, GPGME_SIG_MODE_DETACH);
465         if (err != GPG_ERR_NO_ERROR) {
466                 debug_print("gpgme_op_sign error : %x\n", err);
467                 gpgme_release(ctx);
468                 return FALSE;
469         }
470         result = gpgme_op_sign_result(ctx);
471         if (result && result->signatures) {
472             if (gpgme_get_protocol(ctx) == GPGME_PROTOCOL_OpenPGP) {
473                 micalg = g_strdup_printf("PGP-%s", gpgme_hash_algo_name(
474                             result->signatures->hash_algo));
475             } else {
476                 micalg = g_strdup(gpgme_hash_algo_name(
477                             result->signatures->hash_algo));
478             }
479         } else {
480             /* can't get result (maybe no signing key?) */
481             debug_print("gpgme_op_sign_result error\n");
482             return FALSE;
483         }
484
485         gpgme_release(ctx);
486         sigcontent = gpgme_data_release_and_get_mem(gpgsig, &len);
487         gpgme_data_release(gpgtext);
488         g_free(textstr);
489
490         /* add signature */
491         g_hash_table_insert(sigmultipart->typeparameters, g_strdup("micalg"),
492                             micalg);
493
494         newinfo = procmime_mimeinfo_new();
495         newinfo->type = MIMETYPE_APPLICATION;
496         newinfo->subtype = g_strdup("pgp-signature");
497         g_hash_table_insert(newinfo->typeparameters, g_strdup("name"),
498                              g_strdup("signature.asc"));
499         newinfo->content = MIMECONTENT_MEM;
500         newinfo->disposition = DISPOSITIONTYPE_ATTACHMENT;
501         g_hash_table_insert(newinfo->dispositionparameters, g_strdup("filename"),
502                             g_strdup("signature.asc"));
503         newinfo->data.mem = g_malloc(len + 1);
504         g_memmove(newinfo->data.mem, sigcontent, len);
505         newinfo->data.mem[len] = '\0';
506         g_node_append(sigmultipart->node, newinfo->node);
507
508         g_free(sigcontent);
509
510         return TRUE;
511 }
512 gchar *pgpmime_get_encrypt_data(GSList *recp_names)
513 {
514         return sgpgme_get_encrypt_data(recp_names, GPGME_PROTOCOL_OpenPGP);
515 }
516
517 gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
518 {
519         MimeInfo *msgcontent, *encmultipart, *newinfo;
520         FILE *fp;
521         gchar *boundary, *enccontent;
522         size_t len;
523         gchar *textstr;
524         gpgme_data_t gpgtext = NULL, gpgenc = NULL;
525         gpgme_ctx_t ctx = NULL;
526         gpgme_key_t *kset = NULL;
527         gchar **fprs = g_strsplit(encrypt_data, " ", -1);
528         gint i = 0;
529         while (fprs[i] && strlen(fprs[i])) {
530                 i++;
531         }
532         
533         kset = g_malloc(sizeof(gpgme_key_t)*(i+1));
534         memset(kset, 0, sizeof(gpgme_key_t)*(i+1));
535         gpgme_new(&ctx);
536         i = 0;
537         while (fprs[i] && strlen(fprs[i])) {
538                 gpgme_key_t key;
539                 gpgme_error_t err;
540                 err = gpgme_get_key(ctx, fprs[i], &key, 0);
541                 if (err) {
542                         debug_print("can't add key '%s'[%d] (%s)\n", fprs[i],i, gpgme_strerror(err));
543                         break;
544                 }
545                 debug_print("found %s at %d\n", fprs[i], i);
546                 kset[i] = key;
547                 i++;
548         }
549         
550         debug_print("Encrypting message content\n");
551
552         /* remove content node from message */
553         msgcontent = (MimeInfo *) mimeinfo->node->children->data;
554         g_node_unlink(msgcontent->node);
555
556         /* create temporary multipart for content */
557         encmultipart = procmime_mimeinfo_new();
558         encmultipart->type = MIMETYPE_MULTIPART;
559         encmultipart->subtype = g_strdup("encrypted");
560         boundary = generate_mime_boundary("Encrypt");
561         g_hash_table_insert(encmultipart->typeparameters, g_strdup("boundary"),
562                             g_strdup(boundary));
563         g_hash_table_insert(encmultipart->typeparameters, g_strdup("protocol"),
564                             g_strdup("application/pgp-encrypted"));
565         g_node_append(encmultipart->node, msgcontent->node);
566
567         /* write message content to temporary file */
568         fp = my_tmpfile();
569         if (fp == NULL) {
570                 perror("my_tmpfile");
571                 return FALSE;
572         }
573         procmime_write_mimeinfo(encmultipart, fp);
574         rewind(fp);
575
576         /* read temporary file into memory */
577         textstr = get_canonical_content(fp, boundary);
578
579         fclose(fp);
580
581         /* encrypt data */
582         gpgme_data_new_from_mem(&gpgtext, textstr, strlen(textstr), 0);
583         gpgme_data_new(&gpgenc);
584         gpgme_set_armor(ctx, 1);
585         gpgme_data_rewind(gpgtext);
586         
587         gpgme_op_encrypt(ctx, kset, GPGME_ENCRYPT_ALWAYS_TRUST, gpgtext, gpgenc);
588
589         gpgme_release(ctx);
590         enccontent = gpgme_data_release_and_get_mem(gpgenc, &len);
591         gpgme_data_release(gpgtext);
592         g_free(textstr);
593
594         /* create encrypted multipart */
595         g_node_unlink(msgcontent->node);
596         procmime_mimeinfo_free_all(msgcontent);
597         g_node_append(mimeinfo->node, encmultipart->node);
598
599         newinfo = procmime_mimeinfo_new();
600         newinfo->type = MIMETYPE_APPLICATION;
601         newinfo->subtype = g_strdup("pgp-encrypted");
602         newinfo->content = MIMECONTENT_MEM;
603         newinfo->data.mem = g_strdup("Version: 1\n");
604         g_node_append(encmultipart->node, newinfo->node);
605
606         newinfo = procmime_mimeinfo_new();
607         newinfo->type = MIMETYPE_APPLICATION;
608         newinfo->subtype = g_strdup("octet-stream");
609         newinfo->content = MIMECONTENT_MEM;
610         newinfo->data.mem = g_malloc(len + 1);
611         g_memmove(newinfo->data.mem, enccontent, len);
612         newinfo->data.mem[len] = '\0';
613         g_node_append(encmultipart->node, newinfo->node);
614
615         g_free(enccontent);
616
617         return TRUE;
618 }
619
620 static PrivacySystem pgpmime_system = {
621         "pgpmime",                      /* id */
622         "PGP MIME",                     /* name */
623
624         pgpmime_free_privacydata,       /* free_privacydata */
625
626         pgpmime_is_signed,              /* is_signed(MimeInfo *) */
627         pgpmime_check_signature,        /* check_signature(MimeInfo *) */
628         pgpmime_get_sig_status,         /* get_sig_status(MimeInfo *) */
629         pgpmime_get_sig_info_short,     /* get_sig_info_short(MimeInfo *) */
630         pgpmime_get_sig_info_full,      /* get_sig_info_full(MimeInfo *) */
631
632         pgpmime_is_encrypted,           /* is_encrypted(MimeInfo *) */
633         pgpmime_decrypt,                /* decrypt(MimeInfo *) */
634
635         TRUE,
636         pgpmime_sign,
637
638         TRUE,
639         pgpmime_get_encrypt_data,
640         pgpmime_encrypt,
641 };
642
643 void pgpmime_init()
644 {
645         privacy_register_system(&pgpmime_system);
646 }
647
648 void pgpmime_done()
649 {
650         privacy_unregister_system(&pgpmime_system);
651 }
652
653 #endif /* USE_GPGME */