63#ifndef MUTT_NCRYPT_LIB_H
64#define MUTT_NCRYPT_LIB_H
84#define SEC_ENCRYPT (1 << 0)
85#define SEC_SIGN (1 << 1)
86#define SEC_GOODSIGN (1 << 2)
87#define SEC_BADSIGN (1 << 3)
88#define SEC_PARTSIGN (1 << 4)
89#define SEC_SIGNOPAQUE (1 << 5)
90#define SEC_KEYBLOCK (1 << 6)
91#define SEC_INLINE (1 << 7)
92#define SEC_OPPENCRYPT (1 << 8)
93#define SEC_AUTOCRYPT (1 << 9)
94#define SEC_AUTOCRYPT_OVERRIDE (1 << 10)
96#define APPLICATION_PGP (1 << 11)
97#define APPLICATION_SMIME (1 << 12)
98#define PGP_TRADITIONAL_CHECKED (1 << 13)
100#define SEC_ALL_FLAGS ((1 << 14) - 1)
102#define PGP_ENCRYPT (APPLICATION_PGP | SEC_ENCRYPT)
103#define PGP_SIGN (APPLICATION_PGP | SEC_SIGN)
104#define PGP_GOODSIGN (APPLICATION_PGP | SEC_GOODSIGN)
105#define PGP_KEY (APPLICATION_PGP | SEC_KEYBLOCK)
106#define PGP_INLINE (APPLICATION_PGP | SEC_INLINE)
108#define SMIME_ENCRYPT (APPLICATION_SMIME | SEC_ENCRYPT)
109#define SMIME_SIGN (APPLICATION_SMIME | SEC_SIGN)
110#define SMIME_GOODSIGN (APPLICATION_SMIME | SEC_GOODSIGN)
111#define SMIME_BADSIGN (APPLICATION_SMIME | SEC_BADSIGN)
112#define SMIME_OPAQUE (APPLICATION_SMIME | SEC_SIGNOPAQUE)
120#if (defined(CRYPT_BACKEND_CLASSIC_PGP) && defined(CRYPT_BACKEND_CLASSIC_SMIME)) || \
121 defined(CRYPT_BACKEND_GPGME)
122#define WithCrypto (APPLICATION_PGP | APPLICATION_SMIME)
123#elif defined(CRYPT_BACKEND_CLASSIC_PGP)
124#define WithCrypto APPLICATION_PGP
125#elif defined(CRYPT_BACKEND_CLASSIC_SMIME)
126#define WithCrypto APPLICATION_SMIME
132#define KEYFLAG_NO_FLAGS 0
133#define KEYFLAG_CANSIGN (1 << 0)
134#define KEYFLAG_CANENCRYPT (1 << 1)
135#define KEYFLAG_ISX509 (1 << 2)
136#define KEYFLAG_SECRET (1 << 7)
137#define KEYFLAG_EXPIRED (1 << 8)
138#define KEYFLAG_REVOKED (1 << 9)
139#define KEYFLAG_DISABLED (1 << 10)
140#define KEYFLAG_SUBKEY (1 << 11)
141#define KEYFLAG_CRITICAL (1 << 12)
142#define KEYFLAG_PREFER_ENCRYPTION (1 << 13)
143#define KEYFLAG_PREFER_SIGNING (1 << 14)
145#define KEYFLAG_CANTUSE (KEYFLAG_DISABLED | KEYFLAG_REVOKED | KEYFLAG_EXPIRED)
146#define KEYFLAG_RESTRICTIONS (KEYFLAG_CANTUSE | KEYFLAG_CRITICAL)
148#define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN | KEYFLAG_CANENCRYPT | KEYFLAG_PREFER_ENCRYPTION | KEYFLAG_PREFER_SIGNING)
190#ifdef CRYPT_BACKEND_GPGME
void pgp_gpgme_init(void)
Initialise the crypto module - Implements CryptModuleSpecs::init() -.
int crypt_pgp_application_handler(struct Body *b_email, struct State *state)
Wrapper for CryptModuleSpecs::application_handler() - Implements handler_t -.
int crypt_smime_application_handler(struct Body *b_email, struct State *state)
Wrapper for CryptModuleSpecs::application_handler() - Implements handler_t -.
int crypt_pgp_encrypted_handler(struct Body *b_email, struct State *state)
Wrapper for CryptModuleSpecs::encrypted_handler() - Implements handler_t -.
int mutt_protected_headers_handler(struct Body *b, struct State *state)
Handler for protected headers - Implements handler_t -.
int mutt_signed_handler(struct Body *b, struct State *state)
Handler for "multipart/signed" - Implements handler_t -.
bool crypt_has_module_backend(SecurityFlags type)
Is there a crypto backend for a given type?
void crypt_invoke_message(SecurityFlags type)
Display an informative message.
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Wrapper for CryptModuleSpecs::decrypt_mime()
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
int mutt_gpgme_select_secret_key(struct Buffer *keyid)
Select a private Autocrypt key for a new account.
const char * mutt_gpgme_print_version(void)
Get version of GPGME.
SecurityFlags mutt_is_multipart_signed(struct Body *b)
Is a message signed?
void crypt_cleanup(void)
Clean up backend.
void crypt_smime_getkeys(struct Envelope *env)
Wrapper for CryptModuleSpecs::smime_getkeys()
SecurityFlags mutt_is_application_smime(struct Body *b)
Does the message use S/MIME?
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
int mutt_is_valid_multipart_pgp_encrypted(struct Body *b)
Is this a valid multi-part encrypted message?
bool mutt_should_hide_protected_subject(struct Email *e)
Should NeoMutt hide the protected subject?
uint16_t KeyFlags
Flags describing PGP/SMIME keys, e.g. KEYFLAG_CANSIGN.
bool crypt_pgp_check_traditional(FILE *fp, struct Body *b, bool just_one)
Wrapper for CryptModuleSpecs::pgp_check_traditional()
void crypto_module_cleanup(void)
Clean up the crypto modules.
struct Body * crypt_pgp_make_key_attachment(void)
Wrapper for CryptModuleSpecs::pgp_make_key_attachment()
SecurityFlags crypt_smime_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu()
void crypt_extract_keys_from_messages(struct Mailbox *m, struct EmailArray *ea)
Extract keys from a message.
SecurityFlags crypt_pgp_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu()
void crypt_pgp_invoke_getkeys(struct Address *addr)
Wrapper for CryptModuleSpecs::pgp_invoke_getkeys()
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
int mutt_protect(struct Email *e, char *keylist, bool postpone)
Encrypt and/or sign a message.
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
void crypt_pgp_extract_key_from_attachment(FILE *fp, struct Body *b)
Wrapper for CryptModuleSpecs::pgp_extract_key_from_attachment()
int crypt_smime_verify_sender(struct Email *e, struct Message *msg)
Wrapper for CryptModuleSpecs::smime_verify_sender()
SecurityFlags mutt_is_malformed_multipart_pgp_encrypted(struct Body *b)
Check for malformed layout.
int crypt_smime_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Wrapper for CryptModuleSpecs::decrypt_mime()
void crypt_init(void)
Initialise the crypto backends.
int crypt_get_keys(struct Email *e, char **keylist, bool oppenc_mode)
Check we have all the keys we need.
SecurityFlags mutt_is_application_pgp(const struct Body *b)
Does the message use PGP?
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
String manipulation buffer.
The envelope/body of an email.
A local copy of an email.
Keep track when processing files.
StateFlags flags
Flags, e.g. STATE_DISPLAY.
FILE * fp_out
File to write to.
FILE * fp_in
File to read from.