54#ifdef CRYPT_BACKEND_CLASSIC_PGP
84 char *s = NULL, *d = NULL;
87 for (s = uid, d = uid; *s;)
89 if ((s[0] ==
'\\') && (s[1] ==
'x') && isxdigit((
unsigned char) s[2]) &&
90 isxdigit((
unsigned char) s[3]))
107 const char *ib = uid;
108 size_t ibl = d - uid + 1;
111 iconv(cd, (ICONV_CONST
char **) &ib, &ibl, &ob, &obl);
116 memcpy(uid, buf, ob - buf);
117 uid[ob - buf] =
'\0';
119 else if ((n >= 0) && ((ob - buf) == n) && (buf[n] = 0, (strlen(buf) < (
size_t) n)))
138 struct PgpUid *uid = NULL;
143 char *pend = NULL, *p = 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;
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));
423 char buf[1024] = { 0 };
424 struct PgpKeyInfo *db = NULL, **kend = NULL, *k = NULL, *kk = NULL, *mainkey = NULL;
427 int fd_null = open(
"/dev/null", O_RDWR);
442 while (fgets(buf,
sizeof(buf) - 1, fp))
462 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)
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
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.
#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.