53#ifdef CRYPT_BACKEND_CLASSIC_PGP
83 char *s = NULL, *d = NULL;
86 for (s = uid, d = uid; *s;)
88 if ((s[0] ==
'\\') && (s[1] ==
'x') && isxdigit((
unsigned char) s[2]) &&
89 isxdigit((
unsigned char) s[3]))
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;
142 char *pend = NULL, *p = NULL;
145 char tstr[11] = { 0 };
156 memcpy(&tmp, k,
sizeof(tmp));
161 for (p = buf; p; p = pend)
163 pend = strchr(p,
':');
167 if ((*p ==
'\0') && (field != 1) && (field != 10))
170 if (is_fpr && (field != 10))
194 if (!(is_uid || is_fpr || (*is_subkey && c_pgp_ignore_subkeys)))
195 memset(&tmp, 0,
sizeof(tmp));
228 if (!is_uid && !(*is_subkey && c_pgp_ignore_subkeys))
237 if (!(*is_subkey && c_pgp_ignore_subkeys) && !mutt_str_atos_full(p, &tmp.
keylen))
247 if (!(*is_subkey && c_pgp_ignore_subkeys))
250 if (!mutt_str_atoi_full(p, &x))
261 if (!(*is_subkey && c_pgp_ignore_subkeys))
271 struct tm time = { 0 };
276 strncpy(tstr, p, 11);
279 if (!mutt_str_atoi_full(tstr, &time.tm_year))
284 time.tm_year -= 1900;
285 if (!mutt_str_atoi_full(tstr + 5, &time.tm_mon))
291 if (!mutt_str_atoi_full(tstr + 8, &time.tm_mday))
300 unsigned long long secs;
321 if (!(pend && (*p || is_pub)))
333 if (!is_uid && (*is_subkey && c_pgp_ignore_subkeys))
346 if (strstr(p,
"ENCR"))
348 if (strstr(p,
"SIGN"))
376 if (!is_uid && (!*is_subkey || !c_pgp_ignore_subkeys ||
391 if (!(is_uid || is_fpr || (*is_subkey && c_pgp_ignore_subkeys)))
395 memcpy(k, &tmp,
sizeof(*k));
422 char buf[1024] = { 0 };
423 struct PgpKeyInfo *db = NULL, **kend = NULL, *k = NULL, *kk = NULL, *mainkey = NULL;
426 int fd_null = open(
"/dev/null", O_RDWR);
441 while (fgets(buf,
sizeof(buf) - 1, fp))
461 for (l = &k->address; *l; l = &(*l)->
next)
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.
Structs that make up an email.
#define mutt_file_fclose(FP)
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
static void fix_uid(char *uid)
Decode backslash-escaped user ids (in place)
static char * Charset
Cached copy of $charset.
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.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, uint8_t flags)
Set up iconv for conversions.
#define ICONV_T_INVALID
Error value for iconv functions.
#define MUTT_ICONV_NO_FLAGS
No flags are set.
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
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.
#define KEYFLAG_EXPIRED
Key is expired.
uint16_t KeyFlags
Flags describing PGP/SMIME keys, e.g. KEYFLAG_CANSIGN.
#define KEYFLAG_CANENCRYPT
Key is suitable for encryption.
#define KEYFLAG_SUBKEY
Key is a subkey.
#define KEYFLAG_NO_FLAGS
No flags are set.
#define KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
#define KEYFLAG_DISABLED
Key is marked disabled.
#define KEYFLAG_REVOKED
Key is revoked.
#define KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
#define KEYFLAG_CANSIGN
Key is suitable for signing.
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.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Information about a PGP key.
struct PgpKeyInfo * parent
Parent key.
struct PgpUid * next
Linked list.