Rocco Rutte:
[apps/madmutt.git] / crypt-mod-smime-classic.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 classic smime code.
12  */
13
14 #if HAVE_CONFIG_H
15 # include "config.h"
16 #endif
17
18 #include "crypt-mod.h"
19 #include "smime.h"
20
21 static void crypt_mod_smime_void_passphrase (void)
22 {
23   smime_void_passphrase ();
24 }
25
26 static int crypt_mod_smime_valid_passphrase (void)
27 {
28   return smime_valid_passphrase ();
29 }
30
31 static int crypt_mod_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c,
32                                          BODY ** d)
33 {
34   return smime_decrypt_mime (a, b, c, d);
35 }
36 static int crypt_mod_smime_application_handler (BODY * m, STATE * s)
37 {
38   return smime_application_smime_handler (m, s);
39 }
40
41 static char *crypt_mod_smime_findkeys (ADDRESS * to, ADDRESS * cc,
42                                        ADDRESS * bcc)
43 {
44   return smime_findKeys (to, cc, bcc);
45 }
46
47 static BODY *crypt_mod_smime_sign_message (BODY * a)
48 {
49   return smime_sign_message (a);
50 }
51
52 static int crypt_mod_smime_verify_one (BODY * sigbdy, STATE * s,
53                                        const char *tempf)
54 {
55   return smime_verify_one (sigbdy, s, tempf);
56 }
57
58 static int crypt_mod_smime_send_menu (HEADER * msg, int *redraw)
59 {
60   return smime_send_menu (msg, redraw);
61 }
62
63 static void crypt_mod_smime_getkeys (ENVELOPE * env)
64 {
65   smime_getkeys (env);
66 }
67
68 static int crypt_mod_smime_verify_sender (HEADER * h)
69 {
70   return smime_verify_sender (h);
71 }
72
73 static BODY *crypt_mod_smime_build_smime_entity (BODY * a, char *certlist)
74 {
75   return smime_build_smime_entity (a, certlist);
76 }
77
78 static void crypt_mod_smime_invoke_import (char *infile, char *mailbox)
79 {
80   smime_invoke_import (infile, mailbox);
81 }
82
83
84 struct crypt_module_specs crypt_mod_smime_classic = { APPLICATION_SMIME,
85   {
86    NULL,                        /* init */
87    crypt_mod_smime_void_passphrase,
88    crypt_mod_smime_valid_passphrase,
89    crypt_mod_smime_decrypt_mime,
90    crypt_mod_smime_application_handler,
91    NULL,                        /* encrypted_handler */
92    crypt_mod_smime_findkeys,
93    crypt_mod_smime_sign_message,
94    crypt_mod_smime_verify_one,
95    crypt_mod_smime_send_menu,
96
97    NULL,                        /* pgp_encrypt_message */
98    NULL,                        /* pgp_make_key_attachment */
99    NULL,                        /* pgp_check_traditional */
100    NULL,                        /* pgp_traditional_encryptsign */
101    NULL,                        /* pgp_invoke_getkeys */
102    NULL,                        /* pgp_invoke_import */
103    NULL,                        /* pgp_extract_keys_from_attachment_list */
104
105    crypt_mod_smime_getkeys,
106    crypt_mod_smime_verify_sender,
107    crypt_mod_smime_build_smime_entity,
108    crypt_mod_smime_invoke_import,
109    }
110 };