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