#include "config.h"
#include <stdbool.h>
Go to the source code of this file.
Shared constants/structs that are private to libconn
- Authors
-
- 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 private.h.
◆ dlg_select_smime_key()
Get the user to select a key.
- Parameters
-
keys | List of keys to select from |
query | String to match |
- Return values
-
Definition at line 157 of file dlgsmime.c.
163 struct SmimeKey *selected_key = NULL;
166 struct Menu *menu = NULL;
170 for (table_index = 0, key =
keys; key; key = key->
next)
172 if (table_index == table_size)
178 table[table_index++] = key;
181 snprintf(
title,
sizeof(
title),
_(
"S/MIME certificates matching \"%s\""), query);
188 menu->
max = table_index;
202 case OP_GENERIC_SELECT_ENTRY:
203 if (table[menu->
current]->trust !=
't')
205 switch (table[menu->
current]->trust)
210 s =
_(
"ID is expired/disabled/revoked. Do you really want to use "
214 s =
_(
"ID has undefined validity. Do you really want to use the "
218 s =
_(
"ID is not trusted. Do you really want to use the key?");
222 snprintf(buf,
sizeof(buf),
"%s", s);
231 selected_key = table[menu->
current];
◆ dlg_select_pgp_key()
Let the user select a key to use.
- Parameters
-
keys | List of PGP keys |
p | Address to match |
s | String to match |
- Return values
-
Definition at line 469 of file dlgpgp.c.
472 struct PgpUid **key_table = NULL;
473 struct Menu *menu = NULL;
476 char buf[1024], tmpbuf[256];
479 struct Buffer *tempfile = NULL;
481 bool unusable =
false;
485 for (i = 0, kp = keys; kp; kp = kp->
next)
511 if ((i == 0) && unusable)
513 mutt_error(
_(
"All matching keys are expired, revoked, or disabled"));
517 int (*f)(
const void *,
const void *);
534 qsort(key_table, i,
sizeof(
struct PgpUid *), f);
543 menu->
mdata = key_table;
547 snprintf(buf,
sizeof(buf),
_(
"PGP keys matching <%s>"), p->
mailbox);
549 snprintf(buf,
sizeof(buf),
_(
"PGP keys matching \"%s\""), s);
563 FILE *fp_null = fopen(
"/dev/null",
"w");
582 snprintf(tmpbuf,
sizeof(tmpbuf),
"0x%s",
586 fileno(fp_null), tmpbuf);
600 snprintf(title,
sizeof(title),
_(
"Key ID: 0x%s"),
613 case OP_GENERIC_SELECT_ENTRY:
621 mutt_error(
_(
"This key can't be used: expired/disabled/revoked"));
629 const char *str =
"";
634 str =
_(
"ID is expired/disabled/revoked. Do you really want to use "
639 switch (key_table[menu->
current]->trust & 0x03)
642 str =
_(
"ID has undefined validity. Do you really want to use "
646 str =
_(
"ID is not valid. Do you really want to use the key?");
649 str =
_(
"ID is only marginally valid. Do you really want to "
655 snprintf(buf2,
sizeof(buf2),
"%s", str);
◆ dlg_select_gpgme_key()
Get the user to select a key.
- Parameters
-
[in] | keys | List of keys to select from |
[in] | p | Address to match |
[in] | s | Real name to display |
[in] | app | Flags, e.g. APPLICATION_PGP |
[out] | forced_valid | Set to true if user overrode key's validity |
- Return values
-
Display a menu to select a key from the array of keys.
Definition at line 1196 of file dlggpgme.c.
1205 int (*f)(
const void *,
const void *);
1207 bool unusable =
false;
1215 for (k = keys; k; k = k->
next)
1234 mutt_error(
_(
"All matching keys are marked expired/revoked"));
1268 menu->
mdata = key_table;
1272 const char *ts = NULL;
1275 ts =
_(
"PGP and S/MIME keys matching");
1277 ts =
_(
"PGP keys matching");
1279 ts =
_(
"S/MIME keys matching");
1281 ts =
_(
"keys matching");
1288 snprintf(buf,
sizeof(buf),
_(
"%s <%s>"), ts, p->
mailbox);
1293 snprintf(buf,
sizeof(buf),
_(
"%s \"%s\""), ts, s);
1314 case OP_GENERIC_SELECT_ENTRY:
1322 "expired/disabled/revoked"));
1330 const char *warn_s = NULL;
1335 warn_s =
_(
"ID is expired/disabled/revoked. Do you really want to "
1341 switch (key_table[menu->
current]->validity)
1343 case GPGME_VALIDITY_NEVER:
1345 _(
"ID is not valid. Do you really want to use the key?");
1347 case GPGME_VALIDITY_MARGINAL:
1348 warn_s =
_(
"ID is only marginally valid. Do you really want to "
1351 case GPGME_VALIDITY_FULL:
1352 case GPGME_VALIDITY_ULTIMATE:
1354 case GPGME_VALIDITY_UNKNOWN:
1355 case GPGME_VALIDITY_UNDEFINED:
1356 warn_s =
_(
"ID has undefined validity. Do you really want to "
1362 snprintf(buf2,
sizeof(buf2),
"%s", warn_s);
1379 #if (GPGME_VERSION_NUMBER < 0x010b00)
◆ C_CryptUsePka
Config: Use GPGME to use PKA (lookup PGP keys using DNS)
Definition at line 51 of file config.c.
◆ C_CryptConfirmHook
Config: Prompt the user to confirm keys before use.
Definition at line 53 of file config.c.
◆ C_CryptOpportunisticEncryptStrongKeys
bool C_CryptOpportunisticEncryptStrongKeys |
Config: Enable encryption only when strong a key is available.
Definition at line 55 of file config.c.
◆ C_CryptProtectedHeadersWrite
bool C_CryptProtectedHeadersWrite |
Config: Generate protected header (Memory Hole) for signed and encrypted emails.
Definition at line 58 of file config.c.
◆ C_PgpIgnoreSubkeys
Config: Only use the principal PGP key.
Definition at line 60 of file config.c.
◆ C_PgpLongIds
Config: Display long PGP key IDs to the user.
Definition at line 61 of file config.c.
◆ C_PgpShowUnusable
Config: Show non-usable keys in the key selection.
Definition at line 62 of file config.c.
◆ C_PgpAutoInline
Config: Use old-style inline PGP messages (not recommended)
Definition at line 63 of file config.c.
◆ C_PgpDefaultKey
Config: Default key to use for PGP operations.
Definition at line 64 of file config.c.
◆ C_PgpEntryFormat
Config: printf-like format string for the PGP key selection menu.
Definition at line 66 of file config.c.
◆ C_SmimeDefaultKey
Config: Default key for SMIME operations.
Definition at line 67 of file config.c.
◆ C_CryptProtectedHeadersSubject
char* C_CryptProtectedHeadersSubject |
Config: Use this as the subject for encrypted emails.
Definition at line 70 of file config.c.
◆ C_EnvelopeFromAddress
struct Address* C_EnvelopeFromAddress |
Config: Manually set the sender for outgoing messages.
Definition at line 71 of file config.c.
◆ C_CryptTimestamp
Config: Add a timestamp to PGP or SMIME output to prevent spoofing.
Definition at line 72 of file config.c.
◆ C_PgpEncryptSelf
unsigned char C_PgpEncryptSelf |
◆ C_PgpMimeAuto
unsigned char C_PgpMimeAuto |
Config: Prompt the user to use MIME if inline PGP fails.
Definition at line 74 of file config.c.
◆ C_PgpRetainableSigs
Config: Create nested multipart/signed or encrypted messages.
Definition at line 75 of file config.c.
◆ C_PgpSelfEncrypt
Config: Encrypted messages will also be encrypted to $pgp_default_key
too.
Definition at line 76 of file config.c.
◆ C_PgpStrictEnc
Config: Encode PGP signed messages with quoted-printable (don't unset)
Definition at line 77 of file config.c.
◆ C_SmimeEncryptSelf
unsigned char C_SmimeEncryptSelf |
◆ C_SmimeSelfEncrypt
Config: Encrypted messages will also be encrypt to $smime_default_key
too.
Definition at line 79 of file config.c.
◆ C_CryptUseGpgme
Config: Use GPGME crypto backend.
Definition at line 81 of file config.c.
◆ C_PgpCheckExit
Config: Check the exit code of PGP subprocess.
Definition at line 83 of file config.c.
◆ C_PgpCheckGpgDecryptStatusFd
bool C_PgpCheckGpgDecryptStatusFd |
Config: File descriptor used for status info.
Definition at line 84 of file config.c.
◆ C_PgpDecryptionOkay
struct Regex* C_PgpDecryptionOkay |
Config: Text indicating a successful decryption.
Definition at line 85 of file config.c.
◆ C_PgpGoodSign
struct Regex* C_PgpGoodSign |
Config: Text indicating a good signature.
Definition at line 86 of file config.c.
◆ C_PgpTimeout
Config: Time in seconds to cache a passphrase.
Definition at line 87 of file config.c.
◆ C_PgpUseGpgAgent
Config: Use a PGP agent for caching passwords.
Definition at line 88 of file config.c.
◆ C_PgpClearSignCommand
char* C_PgpClearSignCommand |
Config: (pgp) External command to inline-sign a message.
Definition at line 89 of file config.c.
◆ C_PgpDecodeCommand
Config: (pgp) External command to decode a PGP attachment.
Definition at line 90 of file config.c.
◆ C_PgpDecryptCommand
char* C_PgpDecryptCommand |
Config: (pgp) External command to decrypt a PGP message.
Definition at line 91 of file config.c.
◆ C_PgpEncryptOnlyCommand
char* C_PgpEncryptOnlyCommand |
Config: (pgp) External command to encrypt, but not sign a message.
Definition at line 92 of file config.c.
◆ C_PgpEncryptSignCommand
char* C_PgpEncryptSignCommand |
Config: (pgp) External command to encrypt and sign a message.
Definition at line 93 of file config.c.
◆ C_PgpExportCommand
Config: (pgp) External command to export a public key from the user's keyring.
Definition at line 94 of file config.c.
◆ C_PgpGetKeysCommand
char* C_PgpGetKeysCommand |
Config: (pgp) External command to download a key for an email address.
Definition at line 95 of file config.c.
◆ C_PgpImportCommand
Config: (pgp) External command to import a key into the user's keyring.
Definition at line 96 of file config.c.
◆ C_PgpListPubringCommand
char* C_PgpListPubringCommand |
Config: (pgp) External command to list the public keys in a user's keyring.
Definition at line 97 of file config.c.
◆ C_PgpListSecringCommand
char* C_PgpListSecringCommand |
Config: (pgp) External command to list the private keys in a user's keyring.
Definition at line 98 of file config.c.
◆ C_PgpSignCommand
Config: (pgp) External command to create a detached PGP signature.
Definition at line 99 of file config.c.
◆ C_PgpVerifyCommand
Config: (pgp) External command to verify PGP signatures.
Definition at line 100 of file config.c.
◆ C_PgpVerifyKeyCommand
char* C_PgpVerifyKeyCommand |
Config: (pgp) External command to verify key information.
Definition at line 101 of file config.c.
◆ C_PgpSortKeys
Config: Sort order for PGP keys.
Definition at line 102 of file config.c.
◆ C_SmimeAskCertLabel
Config: Prompt the user for a label for SMIME certificates.
Definition at line 103 of file config.c.
◆ C_SmimeCaLocation
Config: File containing trusted certificates.
Definition at line 104 of file config.c.
◆ C_SmimeCertificates
char* C_SmimeCertificates |
Config: File containing user's public certificates.
Definition at line 105 of file config.c.
◆ C_SmimeDecryptCommand
char* C_SmimeDecryptCommand |
Config: (smime) External command to decrypt an SMIME message.
Definition at line 106 of file config.c.
◆ C_SmimeDecryptUseDefaultKey
bool C_SmimeDecryptUseDefaultKey |
Config: Use the default key for decryption.
Definition at line 107 of file config.c.
◆ C_SmimeEncryptCommand
char* C_SmimeEncryptCommand |
Config: (smime) External command to encrypt a message.
Definition at line 108 of file config.c.
◆ C_SmimeGetCertCommand
char* C_SmimeGetCertCommand |
Config: (smime) External command to extract a certificate from a message.
Definition at line 109 of file config.c.
◆ C_SmimeGetCertEmailCommand
char* C_SmimeGetCertEmailCommand |
Config: (smime) External command to get a certificate for an email.
Definition at line 110 of file config.c.
◆ C_SmimeGetSignerCertCommand
char* C_SmimeGetSignerCertCommand |
Config: (smime) External command to extract a certificate from an email.
Definition at line 111 of file config.c.
◆ C_SmimeImportCertCommand
char* C_SmimeImportCertCommand |
Config: (smime) External command to import a certificate.
Definition at line 112 of file config.c.
◆ C_SmimeKeys
Config: File containing user's private certificates.
Definition at line 113 of file config.c.
◆ C_SmimePk7outCommand
char* C_SmimePk7outCommand |
Config: (smime) External command to extract a public certificate.
Definition at line 114 of file config.c.
◆ C_SmimeSignCommand
Config: (smime) External command to sign a message.
Definition at line 115 of file config.c.
◆ C_SmimeSignDigestAlg
char* C_SmimeSignDigestAlg |
Config: Digest algorithm.
Definition at line 116 of file config.c.
◆ C_SmimeTimeout
Config: Time in seconds to cache a passphrase.
Definition at line 117 of file config.c.
◆ C_SmimeVerifyCommand
char* C_SmimeVerifyCommand |
Config: (smime) External command to verify a signed message.
Definition at line 118 of file config.c.
◆ C_SmimeVerifyOpaqueCommand
char* C_SmimeVerifyOpaqueCommand |
Config: (smime) External command to verify a signature.
Definition at line 119 of file config.c.
@ MENU_GENERIC
Generic selection list.
struct MuttWindow * dialog_create_simple_index(struct Menu *menu, enum WindowType type)
Create a simple index Dialog.
KeyFlags flags
global and per uid flags (for convenience)
static int pgp_compare_keyid_qsort(const void *a, const void *b)
Compare key IDs.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
static void pgp_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the pgp key list - Implements Menu::make_entry()
String manipulation buffer.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
static int crypt_crypt_compare_keyid_qsort(const void *a, const void *b)
Compare the IDs of two keys.
@ MENU_PGP
PGP encryption menu.
#define mutt_buffer_mktemp(buf)
A division of the screen.
char * pgp_keyid(struct PgpKeyInfo *k)
Get the ID of the main (parent) key.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
@ WT_DLG_CRYPT_GPGME
Crypt-GPGME Dialog, dlg_select_gpgme_key()
#define SORT_MASK
Mask for the sort id.
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
static bool crypt_key_is_valid(struct CryptKeyInfo *k)
Is the key valid.
@ WT_DLG_PGP
Pgp Dialog, dlg_select_pgp_key()
bool C_PgpShowUnusable
Config: Show non-usable keys in the key selection.
static const struct Mapping SmimeHelp[]
Help Bar for the Smime key selection dialog.
char * pgp_fpr_or_lkeyid(struct PgpKeyInfo *k)
Get the fingerprint or long keyid.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
static void smime_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the smime key list - Implements Menu::make_entry()
int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color, struct Pager *info)
Display some page-able text to the user.
@ MENU_KEY_SELECT_PGP
Select a PGP key.
static const struct Mapping PgpHelp[]
Help Bar for the PGP key selection dialog.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
int crypt_id_is_valid(struct CryptKeyInfo *key)
Is key ID valid.
struct PgpKeyInfo * parent
static void verify_key(struct CryptKeyInfo *key)
Show detailed information about the selected key.
static int pgp_compare_date_qsort(const void *a, const void *b)
Compare the dates of two PGP keys.
struct CryptKeyInfo * crypt_copy_key(struct CryptKeyInfo *key)
Return a copy of KEY.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
@ MUTT_NO
User answered 'No', or assume 'No'.
@ MENU_SMIME
SMIME encryption menu.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool pgp_id_is_strong(struct PgpUid *uid)
Is a PGP key strong?
@ SORT_KEYID
Sort by the encryption key's ID.
const struct Mapping * help_data
Data for the Help Bar.
@ SORT_ADDRESS
Sort by email address.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
char * mailbox
Mailbox and host address.
struct PgpKeyInfo * pgp_principal_key(struct PgpKeyInfo *key)
Get the main (parent) PGP key.
@ WT_DLG_SMIME
Smime Dialog, dlg_select_smime_key()
WHERE bool OptPgpCheckTrust
(pseudo) used by dlg_select_pgp_key()
bool pgp_id_is_valid(struct PgpUid *uid)
Is a PGP key valid.
bool pgp_key_is_valid(struct PgpKeyInfo *k)
Is a PGP key valid?
bool crypt_id_is_strong(struct CryptKeyInfo *key)
Is the key strong.
MenuType
Types of GUI selections.
Information about a PGP key.
static int crypt_compare_date_qsort(const void *a, const void *b)
Compare the dates of two keys.
static int pgp_compare_trust_qsort(const void *a, const void *b)
Compare the trust levels of two PGP keys.
struct CryptKeyInfo * next
static const struct Mapping GpgmeHelp[]
Help Bar for the GPGME key selection dialog.
@ MENU_KEY_SELECT_SMIME
Select a SMIME key.
void dialog_destroy_simple_index(struct MuttWindow **ptr)
Destroy a simple index Dialog.
pid_t pgp_invoke_verify_key(FILE **fp_pgp_in, FILE **fp_pgp_out, FILE **fp_pgp_err, int fd_pgp_in, int fd_pgp_out, int fd_pgp_err, const char *uids)
Use PGP to verify a key.
static int pgp_compare_address_qsort(const void *a, const void *b)
Compare the addresses of two PGP keys.
@ SORT_TRUST
Sort by encryption key's trust level.
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
#define mutt_message(...)
static int crypt_compare_trust_qsort(const void *a, const void *b)
Compare the trust levels of two keys.
@ SORT_DATE
Sort by the date the email was sent.
short C_PgpSortKeys
Config: Sort order for PGP keys.
static void crypt_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the key selection list - Implements Menu::make_entry()
static int crypt_compare_address_qsort(const void *a, const void *b)
Compare the addresses of two keys.