54#ifdef CRYPT_BACKEND_CLASSIC_PGP
86 for (s = uid, d = uid; *s;)
106 const char *ib = uid;
107 size_t ibl = d - uid + 1;
110 iconv(cd, (ICONV_CONST
char **) &ib, &ibl, &ob, &obl);
115 memcpy(uid, buf, ob - buf);
116 uid[ob - buf] =
'\0';
118 else if ((n >= 0) && ((ob - buf) == n) && (buf[n] = 0, (strlen(buf) < (
size_t) n)))
137 struct PgpUid *uid = NULL;
146 char tstr[11] = { 0 };
157 memcpy(&tmp, k,
sizeof(tmp));
162 for (p = buf; p; p = pend)
164 pend = strchr(p,
':');
168 if ((*p ==
'\0') && (field != 1) && (field != 10))
171 if (is_fpr && (field != 10))
195 if (!(is_uid || is_fpr || (*is_subkey && c_pgp_ignore_subkeys)))
196 memset(&tmp, 0,
sizeof(tmp));
229 if (!is_uid && !(*is_subkey && c_pgp_ignore_subkeys))
238 if (!(*is_subkey && c_pgp_ignore_subkeys) && !mutt_str_atos_full(p, &tmp.
keylen))
248 if (!(*is_subkey && c_pgp_ignore_subkeys))
251 if (!mutt_str_atoi_full(p, &x))
262 if (!(*is_subkey && c_pgp_ignore_subkeys))
272 struct tm time = { 0 };
277 strncpy(tstr, p, 11);
280 if (!mutt_str_atoi_full(tstr, &time.tm_year))
285 time.tm_year -= 1900;
286 if (!mutt_str_atoi_full(tstr + 5, &time.tm_mon))
292 if (!mutt_str_atoi_full(tstr + 8, &time.tm_mday))
301 unsigned long long secs = 0;
322 if (!(pend && (*p || is_pub)))
334 if (!is_uid && (*is_subkey && c_pgp_ignore_subkeys))
347 if (strstr(p,
"ENCR"))
349 if (strstr(p,
"SIGN"))
377 if (!is_uid && (!*is_subkey || !c_pgp_ignore_subkeys ||
392 if (!(is_uid || is_fpr || (*is_subkey && c_pgp_ignore_subkeys)))
396 memcpy(k, &tmp,
sizeof(*k));
424 char buf[1024] = { 0 };
432 int fd_null = open(
"/dev/null", O_RDWR);
447 while (fgets(buf,
sizeof(buf) - 1, fp))
const char * mutt_str_atoull(const char *str, unsigned long long *dst)
Convert ASCII string to an unsigned long long.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
const char * cc_charset(void)
Get the cached value of $charset.
Convenience wrapper for the core headers.
bool mutt_isxdigit(int arg)
Wrapper for isxdigit(3)
Structs that make up an email.
#define mutt_file_fclose(FP)
static void fix_uid(char *uid)
Decode backslash-escaped user ids (in place)
static struct PgpKeyInfo * parse_pub_line(char *buf, bool *is_subkey, struct PgpKeyInfo *k)
Parse the 'pub' line from the pgp output.
struct PgpKeyInfo * pgp_get_candidates(enum PgpRing keyring, struct ListHead *hints)
Find PGP keys matching a list of hints.
Parse the output of CLI PGP programinclude "pgpkey.h".
#define mutt_debug(LEVEL,...)
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MUTT_MEM_CALLOC(n, type)
#define MUTT_MEM_MALLOC(n, type)
#define hexval(ch)
Convert hexadecimal character to its integer value.
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, uint8_t flags)
Set up iconv for conversions.
#define MUTT_ICONV_NONE
No flags are set.
#define ICONV_T_INVALID
Error value for iconv functions.
static bool iconv_t_valid(const iconv_t cd)
Is the conversion descriptor valid?
time_t mutt_date_make_time(struct tm *t, bool local)
Convert struct tm to time_t
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
API for encryption/signing of emails.
@ KEYFLAG_REVOKED
Key is revoked.
@ KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
@ KEYFLAG_NONE
No flags are set.
@ KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
@ KEYFLAG_CANSIGN
Key is suitable for signing.
@ KEYFLAG_EXPIRED
Key is expired.
@ KEYFLAG_CANENCRYPT
Key is suitable for encryption.
@ KEYFLAG_SUBKEY
Key is a subkey.
@ KEYFLAG_DISABLED
Key is marked disabled.
Ncrypt private Module data.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
pid_t pgp_invoke_list_keys(FILE **fp_pgp_in, FILE **fp_pgp_out, FILE **fp_pgp_err, int fd_pgp_in, int fd_pgp_out, int fd_pgp_err, enum PgpRing keyring, struct ListHead *hints)
Find matching PGP Keys.
Wrapper around calls to external PGP program.
PGP key management routines.
const char * pgp_pkalgbytype(unsigned char type)
Get the name of the algorithm from its ID.
struct PgpUid * pgp_copy_uids(struct PgpUid *up, struct PgpKeyInfo *parent)
Copy a list of PGP UIDs.
Misc PGP helper routines.
Ncrypt private Module data.
char * charset
gnupgparse charset
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Information about a PGP key.
struct PgpKeyInfo * next
Linked list.
struct PgpUid * address
User IDs.
char * fingerprint
Key fingerprint.
time_t gen_time
Key generation time.
const char * algorithm
Algorithm name.
struct PgpKeyInfo * parent
Parent key.
int numalg
Algorithm number.
struct PgpKeyInfo * parent
Parent key.
int flags
Flags for this UID.
char * addr
Email address.
struct PgpUid * next
Linked list.