5396b2838b5c063c3dbf0463727f741f6f02ec0f
[apps/madmutt.git] / lib-crypt / crypt-mod-smime-gpgme.c
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 2004 g10 Code GmbH
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 /* 
11     This is a crytpo module wrapping the gpgme based smime code.
12  */
13
14 #include <lib-lib/lib-lib.h>
15
16 #include <lib-crypt/crypt-mod.h>
17 #include "crypt-gpgme.h"
18
19 static void crypt_mod_smime_init (void)
20 {
21   smime_gpgme_init ();
22 }
23
24 static int crypt_mod_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c,
25                                          BODY ** d)
26 {
27   return smime_gpgme_decrypt_mime (a, b, c, d);
28 }
29
30 static int crypt_mod_smime_application_handler (BODY * m, STATE * s)
31 {
32   return smime_gpgme_application_handler (m, s);
33 }
34
35 static char *crypt_mod_smime_findkeys (address_t * to, address_t * cc,
36                                        address_t * bcc)
37 {
38   return smime_gpgme_findkeys (to, cc, bcc);
39 }
40
41 static BODY *crypt_mod_smime_sign_message (BODY * a)
42 {
43   return smime_gpgme_sign_message (a);
44 }
45
46 static int crypt_mod_smime_verify_one (BODY * sigbdy, STATE * s,
47                                        const char *tempf)
48 {
49   return smime_gpgme_verify_one (sigbdy, s, tempf);
50 }
51
52 static int crypt_mod_smime_send_menu (HEADER * msg, int *redraw)
53 {
54   return smime_gpgme_send_menu (msg, redraw);
55 }
56
57 static BODY *crypt_mod_smime_build_smime_entity (BODY * a, char *certlist)
58 {
59   return smime_gpgme_build_smime_entity (a, certlist);
60 }
61
62 static int crypt_mod_smime_verify_sender (HEADER * h)
63 {
64   return smime_gpgme_verify_sender (h);
65 }
66
67 struct crypt_module_specs crypt_mod_smime_gpgme = { APPLICATION_SMIME,
68   {
69    crypt_mod_smime_init,
70    crypt_mod_smime_decrypt_mime,
71    crypt_mod_smime_application_handler,
72    NULL,                        /* encrypted_handler */
73    crypt_mod_smime_findkeys,
74    crypt_mod_smime_sign_message,
75    crypt_mod_smime_verify_one,
76    crypt_mod_smime_send_menu,
77
78    NULL,                        /* pgp_encrypt_message */
79    NULL,                        /* pgp_make_key_attachment */
80    NULL,                        /* pgp_check_traditional */
81    NULL,                        /* pgp_traditional_encryptsign */
82    NULL,                        /* pgp_invoke_getkeys */
83    NULL,                        /* pgp_invoke_import */
84    NULL,                        /* pgp_extract_keys_from_attachment_list */
85
86    NULL,                        /* smime_getkeys */
87    crypt_mod_smime_verify_sender,
88    crypt_mod_smime_build_smime_entity,
89    NULL,                        /* smime_invoke_import */
90    }
91 };