- remove trailing WS for empty header lines for $edit_headers (needed for f=f and...
[apps/madmutt.git] / crypt-mod-pgp-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 pgp code.
12  */
13
14 #if HAVE_CONFIG_H
15 # include "config.h"
16 #endif
17
18 #include "crypt-mod.h"
19 #include "pgp.h"
20
21 static void crypt_mod_pgp_void_passphrase (void)
22 {
23   pgp_void_passphrase ();
24 }
25
26 static int crypt_mod_pgp_valid_passphrase (void)
27 {
28   return pgp_valid_passphrase ();
29 }
30
31 static int crypt_mod_pgp_decrypt_mime (FILE * a, FILE ** b, BODY * c,
32                                        BODY ** d)
33 {
34   return pgp_decrypt_mime (a, b, c, d);
35 }
36 static int crypt_mod_pgp_application_handler (BODY * m, STATE * s)
37 {
38   return pgp_application_pgp_handler (m, s);
39 }
40
41 static char *crypt_mod_pgp_findkeys (ADDRESS * to, ADDRESS * cc,
42                                      ADDRESS * bcc)
43 {
44   return pgp_findKeys (to, cc, bcc);
45 }
46
47 static BODY *crypt_mod_pgp_sign_message (BODY * a)
48 {
49   return pgp_sign_message (a);
50 }
51
52 static int crypt_mod_pgp_verify_one (BODY * sigbdy, STATE * s,
53                                      const char *tempf)
54 {
55   return pgp_verify_one (sigbdy, s, tempf);
56 }
57
58 static int crypt_mod_pgp_send_menu (HEADER * msg, int *redraw)
59 {
60   return pgp_send_menu (msg, redraw);
61 }
62
63 static BODY *crypt_mod_pgp_encrypt_message (BODY * a, char *keylist, int sign)
64 {
65   return pgp_encrypt_message (a, keylist, sign);
66 }
67
68 static BODY *crypt_mod_pgp_make_key_attachment (char *tempf)
69 {
70   return pgp_make_key_attachment (tempf);
71 }
72
73 static int crypt_mod_pgp_check_traditional (FILE * fp, BODY * b,
74                                             int tagged_only)
75 {
76   return pgp_check_traditional (fp, b, tagged_only);
77 }
78
79 static BODY *crypt_mod_pgp_traditional_encryptsign (BODY * a, int flags,
80                                                     char *keylist)
81 {
82   return pgp_traditional_encryptsign (a, flags, keylist);
83 }
84
85 static int crypt_mod_pgp_encrypted_handler (BODY * m, STATE * s)
86 {
87   return pgp_encrypted_handler (m, s);
88 }
89
90 static void crypt_mod_pgp_invoke_getkeys (ADDRESS * addr)
91 {
92   pgp_invoke_getkeys (addr);
93 }
94
95 static void crypt_mod_pgp_invoke_import (const char *fname)
96 {
97   pgp_invoke_import (fname);
98 }
99
100 static void crypt_mod_pgp_extract_keys_from_attachment_list (FILE * fp,
101                                                              int tag,
102                                                              BODY * top)
103 {
104   pgp_extract_keys_from_attachment_list (fp, tag, top);
105 }
106
107 struct crypt_module_specs crypt_mod_pgp_classic = { APPLICATION_PGP,
108   {
109    NULL,                        /* init */
110    crypt_mod_pgp_void_passphrase,
111    crypt_mod_pgp_valid_passphrase,
112    crypt_mod_pgp_decrypt_mime,
113    crypt_mod_pgp_application_handler,
114    crypt_mod_pgp_encrypted_handler,
115    crypt_mod_pgp_findkeys,
116    crypt_mod_pgp_sign_message,
117    crypt_mod_pgp_verify_one,
118    crypt_mod_pgp_send_menu,
119
120    crypt_mod_pgp_encrypt_message,
121    crypt_mod_pgp_make_key_attachment,
122    crypt_mod_pgp_check_traditional,
123    crypt_mod_pgp_traditional_encryptsign,
124    crypt_mod_pgp_invoke_getkeys,
125    crypt_mod_pgp_invoke_import,
126    crypt_mod_pgp_extract_keys_from_attachment_list,
127
128    NULL,                        /* smime_getkeys */
129    NULL,                        /* smime_verify_sender */
130    NULL,                        /* smime_build_smime_entity */
131    NULL,                        /* smime_invoke_import */
132    }
133 };