64#ifndef MUTT_NCRYPT_LIB_H
65#define MUTT_NCRYPT_LIB_H
106#define APPLICATION_PGP (1 << 11)
107#define APPLICATION_SMIME (1 << 12)
108#define PGP_TRADITIONAL_CHECKED (1 << 13)
110#define SEC_ALL_FLAGS ((1 << 14) - 1)
112#define PGP_ENCRYPT (APPLICATION_PGP | SEC_ENCRYPT)
113#define PGP_SIGN (APPLICATION_PGP | SEC_SIGN)
114#define PGP_GOODSIGN (APPLICATION_PGP | SEC_GOODSIGN)
115#define PGP_KEY (APPLICATION_PGP | SEC_KEYBLOCK)
116#define PGP_INLINE (APPLICATION_PGP | SEC_INLINE)
118#define SMIME_ENCRYPT (APPLICATION_SMIME | SEC_ENCRYPT)
119#define SMIME_SIGN (APPLICATION_SMIME | SEC_SIGN)
120#define SMIME_GOODSIGN (APPLICATION_SMIME | SEC_GOODSIGN)
121#define SMIME_BADSIGN (APPLICATION_SMIME | SEC_BADSIGN)
122#define SMIME_OPAQUE (APPLICATION_SMIME | SEC_SIGNOPAQUE)
130#if (defined(CRYPT_BACKEND_CLASSIC_PGP) && defined(CRYPT_BACKEND_CLASSIC_SMIME)) || \
131 defined(CRYPT_BACKEND_GPGME)
132#define WithCrypto (APPLICATION_PGP | APPLICATION_SMIME)
133#elif defined(CRYPT_BACKEND_CLASSIC_PGP)
134#define WithCrypto APPLICATION_PGP
135#elif defined(CRYPT_BACKEND_CLASSIC_SMIME)
136#define WithCrypto APPLICATION_SMIME
161#define KEYFLAG_CANTUSE (KEYFLAG_DISABLED | KEYFLAG_REVOKED | KEYFLAG_EXPIRED)
162#define KEYFLAG_RESTRICTIONS (KEYFLAG_CANTUSE | KEYFLAG_CRITICAL)
164#define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN | KEYFLAG_CANENCRYPT | KEYFLAG_PREFER_ENCRYPTION | KEYFLAG_PREFER_SIGNING)
208#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 -.
void pgp_init_keys(struct NeoMutt *n, struct SubMenu *sm_generic)
Initialise the PGP Keybindings - Implements ::init_keys_api.
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.
int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Wrapper for CryptModuleSpecs::decrypt_mime()
SecurityFlag
Flags describing an email's cryptographic state.
@ SEC_NONE
No flags are set.
@ SEC_OPPENCRYPT
Opportunistic encrypt mode.
@ SEC_BADSIGN
Email has a bad signature.
@ SEC_PARTSIGN
Not all parts of the email is signed.
@ SEC_SIGNOPAQUE
Email has an opaque signature (encrypted)
@ SEC_SIGN
Email is signed.
@ SEC_INLINE
Email has an inline signature.
@ SEC_KEYBLOCK
Email has a key attached.
@ SEC_ENCRYPT
Email is encrypted.
@ SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
@ SEC_GOODSIGN
Email has a valid signature.
@ SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
void crypto_module_cleanup(struct NcryptModuleData *mod_data)
Clean up the crypto modules.
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_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?
bool crypt_pgp_check_traditional(FILE *fp, struct Body *b, bool just_one)
Wrapper for CryptModuleSpecs::pgp_check_traditional()
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()
KeyFlag
Flags describing PGP/SMIME keys.
@ KEYFLAG_REVOKED
Key is revoked.
@ KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
@ KEYFLAG_NONE
No flags are set.
@ KEYFLAG_SECRET
Key is a secret key.
@ KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
@ KEYFLAG_CANSIGN
Key is suitable for signing.
@ KEYFLAG_ISX509
Key is an X.509 key.
@ KEYFLAG_EXPIRED
Key is expired.
@ KEYFLAG_CANENCRYPT
Key is suitable for encryption.
@ KEYFLAG_SUBKEY
Key is a subkey.
@ KEYFLAG_DISABLED
Key is marked disabled.
@ KEYFLAG_CRITICAL
Key is marked critical.
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.
void crypt_cleanup(struct NcryptModuleData *mod_data)
Clean up backend.
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.
Ncrypt private Module data.
Container for Accounts, Notifications.
Keep track when processing files.