Andreas Krennmair:
[apps/madmutt.git] / pgp.h
1 /*
2  * Copyright (C) 1996,1997 Michael R. Elkins <me@mutt.org>
3  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
4  * Copyright (C) 2004 g10 Code GmbH
5  *
6  *     This program is free software; you can redistribute it and/or modify
7  *     it under the terms of the GNU General Public License as published by
8  *     the Free Software Foundation; either version 2 of the License, or
9  *     (at your option) any later version.
10  * 
11  *     This program is distributed in the hope that it will be useful,
12  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *     GNU General Public License for more details.
15  * 
16  *     You should have received a copy of the GNU General Public License
17  *     along with this program; if not, write to the Free Software
18  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
19  */
20
21 #ifdef CRYPT_BACKEND_CLASSIC_PGP
22
23 #include "mutt_crypt.h"
24 #include "pgplib.h"
25
26
27 /* prototypes */
28
29 int pgp_use_gpg_agent(void);
30
31 int pgp_check_traditional (FILE *, BODY *, int);
32 BODY *pgp_decrypt_part (BODY *, STATE *, FILE *, BODY *);
33 BODY *pgp_make_key_attachment (char *);
34 const char *pgp_micalg (const char *fname);
35
36 char *_pgp_keyid (pgp_key_t);
37 char *pgp_keyid (pgp_key_t);
38
39
40 int mutt_check_pgp (HEADER * h);
41
42 int pgp_decrypt_mime (FILE *, FILE **, BODY *, BODY **);
43
44 /* int pgp_string_matches_hint (const char *s, LIST * hints); */
45
46 /* pgp_key_t gpg_get_candidates (struct pgp_vinfo *, pgp_ring_t, LIST *); */
47 pgp_key_t pgp_ask_for_key (char *, char *, short, pgp_ring_t);
48 pgp_key_t pgp_get_candidates (pgp_ring_t, LIST *);
49 pgp_key_t pgp_getkeybyaddr (ADDRESS *, short, pgp_ring_t);
50 pgp_key_t pgp_getkeybystr (char *, short, pgp_ring_t);
51
52 char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
53
54 void pgp_forget_passphrase (void);
55 void pgp_application_pgp_handler (BODY *, STATE *);
56 void pgp_encrypted_handler (BODY *, STATE *);
57 void pgp_extract_keys_from_attachment_list (FILE * fp, int tag, BODY * top);
58 void pgp_void_passphrase (void);
59 int pgp_valid_passphrase (void);
60
61
62 /* The PGP invocation interface - not really beautiful. */
63
64 pid_t pgp_invoke_decode (FILE **pgpin, FILE **pgpout, FILE **pgperr,
65                          int pgpinfd, int pgpoutfd, int pgperrfd, 
66                          const char *fname, short need_passphrase);
67 pid_t pgp_invoke_verify (FILE **pgpin, FILE **pgpout, FILE **pgperr,
68                          int pgpinfd, int pgpoutfd, int pgperrfd, 
69                          const char *fname, const char *sig_fname);
70 pid_t pgp_invoke_decrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr,
71                           int pgpinfd, int pgpoutfd, int pgperrfd, 
72                           const char *fname);
73 pid_t pgp_invoke_sign (FILE **pgpin, FILE **pgpout, FILE **pgperr,
74                        int pgpinfd, int pgpoutfd, int pgperrfd, 
75                        const char *fname);
76 pid_t pgp_invoke_encrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr,
77                           int pgpinfd, int pgpoutfd, int pgperrfd,
78                           const char *fname, const char *uids, int sign);
79 pid_t pgp_invoke_export (FILE **pgpin, FILE **pgpout, FILE **pgperr,
80                          int pgpinfd, int pgpoutfd, int pgperrfd, 
81                          const char *uids);
82 pid_t pgp_invoke_verify_key (FILE **pgpin, FILE **pgpout, FILE **pgperr,
83                              int pgpinfd, int pgpoutfd, int pgperrfd, 
84                              const char *uids);
85 pid_t pgp_invoke_list_keys (FILE **pgpin, FILE **pgpout, FILE **pgperr,
86                             int pgpinfd, int pgpoutfd, int pgperrfd, 
87                             pgp_ring_t keyring, LIST *hints);
88 pid_t pgp_invoke_traditional (FILE **pgpin, FILE **pgpout, FILE **pgperr,
89                           int pgpinfd, int pgpoutfd, int pgperrfd,
90                           const char *fname, const char *uids, int flags);
91
92
93 void pgp_invoke_import (const char *fname);
94 void pgp_invoke_getkeys (ADDRESS *);
95
96
97 /* private ? */
98 int pgp_verify_one (BODY *, STATE *, const char *);
99 BODY *pgp_traditional_encryptsign (BODY *, int, char *);
100 BODY *pgp_encrypt_message (BODY *, char *, int);
101 BODY *pgp_sign_message (BODY *);
102
103 int pgp_send_menu (HEADER *msg, int *redraw);
104
105 #endif /* CRYPT_BACKEND_CLASSIC_PGP */