669fc4e1ab0a09ad7eeb8789d997ee01116433be
[apps/madmutt.git] / lib-crypt / pgp.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1996,1997 Michael R. Elkins <me@mutt.org>
4  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
5  * Copyright (C) 2004 g10 Code GmbH
6  *
7  * This file is part of mutt-ng, see http://www.muttng.org/.
8  * It's licensed under the GNU General Public License,
9  * please see the file GPL in the top level source directory.
10  */
11
12 #include "crypt.h"
13
14 /* prototypes */
15
16 int pgp_use_gpg_agent (void);
17
18 int pgp_check_traditional (FILE *, BODY *, int);
19 BODY *pgp_decrypt_part (BODY *, STATE *, FILE *, BODY *);
20 BODY *pgp_make_key_attachment (char *);
21 const char *pgp_micalg (const char *fname);
22
23 char *_pgp_keyid (pgp_key_t);
24 char *pgp_keyid (pgp_key_t);
25
26
27 int mutt_check_pgp (HEADER * h);
28
29 int pgp_decrypt_mime (FILE *, FILE **, BODY *, BODY **);
30
31 /* int pgp_string_matches_hint (const char *s, string_list_t * hints); */
32
33 /* pgp_key_t gpg_get_candidates (struct pgp_vinfo *, pgp_ring_t, string_list_t *); */
34 pgp_key_t pgp_ask_for_key (char *, char *, short, pgp_ring_t);
35 pgp_key_t pgp_get_candidates (pgp_ring_t, string_list_t *);
36 pgp_key_t pgp_getkeybyaddr (address_t *, short, pgp_ring_t);
37 pgp_key_t pgp_getkeybystr (const char *, short, pgp_ring_t);
38
39 char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc);
40
41 void pgp_forget_passphrase (void);
42 int pgp_application_pgp_handler (BODY *, STATE *);
43 int pgp_encrypted_handler (BODY *, STATE *);
44 void pgp_extract_keys_from_attachment_list (FILE * fp, int tag, BODY * top);
45 void pgp_void_passphrase (void);
46 int pgp_valid_passphrase (void);
47
48
49 /* The PGP invocation interface - not really beautiful. */
50
51 pid_t pgp_invoke_decode (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
52                          int pgpinfd, int pgpoutfd, int pgperrfd,
53                          const char *fname, short need_passphrase);
54 pid_t pgp_invoke_verify (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
55                          int pgpinfd, int pgpoutfd, int pgperrfd,
56                          const char *fname, const char *sig_fname);
57 pid_t pgp_invoke_decrypt (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
58                           int pgpinfd, int pgpoutfd, int pgperrfd,
59                           const char *fname);
60 pid_t pgp_invoke_sign (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
61                        int pgpinfd, int pgpoutfd, int pgperrfd,
62                        const char *fname);
63 pid_t pgp_invoke_encrypt (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
64                           int pgpinfd, int pgpoutfd, int pgperrfd,
65                           const char *fname, const char *uids, int sign);
66 pid_t pgp_invoke_export (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
67                          int pgpinfd, int pgpoutfd, int pgperrfd,
68                          const char *uids);
69 pid_t pgp_invoke_verify_key (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
70                              int pgpinfd, int pgpoutfd, int pgperrfd,
71                              const char *uids);
72 pid_t pgp_invoke_list_keys (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
73                             int pgpinfd, int pgpoutfd, int pgperrfd,
74                             pgp_ring_t keyring, string_list_t * hints);
75 pid_t pgp_invoke_traditional (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
76                               int pgpinfd, int pgpoutfd, int pgperrfd,
77                               const char *fname, const char *uids, int flags);
78
79
80 void pgp_invoke_import (const char *fname);
81 void pgp_invoke_getkeys (address_t *);
82
83
84 /* private ? */
85 int pgp_verify_one (BODY *, STATE *, const char *);
86 BODY *pgp_traditional_encryptsign (BODY *, int, char *);
87 BODY *pgp_encrypt_message (BODY *, char *, int);
88 BODY *pgp_sign_message (BODY *);
89
90 int pgp_send_menu (HEADER * msg, int *redraw);