remove lot of code, round 1
[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 void crypt_mod_smime_void_passphrase (void)
25 {
26   /* Handled by gpg-agent.  */
27 }
28
29 static int crypt_mod_smime_valid_passphrase (void)
30 {
31   /* Handled by gpg-agent.  */
32   return 1;
33 }
34
35 static int crypt_mod_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c,
36                                          BODY ** d)
37 {
38   return smime_gpgme_decrypt_mime (a, b, c, d);
39 }
40
41 static int crypt_mod_smime_application_handler (BODY * m, STATE * s)
42 {
43   return smime_gpgme_application_handler (m, s);
44 }
45
46 static char *crypt_mod_smime_findkeys (address_t * to, address_t * cc,
47                                        address_t * bcc)
48 {
49   return smime_gpgme_findkeys (to, cc, bcc);
50 }
51
52 static BODY *crypt_mod_smime_sign_message (BODY * a)
53 {
54   return smime_gpgme_sign_message (a);
55 }
56
57 static int crypt_mod_smime_verify_one (BODY * sigbdy, STATE * s,
58                                        const char *tempf)
59 {
60   return smime_gpgme_verify_one (sigbdy, s, tempf);
61 }
62
63 static int crypt_mod_smime_send_menu (HEADER * msg, int *redraw)
64 {
65   return smime_gpgme_send_menu (msg, redraw);
66 }
67
68 static BODY *crypt_mod_smime_build_smime_entity (BODY * a, char *certlist)
69 {
70   return smime_gpgme_build_smime_entity (a, certlist);
71 }
72
73 static int crypt_mod_smime_verify_sender (HEADER * h)
74 {
75   return smime_gpgme_verify_sender (h);
76 }
77
78 struct crypt_module_specs crypt_mod_smime_gpgme = { APPLICATION_SMIME,
79   {
80    crypt_mod_smime_init,
81    crypt_mod_smime_void_passphrase,
82    crypt_mod_smime_valid_passphrase,
83    crypt_mod_smime_decrypt_mime,
84    crypt_mod_smime_application_handler,
85    NULL,                        /* encrypted_handler */
86    crypt_mod_smime_findkeys,
87    crypt_mod_smime_sign_message,
88    crypt_mod_smime_verify_one,
89    crypt_mod_smime_send_menu,
90
91    NULL,                        /* pgp_encrypt_message */
92    NULL,                        /* pgp_make_key_attachment */
93    NULL,                        /* pgp_check_traditional */
94    NULL,                        /* pgp_traditional_encryptsign */
95    NULL,                        /* pgp_invoke_getkeys */
96    NULL,                        /* pgp_invoke_import */
97    NULL,                        /* pgp_extract_keys_from_attachment_list */
98
99    NULL,                        /* smime_getkeys */
100    crypt_mod_smime_verify_sender,
101    crypt_mod_smime_build_smime_entity,
102    NULL,                        /* smime_invoke_import */
103    }
104 };