drop unused prototypes
[apps/madmutt.git] / crypt.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 2003 Werner Koch <wk@gnupg.org>
4  * Copyright (C) 2004 g10code GmbH
5  *
6  * This file is part of mutt-ng, see http://www.muttng.org/.
7  * It's licensed under the GNU General Public License,
8  * please see the file GPL in the top level source directory.
9  */
10
11 /*
12    Common definitions and prototypes for the crypt functions. They are
13    all defined in crypt.c and cryptglue.c
14 */
15
16 #ifndef MUTT_CRYPT_H
17 #define MUTT_CRYPT_H
18
19 #include <lib-mime/mime.h>
20 #include "state.h"
21
22 #define ENCRYPT    (1 << 0)
23 #define SIGN       (1 << 1)
24 #define GOODSIGN   (1 << 2)
25 #define BADSIGN    (1 << 3)
26 #define PARTSIGN   (1 << 4)
27 #define SIGNOPAQUE (1 << 5)
28 #define KEYBLOCK   (1 << 6)     /* KEY too generic? */
29 #define INLINE     (1 << 7)
30
31 #define APPLICATION_PGP    (1 << 8)
32 #define APPLICATION_SMIME  (1 << 9)
33
34 #define PGP_TRADITIONAL_CHECKED (1 << 10)
35
36 #define PGPENCRYPT  (APPLICATION_PGP | ENCRYPT)
37 #define PGPSIGN     (APPLICATION_PGP | SIGN)
38 #define PGPKEY      (APPLICATION_PGP | KEYBLOCK)
39 #define PGPINLINE   (APPLICATION_PGP | INLINE)
40
41 #define SMIMEENCRYPT  (APPLICATION_SMIME | ENCRYPT)
42 #define SMIMESIGN     (APPLICATION_SMIME | SIGN)
43 #define SMIMEOPAQUE   (APPLICATION_SMIME | SIGNOPAQUE)
44
45 #define KEYFLAG_CANSIGN                 (1 <<  0)
46 #define KEYFLAG_CANENCRYPT              (1 <<  1)
47 #define KEYFLAG_ISX509                  (1 <<  2)
48 #define KEYFLAG_SECRET                  (1 <<  7)
49 #define KEYFLAG_EXPIRED                 (1 <<  8)
50 #define KEYFLAG_REVOKED                 (1 <<  9)
51 #define KEYFLAG_DISABLED                (1 << 10)
52 #define KEYFLAG_SUBKEY                  (1 << 11)
53 #define KEYFLAG_CRITICAL                (1 << 12)
54 #define KEYFLAG_PREFER_ENCRYPTION       (1 << 13)
55 #define KEYFLAG_PREFER_SIGNING          (1 << 14)
56
57 #define KEYFLAG_CANTUSE (KEYFLAG_DISABLED|KEYFLAG_REVOKED|KEYFLAG_EXPIRED)
58 #define KEYFLAG_RESTRICTIONS (KEYFLAG_CANTUSE|KEYFLAG_CRITICAL)
59
60 #define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN|KEYFLAG_CANENCRYPT|KEYFLAG_PREFER_ENCRYPTION|KEYFLAG_PREFER_SIGNING)
61
62 /*-- new API --*/
63
64 void crypt_invoke_import(FILE *stream, int smime);
65 int crypt_send_menu(HEADER *msg, int *redraw, int smime);
66 int crypt_verify_one(BODY *, STATE *s, FILE *fp, int smime);
67
68
69 /*-- crypt.c --*/
70
71 int mutt_protect (HEADER *, char *);
72 int mutt_signed_handler (BODY *, STATE *);
73 int mutt_parse_crypt_hdr (char *, int);
74 void convert_to_7bit (BODY *);
75
76 /* Check out the type of encryption used and set the cached status
77    values if there are any. */
78 int crypt_query (BODY * m);
79
80 /* Fixme: To be documented. */
81 void crypt_extract_keys_from_messages (HEADER * h);
82
83 /* Do a quick check to make sure that we can find all of the
84    encryption keys if the user has requested this service. 
85    Return the list of keys in KEYLIST. */
86 int crypt_get_keys (HEADER * msg, char **keylist);
87
88
89 /* Show a message that a backend will be invoked. */
90 void crypt_invoke_message (int type);
91
92 /* Decrypt a PGP/MIME message. */
93 int crypt_pgp_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d);
94
95 /* MIME handler for the application/pgp content-type. */
96 int crypt_pgp_application_pgp_handler (BODY * m, STATE * s);
97
98 /* MIME handler for an PGP/MIME encrypted message. */
99 int crypt_pgp_encrypted_handler (BODY * a, STATE * s);
100
101 /* fixme: needs documentation. */
102 void crypt_pgp_invoke_getkeys (address_t * addr);
103
104 /* Check for a traditional PGP message in body B. */
105 int crypt_pgp_check_traditional (FILE * fp, BODY * b, int tagged_only);
106
107 /* Generate a PGP public key attachment. */
108 BODY *crypt_pgp_make_key_attachment (char *tempf);
109
110 /* Create a new body with a PGP signed message from A. */
111 BODY *crypt_pgp_sign_message (BODY * a);
112
113 /* Warning: A is no longer freed in this routine, you need to free it
114    later.  This is necessary for $fcc_attach. */
115 BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign);
116
117 /* fixme: needs documentation */
118 void crypt_pgp_extract_keys_from_attachment_list (FILE * fp, int tag,
119                                                   BODY * top);
120
121
122 /* Decrypt an S/MIME message. */
123 int crypt_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d);
124
125 /* MIME handler for the application/smime content-type. */
126 int crypt_smime_application_smime_handler (BODY * m, STATE * s);
127
128 /* fixme: Needs documentation. */
129 void crypt_smime_getkeys (ENVELOPE * env);
130
131 /* Check that the sender matches. */
132 int crypt_smime_verify_sender (HEADER * h);
133
134 /* fixme: Needs documentation. */
135 BODY *crypt_smime_sign_message (BODY * a);
136
137 /* fixme: needs documentation. */
138 BODY *crypt_smime_build_smime_entity (BODY * a, char *certlist);
139
140 #endif /*MUTT_CRYPT_H */