2 * Copyright notice from original mutt:
3 * Copyright (C) 2003 Werner Koch <wk@gnupg.org>
4 * Copyright (C) 2004 g10code GmbH
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.
12 Common definitions and prototypes for the crypt functions. They are
13 all defined in crypt.c and cryptglue.c
19 #include <lib-mime/mime.h>
23 #define ENCRYPT (1 << 0)
25 #define GOODSIGN (1 << 2)
26 #define BADSIGN (1 << 3)
27 #define PARTSIGN (1 << 4)
28 #define SIGNOPAQUE (1 << 5)
29 #define KEYBLOCK (1 << 6) /* KEY too generic? */
30 #define INLINE (1 << 7)
32 #define APPLICATION_PGP (1 << 8)
33 #define APPLICATION_SMIME (1 << 9)
35 #define PGP_TRADITIONAL_CHECKED (1 << 10)
37 #define PGPENCRYPT (APPLICATION_PGP | ENCRYPT)
38 #define PGPSIGN (APPLICATION_PGP | SIGN)
39 #define PGPKEY (APPLICATION_PGP | KEYBLOCK)
40 #define PGPINLINE (APPLICATION_PGP | INLINE)
42 #define SMIMEENCRYPT (APPLICATION_SMIME | ENCRYPT)
43 #define SMIMESIGN (APPLICATION_SMIME | SIGN)
44 #define SMIMEOPAQUE (APPLICATION_SMIME | SIGNOPAQUE)
46 #define KEYFLAG_CANSIGN (1 << 0)
47 #define KEYFLAG_CANENCRYPT (1 << 1)
48 #define KEYFLAG_ISX509 (1 << 2)
49 #define KEYFLAG_SECRET (1 << 7)
50 #define KEYFLAG_EXPIRED (1 << 8)
51 #define KEYFLAG_REVOKED (1 << 9)
52 #define KEYFLAG_DISABLED (1 << 10)
53 #define KEYFLAG_SUBKEY (1 << 11)
54 #define KEYFLAG_CRITICAL (1 << 12)
55 #define KEYFLAG_PREFER_ENCRYPTION (1 << 13)
56 #define KEYFLAG_PREFER_SIGNING (1 << 14)
58 #define KEYFLAG_CANTUSE (KEYFLAG_DISABLED|KEYFLAG_REVOKED|KEYFLAG_EXPIRED)
59 #define KEYFLAG_RESTRICTIONS (KEYFLAG_CANTUSE|KEYFLAG_CRITICAL)
61 #define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN|KEYFLAG_CANENCRYPT|KEYFLAG_PREFER_ENCRYPTION|KEYFLAG_PREFER_SIGNING)
63 int crypt_send_menu(HEADER *msg, int *redraw, int smime);
64 int mutt_protect (HEADER *, char *);
65 int mutt_signed_handler (BODY *, STATE *);
66 int mutt_parse_crypt_hdr (char *, int);
68 /* Check out the type of encryption used and set the cached status
69 values if there are any. */
70 int crypt_query (BODY * m);
72 /* Fixme: To be documented. */
73 void crypt_extract_keys_from_messages (HEADER * h);
75 /* Do a quick check to make sure that we can find all of the
76 encryption keys if the user has requested this service.
77 Return the list of keys in KEYLIST. */
78 int crypt_get_keys (HEADER * msg, char **keylist);
81 /* Show a message that a backend will be invoked. */
82 void crypt_invoke_message (int type);
84 /* Decrypt a PGP/MIME message. */
85 int crypt_pgp_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d);
87 /* MIME handler for the application/pgp content-type. */
88 int crypt_pgp_application_pgp_handler (BODY * m, STATE * s);
90 /* MIME handler for an PGP/MIME encrypted message. */
91 int crypt_pgp_encrypted_handler (BODY * a, STATE * s);
93 /* Check for a traditional PGP message in body B. */
94 int crypt_pgp_check_traditional (FILE * fp, BODY * b, int tagged_only);
96 /* Generate a PGP public key attachment. */
97 BODY *crypt_pgp_make_key_attachment (char *tempf);
99 /* fixme: needs documentation */
100 void crypt_pgp_extract_keys_from_attachment_list (FILE * fp, int tag,
104 /* Decrypt an S/MIME message. */
105 int crypt_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d);
107 /* MIME handler for the application/smime content-type. */
108 int crypt_smime_application_smime_handler (BODY * m, STATE * s);
110 /* Check that the sender matches. */
111 int crypt_smime_verify_sender (HEADER * h);
113 #endif /*MUTT_CRYPT_H */