#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
|
void | crypt_extract_keys_from_messages (struct Mailbox *m, struct EmailList *el) |
| Extract keys from a message. More...
|
|
void | crypt_forget_passphrase (void) |
| Forget a passphrase and display a message. More...
|
|
int | crypt_get_keys (struct Email *e, char **keylist, bool oppenc_mode) |
| Check we have all the keys we need. More...
|
|
void | crypt_opportunistic_encrypt (struct Email *e) |
| Can all recipients be determined. More...
|
|
SecurityFlags | crypt_query (struct Body *m) |
| Check out the type of encryption used. More...
|
|
bool | crypt_valid_passphrase (SecurityFlags flags) |
| Check that we have a usable passphrase, ask if not. More...
|
|
SecurityFlags | mutt_is_application_pgp (struct Body *m) |
| Does the message use PGP? More...
|
|
SecurityFlags | mutt_is_application_smime (struct Body *m) |
| Does the message use S/MIME? More...
|
|
SecurityFlags | mutt_is_malformed_multipart_pgp_encrypted (struct Body *b) |
| Check for malformed layout. More...
|
|
SecurityFlags | mutt_is_multipart_encrypted (struct Body *b) |
| Does the message have encrypted parts? More...
|
|
SecurityFlags | mutt_is_multipart_signed (struct Body *b) |
| Is a message signed? More...
|
|
int | mutt_is_valid_multipart_pgp_encrypted (struct Body *b) |
| Is this a valid multi-part encrypted message? More...
|
|
int | mutt_protect (struct Email *e, char *keylist, bool postpone) |
| Encrypt and/or sign a message. More...
|
|
int | mutt_protected_headers_handler (struct Body *m, struct State *s) |
| Process a protected header - Implements handler_t. More...
|
|
bool | mutt_should_hide_protected_subject (struct Email *e) |
| Should NeoMutt hide the protected subject? More...
|
|
int | mutt_signed_handler (struct Body *a, struct State *s) |
| Verify a "multipart/signed" body - Implements handler_t. More...
|
|
void | crypt_cleanup (void) |
| Clean up backend. More...
|
|
bool | crypt_has_module_backend (SecurityFlags type) |
| Is there a crypto backend for a given type? More...
|
|
void | crypt_init (void) |
| Initialise the crypto backends. More...
|
|
void | crypt_invoke_message (SecurityFlags type) |
| Display an informative message. More...
|
|
int | crypt_pgp_application_handler (struct Body *m, struct State *s) |
| Wrapper for CryptModuleSpecs::application_handler() More...
|
|
int | crypt_pgp_check_traditional (FILE *fp, struct Body *b, bool just_one) |
| Wrapper for CryptModuleSpecs::pgp_check_traditional() More...
|
|
int | crypt_pgp_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur) |
| Wrapper for CryptModuleSpecs::decrypt_mime() More...
|
|
int | crypt_pgp_encrypted_handler (struct Body *a, struct State *s) |
| Wrapper for CryptModuleSpecs::encrypted_handler() More...
|
|
void | crypt_pgp_extract_key_from_attachment (FILE *fp, struct Body *top) |
| Wrapper for CryptModuleSpecs::pgp_extract_key_from_attachment() More...
|
|
void | crypt_pgp_invoke_getkeys (struct Address *addr) |
| Wrapper for CryptModuleSpecs::pgp_invoke_getkeys() More...
|
|
struct Body * | crypt_pgp_make_key_attachment (void) |
| Wrapper for CryptModuleSpecs::pgp_make_key_attachment() More...
|
|
SecurityFlags | crypt_pgp_send_menu (struct Email *e) |
| Wrapper for CryptModuleSpecs::send_menu() More...
|
|
int | crypt_smime_application_handler (struct Body *m, struct State *s) |
| Wrapper for CryptModuleSpecs::application_handler() More...
|
|
int | crypt_smime_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur) |
| Wrapper for CryptModuleSpecs::decrypt_mime() More...
|
|
void | crypt_smime_getkeys (struct Envelope *env) |
| Wrapper for CryptModuleSpecs::smime_getkeys() More...
|
|
SecurityFlags | crypt_smime_send_menu (struct Email *e) |
| Wrapper for CryptModuleSpecs::send_menu() More...
|
|
int | crypt_smime_verify_sender (struct Mailbox *m, struct Email *e) |
| Wrapper for CryptModuleSpecs::smime_verify_sender() More...
|
|
void | crypto_module_free (void) |
| Clean up the crypto modules. More...
|
|
void | pgp_gpgme_init (void) |
| Implements CryptModuleSpecs::init() More...
|
|
int | mutt_gpgme_select_secret_key (struct Buffer *keyid) |
| Select a private Autocrypt key for a new account. More...
|
|
const char * | mutt_gpgme_print_version (void) |
| Get version of GPGME. More...
|
|
API for encryption/signing of emails
- Authors
- Werner Koch
- g10code GmbH
- Pietro Cerutti
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file lib.h.
◆ SEC_NO_FLAGS
No flags are set.
Definition at line 84 of file lib.h.
◆ SEC_ENCRYPT
#define SEC_ENCRYPT (1 << 0) |
◆ SEC_SIGN
#define SEC_SIGN (1 << 1) |
◆ SEC_GOODSIGN
#define SEC_GOODSIGN (1 << 2) |
Email has a valid signature.
Definition at line 87 of file lib.h.
◆ SEC_BADSIGN
#define SEC_BADSIGN (1 << 3) |
Email has a bad signature.
Definition at line 88 of file lib.h.
◆ SEC_PARTSIGN
#define SEC_PARTSIGN (1 << 4) |
Not all parts of the email is signed.
Definition at line 89 of file lib.h.
◆ SEC_SIGNOPAQUE
#define SEC_SIGNOPAQUE (1 << 5) |
Email has an opaque signature (encrypted)
Definition at line 90 of file lib.h.
◆ SEC_KEYBLOCK
#define SEC_KEYBLOCK (1 << 6) |
Email has a key attached.
Definition at line 91 of file lib.h.
◆ SEC_INLINE
#define SEC_INLINE (1 << 7) |
Email has an inline signature.
Definition at line 92 of file lib.h.
◆ SEC_OPPENCRYPT
#define SEC_OPPENCRYPT (1 << 8) |
Opportunistic encrypt mode.
Definition at line 93 of file lib.h.
◆ SEC_AUTOCRYPT
#define SEC_AUTOCRYPT (1 << 9) |
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition at line 94 of file lib.h.
◆ SEC_AUTOCRYPT_OVERRIDE
#define SEC_AUTOCRYPT_OVERRIDE (1 << 10) |
(Autocrypt) Indicates manual set/unset of encryption
Definition at line 95 of file lib.h.
◆ APPLICATION_PGP
#define APPLICATION_PGP (1 << 11) |
Use PGP to encrypt/sign.
Definition at line 97 of file lib.h.
◆ APPLICATION_SMIME
#define APPLICATION_SMIME (1 << 12) |
Use SMIME to encrypt/sign.
Definition at line 98 of file lib.h.
◆ PGP_TRADITIONAL_CHECKED
#define PGP_TRADITIONAL_CHECKED (1 << 13) |
Email has a traditional (inline) signature.
Definition at line 99 of file lib.h.
◆ SEC_ALL_FLAGS
#define SEC_ALL_FLAGS ((1 << 14) - 1) |
◆ PGP_ENCRYPT
◆ PGP_SIGN
◆ PGP_GOODSIGN
◆ PGP_KEY
◆ PGP_INLINE
◆ SMIME_ENCRYPT
◆ SMIME_SIGN
◆ SMIME_GOODSIGN
◆ SMIME_BADSIGN
◆ SMIME_OPAQUE
◆ WithCrypto
◆ KEYFLAG_NO_FLAGS
#define KEYFLAG_NO_FLAGS 0 |
No flags are set.
Definition at line 133 of file lib.h.
◆ KEYFLAG_CANSIGN
#define KEYFLAG_CANSIGN (1 << 0) |
Key is suitable for signing.
Definition at line 134 of file lib.h.
◆ KEYFLAG_CANENCRYPT
#define KEYFLAG_CANENCRYPT (1 << 1) |
Key is suitable for encryption.
Definition at line 135 of file lib.h.
◆ KEYFLAG_ISX509
#define KEYFLAG_ISX509 (1 << 2) |
Key is an X.509 key.
Definition at line 136 of file lib.h.
◆ KEYFLAG_SECRET
#define KEYFLAG_SECRET (1 << 7) |
Key is a secret key.
Definition at line 137 of file lib.h.
◆ KEYFLAG_EXPIRED
#define KEYFLAG_EXPIRED (1 << 8) |
Key is expired.
Definition at line 138 of file lib.h.
◆ KEYFLAG_REVOKED
#define KEYFLAG_REVOKED (1 << 9) |
Key is revoked.
Definition at line 139 of file lib.h.
◆ KEYFLAG_DISABLED
#define KEYFLAG_DISABLED (1 << 10) |
Key is marked disabled.
Definition at line 140 of file lib.h.
◆ KEYFLAG_SUBKEY
#define KEYFLAG_SUBKEY (1 << 11) |
Key is a subkey.
Definition at line 141 of file lib.h.
◆ KEYFLAG_CRITICAL
#define KEYFLAG_CRITICAL (1 << 12) |
Key is marked critical.
Definition at line 142 of file lib.h.
◆ KEYFLAG_PREFER_ENCRYPTION
#define KEYFLAG_PREFER_ENCRYPTION (1 << 13) |
Key's owner prefers encryption.
Definition at line 143 of file lib.h.
◆ KEYFLAG_PREFER_SIGNING
#define KEYFLAG_PREFER_SIGNING (1 << 14) |
Key's owner prefers signing.
Definition at line 144 of file lib.h.
◆ KEYFLAG_CANTUSE
◆ KEYFLAG_RESTRICTIONS
◆ KEYFLAG_ABILITIES
◆ SecurityFlags
◆ KeyFlags
◆ crypt_extract_keys_from_messages()
void crypt_extract_keys_from_messages |
( |
struct Mailbox * |
m, |
|
|
struct EmailList * |
el |
|
) |
| |
Extract keys from a message.
- Parameters
-
m | Mailbox |
el | List of Emails to process |
The extracted keys will be added to the user's keyring.
Definition at line 846 of file crypt.c.
881 puts(
_(
"Trying to extract PGP keys...\n"));
910 puts(
_(
"Trying to extract S/MIME certificates..."));
◆ crypt_forget_passphrase()
void crypt_forget_passphrase |
( |
void |
| ) |
|
Forget a passphrase and display a message.
Definition at line 93 of file crypt.c.
◆ crypt_get_keys()
int crypt_get_keys |
( |
struct Email * |
e, |
|
|
char ** |
keylist, |
|
|
bool |
oppenc_mode |
|
) |
| |
Check we have all the keys we need.
- Parameters
-
[in] | e | Email with addresses to match |
[out] | keylist | Keys needed |
[in] | oppenc_mode | If true, use opportunistic encryption |
- Return values
-
Do a quick check to make sure that we can find all of the encryption keys if the user has requested this service. Return the list of keys in KEYLIST. If oppenc_mode is true, only keys that can be determined without prompting will be used.
Definition at line 945 of file crypt.c.
952 char *self_encrypt = NULL;
1005 if (!oppenc_mode && self_encrypt)
1009 sprintf(*keylist + keylist_size,
" %s", self_encrypt);
◆ crypt_opportunistic_encrypt()
void crypt_opportunistic_encrypt |
( |
struct Email * |
e | ) |
|
Can all recipients be determined.
- Parameters
-
Check if all recipients keys can be automatically determined. Enable encryption if they can, otherwise disable encryption.
Definition at line 1024 of file crypt.c.
1032 char *pgpkeylist = NULL;
◆ crypt_query()
Check out the type of encryption used.
- Parameters
-
- Return values
-
Set the cached status values if there are any.
Definition at line 687 of file crypt.c.
◆ crypt_valid_passphrase()
Check that we have a usable passphrase, ask if not.
- Parameters
-
- Return values
-
Definition at line 135 of file crypt.c.
◆ mutt_is_application_pgp()
Does the message use PGP?
- Parameters
-
- Return values
-
Definition at line 554 of file crypt.c.
◆ mutt_is_application_smime()
Does the message use S/MIME?
- Parameters
-
- Return values
-
Definition at line 612 of file crypt.c.
621 bool complain =
false;
655 _(
"S/MIME messages with no hints on content are unsupported"));
663 if ((len > 0) && (*(t + len) ==
'.'))
◆ mutt_is_malformed_multipart_pgp_encrypted()
Check for malformed layout.
- Parameters
-
- Return values
-
This checks for the malformed layout caused by MS Exchange in some cases:
<multipart/mixed>
<text/plain>
<application/pgp-encrypted> [BASE64-encoded]
<application/octet-stream> [BASE64-encoded]
Definition at line 510 of file crypt.c.
◆ mutt_is_multipart_encrypted()
Does the message have encrypted parts?
- Parameters
-
- Return values
-
Definition at line 449 of file crypt.c.
◆ mutt_is_multipart_signed()
Is a message signed?
- Parameters
-
- Return values
-
Definition at line 409 of file crypt.c.
◆ mutt_is_valid_multipart_pgp_encrypted()
int mutt_is_valid_multipart_pgp_encrypted |
( |
struct Body * |
b | ) |
|
Is this a valid multi-part encrypted message?
- Parameters
-
- Return values
-
Definition at line 473 of file crypt.c.
◆ mutt_protect()
int mutt_protect |
( |
struct Email * |
e, |
|
|
char * |
keylist, |
|
|
bool |
postpone |
|
) |
| |
Encrypt and/or sign a message.
- Parameters
-
e | Email |
keylist | List of keys to encrypt to (space-separated) |
postpone | When true, signing is automatically disabled |
- Return values
-
Definition at line 160 of file crypt.c.
162 struct Body *pbody = NULL, *tmp_pbody = NULL;
163 struct Body *tmp_smime_pbody = NULL;
164 struct Body *tmp_pgp_pbody = NULL;
165 bool has_retainable_sig =
false;
191 _(
"Inline PGP can't be used with attachments. "
192 "Revert to PGP/MIME?")) !=
MUTT_YES)
195 _(
"Mail not sent: inline PGP can't be used with attachments"));
203 _(
"Inline PGP can't be used with format=flowed. "
204 "Revert to PGP/MIME?"))) !=
MUTT_YES)
207 _(
"Mail not sent: inline PGP can't be used with format=flowed"));
217 puts(
_(
"Invoking PGP..."));
229 _(
"Message can't be sent inline. Revert to using PGP/MIME?")) !=
MUTT_YES)
243 tmp_smime_pbody = e->
body;
245 tmp_pgp_pbody = e->
body;
247 #ifdef CRYPT_BACKEND_GPGME
254 const char *mailbox = NULL;
256 bool free_from =
false;
322 tmp_smime_pbody = tmp_pbody;
332 has_retainable_sig =
true;
335 tmp_pgp_pbody = tmp_pbody;
355 if ((tmp_smime_pbody != e->
body) && (tmp_smime_pbody != tmp_pbody))
372 if (has_retainable_sig)
384 if (has_retainable_sig)
◆ mutt_protected_headers_handler()
int mutt_protected_headers_handler |
( |
struct Body * |
m, |
|
|
struct State * |
s |
|
) |
| |
Process a protected header - Implements handler_t.
Definition at line 1090 of file crypt.c.
1094 if (a->mime_headers->subject)
◆ mutt_should_hide_protected_subject()
bool mutt_should_hide_protected_subject |
( |
struct Email * |
e | ) |
|
Should NeoMutt hide the protected subject?
- Parameters
-
- Return values
-
bool | True if the subject should be protected |
Definition at line 1076 of file crypt.c.
◆ mutt_signed_handler()
int mutt_signed_handler |
( |
struct Body * |
a, |
|
|
struct State * |
s |
|
) |
| |
Verify a "multipart/signed" body - Implements handler_t.
Definition at line 1116 of file crypt.c.
1121 bool inconsistent =
false;
1123 struct Body **signatures = NULL;
1126 struct Buffer *tempfile = NULL;
1135 "Unknown multipart/signed protocol %s --]\n\n"),
1140 if (!(a && a->
next))
1141 inconsistent =
true;
1144 switch (signed_type)
1149 inconsistent =
true;
1156 inconsistent =
true;
1164 inconsistent =
true;
1168 inconsistent =
true;
1174 "signature --]\n\n"));
1186 bool goodsig =
true;
1189 for (
int i = 0; i < sigcnt; i++)
1214 "We can't verify %s/%s signatures. --]\n\n"),
1215 TYPE(signatures[i]), signatures[i]->subtype);
1235 _(
"[-- Warning: Can't find any signatures. --]\n\n"));
◆ crypt_cleanup()
void crypt_cleanup |
( |
void |
| ) |
|
◆ crypt_has_module_backend()
Is there a crypto backend for a given type?
- Parameters
-
- Return values
-
true | Backend is present |
false | Backend is not present |
Definition at line 169 of file cryptglue.c.
◆ crypt_init()
Initialise the crypto backends.
This calls CryptModuleSpecs::init()
Definition at line 95 of file cryptglue.c.
97 #ifdef CRYPT_BACKEND_CLASSIC_PGP
99 #ifdef CRYPT_BACKEND_GPGME
108 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
110 #ifdef CRYPT_BACKEND_GPGME
119 #ifdef CRYPT_BACKEND_GPGME
127 #if defined(CRYPT_BACKEND_CLASSIC_PGP) || \
128 defined(CRYPT_BACKEND_CLASSIC_SMIME) || defined(CRYPT_BACKEND_GPGME)
◆ crypt_invoke_message()
Display an informative message.
- Parameters
-
Show a message that a backend will be invoked.
Definition at line 155 of file cryptglue.c.
◆ crypt_pgp_application_handler()
int crypt_pgp_application_handler |
( |
struct Body * |
m, |
|
|
struct State * |
s |
|
) |
| |
◆ crypt_pgp_check_traditional()
int crypt_pgp_check_traditional |
( |
FILE * |
fp, |
|
|
struct Body * |
b, |
|
|
bool |
just_one |
|
) |
| |
◆ crypt_pgp_decrypt_mime()
int crypt_pgp_decrypt_mime |
( |
FILE * |
fp_in, |
|
|
FILE ** |
fp_out, |
|
|
struct Body * |
b, |
|
|
struct Body ** |
cur |
|
) |
| |
◆ crypt_pgp_encrypted_handler()
int crypt_pgp_encrypted_handler |
( |
struct Body * |
a, |
|
|
struct State * |
s |
|
) |
| |
◆ crypt_pgp_extract_key_from_attachment()
void crypt_pgp_extract_key_from_attachment |
( |
FILE * |
fp, |
|
|
struct Body * |
top |
|
) |
| |
◆ crypt_pgp_invoke_getkeys()
void crypt_pgp_invoke_getkeys |
( |
struct Address * |
addr | ) |
|
◆ crypt_pgp_make_key_attachment()
struct Body* crypt_pgp_make_key_attachment |
( |
void |
| ) |
|
◆ crypt_pgp_send_menu()
◆ crypt_smime_application_handler()
int crypt_smime_application_handler |
( |
struct Body * |
m, |
|
|
struct State * |
s |
|
) |
| |
◆ crypt_smime_decrypt_mime()
int crypt_smime_decrypt_mime |
( |
FILE * |
fp_in, |
|
|
FILE ** |
fp_out, |
|
|
struct Body * |
b, |
|
|
struct Body ** |
cur |
|
) |
| |
◆ crypt_smime_getkeys()
void crypt_smime_getkeys |
( |
struct Envelope * |
env | ) |
|
◆ crypt_smime_send_menu()
◆ crypt_smime_verify_sender()
int crypt_smime_verify_sender |
( |
struct Mailbox * |
m, |
|
|
struct Email * |
e |
|
) |
| |
◆ crypto_module_free()
void crypto_module_free |
( |
void |
| ) |
|
Clean up the crypto modules.
Definition at line 81 of file crypt_mod.c.
◆ pgp_gpgme_init()
void pgp_gpgme_init |
( |
void |
| ) |
|
◆ mutt_gpgme_select_secret_key()
int mutt_gpgme_select_secret_key |
( |
struct Buffer * |
keyid | ) |
|
Select a private Autocrypt key for a new account.
- Parameters
-
- Return values
-
Unfortunately, the internal ncrypt/crypt_gpgme.c functions use CryptKeyInfo, and so aren't exportable.
This function queries all private keys, provides the crypt_select_keys() menu, and returns the selected key fingerprint in keyid.
Definition at line 3946 of file crypt_gpgme.c.
3950 gpgme_key_t key = NULL;
3951 gpgme_user_id_t uid = NULL;
3959 if (gpgme_op_keylist_start(ctx, NULL, 1))
3964 while (!(err = gpgme_op_keylist_next(ctx, &key)))
3985 gpgme_key_ref(k->kobj);
3991 k->validity =
uid->validity;
3995 gpgme_key_unref(key);
3997 if (gpg_err_code(err) != GPG_ERR_EOF)
3998 mutt_error(
_(
"gpgme_op_keylist_next failed: %s"), gpgme_strerror(err));
3999 gpgme_op_keylist_end(ctx);
4010 if (!(choice && choice->
kobj && choice->
kobj->subkeys && choice->
kobj->subkeys->fpr))
◆ mutt_gpgme_print_version()
const char* mutt_gpgme_print_version |
( |
void |
| ) |
|
Get version of GPGME.
- Return values
-
Definition at line 4429 of file crypt_gpgme.c.
4431 return GPGME_VERSION;
◆ C_CryptOpportunisticEncrypt
bool C_CryptOpportunisticEncrypt |
Config: Enable encryption when the recipient's key is available.
Definition at line 54 of file config.c.
◆ C_CryptProtectedHeadersRead
bool C_CryptProtectedHeadersRead |
Config: Display protected headers (Memory Hole) in the pager.
Definition at line 56 of file config.c.
◆ C_CryptProtectedHeadersSave
bool C_CryptProtectedHeadersSave |
Config: Save the cleartext Subject with the headers.
Definition at line 57 of file config.c.
◆ C_CryptVerifySig
unsigned char C_CryptVerifySig |
Config: Verify PGP or SMIME signatures.
Definition at line 121 of file config.c.
◆ C_PgpAutoDecode
Config: Automatically decrypt PGP messages.
Definition at line 120 of file config.c.
◆ C_PgpSignAs
Config: Use this alternative key for signing messages.
Definition at line 65 of file config.c.
◆ C_SmimeEncryptWith
Config: Algorithm for encryption.
Definition at line 69 of file config.c.
◆ C_SmimeIsDefault
Config: Use SMIME rather than PGP by default.
Definition at line 59 of file config.c.
◆ C_SmimeSignAs
Config: Use this alternative key for signing messages.
Definition at line 68 of file config.c.
char * C_CryptProtectedHeadersSubject
Config: Use this as the subject for encrypted emails.
void crypto_module_register(struct CryptModuleSpecs *specs)
Register a new crypto module.
void mutt_endwin(void)
Shutdown curses/slang.
char * subject
Email's subject.
struct AddressList bcc
Email's 'Bcc' list.
KeyFlags flags
global and per uid flags (for convenience)
struct Address * C_EnvelopeFromAddress
Config: Manually set the sender for outgoing messages.
#define KEYFLAG_EXPIRED
Key is expired.
@ AUTOCRYPT_REC_NO
Do no use Autocrypt.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
#define MUTT_CM_CHARCONV
Perform character set conversions.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
void mutt_addrlist_dedupe(struct AddressList *al)
Remove duplicate addresses.
static void crypt_fetch_signatures(struct Body ***signatures, struct Body *a, int *n)
Create an array of an emails parts.
void mutt_addrlist_qualify(struct AddressList *al, const char *host)
Expand local names in an Address list using a hostname.
#define MUTT_DISPLAY
Output is displayed to the user.
String manipulation buffer.
#define STAILQ_REMOVE(head, elm, type, field)
static struct CryptModuleList CryptModules
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
void crypt_smime_void_passphrase(void)
Wrapper for CryptModuleSpecs::void_passphrase()
static void init_pgp(void)
Initialise the PGP crypto backend.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
SecurityFlags mutt_is_malformed_multipart_pgp_encrypted(struct Body *b)
Check for malformed layout.
struct Body * next
next attachment in the list
#define KEYFLAG_DISABLED
Key is marked disabled.
#define MUTT_CM_DECODE_CRYPT
#define SEC_ENCRYPT
Email is encrypted.
bool is_autocrypt
Flag autocrypt-decrypted messages for replying.
struct Body * crypt_pgp_encrypt_message(struct Email *e, struct Body *a, char *keylist, int sign, const struct AddressList *from)
Wrapper for CryptModuleSpecs::pgp_encrypt_message()
#define MUTT_CM_NOHEADER
Don't copy the message header.
struct Body * mutt_remove_multipart(struct Body *b)
Extract the multipart body if it exists.
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
#define SEC_SIGN
Email is signed.
WHERE bool OptAutocryptGpgme
(pseudo) use Autocrypt context inside ncrypt/crypt_gpgme.c
#define mutt_buffer_mktemp(buf)
int mutt_autocrypt_generate_gossip_list(struct Mailbox *m, struct Email *e)
Create the gossip list headers.
#define TAILQ_EMPTY(head)
#define KEYFLAG_REVOKED
Key is revoked.
struct Email * email
Email in the list.
void mutt_prepare_envelope(struct Envelope *env, bool final, struct ConfigSubset *sub)
Prepare an email header.
char * crypt_pgp_find_keys(struct AddressList *addrlist, bool oppenc_mode)
Wrapper for CryptModuleSpecs::find_keys()
struct CryptKeyInfo * dlg_select_gpgme_key(struct CryptKeyInfo *keys, struct Address *p, const char *s, unsigned int app, int *forced_valid)
Get the user to select a key.
void crypt_pgp_invoke_import(const char *fname)
Wrapper for CryptModuleSpecs::pgp_invoke_import()
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
struct Body * crypt_smime_build_smime_entity(struct Body *a, char *certlist)
Wrapper for CryptModuleSpecs::smime_build_smime_entity()
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s)
Implements CryptModuleSpecs::encrypted_handler()
const char * uid
and for convenience point to this user ID
void crypt_smime_invoke_import(const char *infile, const char *mailbox)
Wrapper for CryptModuleSpecs::smime_invoke_import()
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
void mutt_file_unlink(const char *s)
Delete a file, carefully.
uint8_t flags
e.g. MB_NORMAL
bool C_Autocrypt
Config: Enables the Autocrypt feature.
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
#define KEYFLAG_CANENCRYPT
Key is suitable for encryption.
int wraplen
Width to wrap lines to (when flags & MUTT_DISPLAY)
void state_mark_protected_header(struct State *s)
Write a unique marker around protected headers.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
void mutt_body_free(struct Body **ptr)
Free a Body.
int crypt_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
Wrapper for CryptModuleSpecs::verify_one()
char * subtype
content-type subtype
#define STAILQ_FOREACH(var, head, field)
struct CryptModuleSpecs CryptModSmimeGpgme
GPGME SMIME - Implements CryptModuleSpecs.
FILE * fp_out
File to write to.
void state_attach_puts(struct State *s, const char *t)
Write a string to the state.
bool C_CryptProtectedHeadersRead
Config: Display protected headers (Memory Hole) in the pager.
int crypt_get_keys(struct Email *e, char **keylist, bool oppenc_mode)
Check we have all the keys we need.
char * prefix
String to add to the beginning of each output line.
void mutt_parse_mime_message(struct Mailbox *m, struct Email *e)
Parse a MIME email.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
#define MUTT_CM_DECODE_SMIME
Used for decoding S/MIME messages.
bool C_CryptUseGpgme
Config: Use GPGME crypto backend.
bool badsig
Bad cryptographic signature (needed to check encrypted s/mime-signatures)
bool C_CryptUsePka
Config: Use GPGME to use PKA (lookup PGP keys using DNS)
#define TAILQ_HEAD_INITIALIZER(head)
bool C_PgpRetainableSigs
Config: Create nested multipart/signed or encrypted messages.
#define TAILQ_FIRST(head)
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
struct AddressList cc
Email's 'Cc' list.
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
uint16_t KeyFlags
Flags describing PGP/SMIME keys, e.g. KEYFLAG_CANSIGN.
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
SecurityFlags mutt_is_application_pgp(struct Body *m)
Does the message use PGP?
SecurityFlags crypt_query(struct Body *m)
Check out the type of encryption used.
bool crypt_pgp_valid_passphrase(void)
Wrapper for CryptModuleSpecs::valid_passphrase()
bool goodsig
Good cryptographic signature.
WHERE short C_Wrap
Config: Width to wrap text in the pager.
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
@ KEY_CAP_CAN_SIGN
Key can be used for signing.
LOFF_T length
length (in bytes) of attachment
struct Body * crypt_pgp_traditional_encryptsign(struct Body *a, SecurityFlags flags, char *keylist)
Wrapper for CryptModuleSpecs::pgp_traditional_encryptsign()
struct Body * crypt_pgp_sign_message(struct Body *a, const struct AddressList *from)
Wrapper for CryptModuleSpecs::sign_message()
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define KEYFLAG_CANSIGN
Key is suitable for signing.
#define MUTT_CM_NO_FLAGS
No flags are set.
bool C_CryptOpportunisticEncrypt
Config: Enable encryption when the recipient's key is available.
#define CH_NO_FLAGS
No flags are set.
WHERE bool OptDontHandlePgpKeys
(pseudo) used to extract PGP keys
bool C_PgpSelfEncrypt
Config: Encrypted messages will also be encrypted to $pgp_default_key too.
unsigned char C_PgpEncryptSelf
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
char * description
content-description
bool mutt_matches_ignore(const char *s)
Does the string match the ignore list.
void mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
#define CH_DISPLAY
Display result to user.
struct AddressList to
Email's 'To' list.
struct CryptModuleSpecs * crypto_module_lookup(int identifier)
Lookup a crypto module by name.
char * C_PgpDefaultKey
Config: Default key to use for PGP operations.
struct Body * parts
parts of a multipart or message/rfc822
#define CRYPT_MOD_CALL(identifier, func)
@ TYPE_MESSAGE
Type: 'message/*'.
unsigned char C_PgpMimeAuto
Config: Prompt the user to use MIME if inline PGP fails.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
static void init_common(void)
Initialise code common to PGP and SMIME parts of GPGME.
struct Envelope * env
Envelope information.
int crypt_write_signed(struct Body *a, struct State *s, const char *tempfile)
Write the message body/part.
int state_printf(struct State *s, const char *fmt,...)
Write a formatted string to the State.
#define KEYFLAG_NO_FLAGS
No flags are set.
unsigned int key_check_cap(gpgme_key_t key, enum KeyCap cap)
Check the capabilities of a key.
void mutt_addr_free(struct Address **ptr)
Free a single Address.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
struct Envelope * mutt_env_new(void)
Create a new Envelope.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
bool crypt_smime_valid_passphrase(void)
Wrapper for CryptModuleSpecs::valid_passphrase()
static void crypt_key_free(struct CryptKeyInfo **keylist)
Release all the keys in a list.
#define SEC_BADSIGN
Email has a bad signature.
void crypt_smime_set_sender(const char *sender)
Wrapper for CryptModuleSpecs::set_sender()
void mutt_param_delete(struct ParameterList *pl, const char *attribute)
Delete a matching Parameter.
char * mailbox
Mailbox and host address.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
struct Body * crypt_smime_sign_message(struct Body *a, const struct AddressList *from)
Wrapper for CryptModuleSpecs::sign_message()
bool C_Weed
Config: Filter headers when displaying/forwarding/printing/replying.
WHERE bool OptPgpCheckTrust
(pseudo) used by dlg_select_pgp_key()
int crypt_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
Wrapper for CryptModuleSpecs::verify_one()
struct AddressList from
Email's 'From' list.
@ TYPE_APPLICATION
Type: 'application/*'.
char * d_filename
filename to be used for the content-disposition header.
bool C_SmimeSelfEncrypt
Config: Encrypted messages will also be encrypt to $smime_default_key too.
@ TYPE_TEXT
Type: 'text/*'.
int mutt_protected_headers_handler(struct Body *a, struct State *s)
Process a protected header - Implements handler_t.
Container for Accounts, Notifications.
#define SEC_INLINE
Email has an inline signature.
char * crypt_smime_find_keys(struct AddressList *addrlist, bool oppenc_mode)
Wrapper for CryptModuleSpecs::find_keys()
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
unsigned int type
content-type primary type, ContentType
char * C_SmimeDefaultKey
Config: Default key for SMIME operations.
int mutt_body_handler(struct Body *b, struct State *s)
Handler for the Body of an email.
@ KEY_CAP_CAN_ENCRYPT
Key can be used for encryption.
struct Address * mutt_default_from(struct ConfigSubset *sub)
Get a default 'from' Address.
struct CryptKeyInfo * next
#define MUTT_CM_DECODE
Decode the message body into text/plain.
struct ConfigSubset * sub
Inherited config items.
void crypt_pgp_void_passphrase(void)
Wrapper for CryptModuleSpecs::void_passphrase()
struct CryptModuleSpecs CryptModSmimeClassic
CLI SMIME - Implements CryptModuleSpecs.
struct ParameterList parameter
parameters of the content-type
enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Mailbox *m, struct Email *e, char **keylist)
Get the recommended action for an Email.
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
struct CryptModuleSpecs CryptModPgpClassic
CLI PGP - Implements CryptModuleSpecs.
@ TYPE_MULTIPART
Type: 'multipart/*'.
The envelope/body of an email.
bool C_CryptProtectedHeadersWrite
Config: Generate protected header (Memory Hole) for signed and encrypted emails.
#define mutt_message(...)
int pgp_gpgme_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Implements CryptModuleSpecs::decrypt_mime()
void crypt_pgp_set_sender(const char *sender)
Wrapper for CryptModuleSpecs::set_sender()
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
int mutt_copy_message(FILE *fp_out, struct Mailbox *m, struct Email *e, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen)
Copy a message from a Mailbox.
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
#define SEC_NO_FLAGS
No flags are set.
gpgme_ctx_t create_gpgme_context(bool for_smime)
Create a new GPGME context.
SecurityFlags mutt_is_multipart_signed(struct Body *b)
Is a message signed?
struct AddressList sender
Email's sender.
#define SEC_GOODSIGN
Email has a valid signature.
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
struct CryptModuleSpecs CryptModPgpGpgme
GPGME PGP - Implements CryptModuleSpecs.
SecurityFlags mutt_is_application_smime(struct Body *m)
Does the message use S/MIME?
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
#define state_puts(STATE, STR)
#define SEC_PARTSIGN
Not all parts of the email is signed.
struct Envelope * mime_headers
Memory hole protected headers.
unsigned char C_SmimeEncryptSelf
char * filename
when sending a message, this is the file to which this structure refers
struct Body * body
List of MIME parts.
#define CRYPT_MOD_CALL_CHECK(identifier, func)