50#ifdef CRYPT_BACKEND_CLASSIC_PGP
64 const char *s = cctx->
signas;
76 const char *s = cctx->
fname;
100 const char *s = cctx->
ids;
148static pid_t
pgp_invoke(FILE **fp_pgp_in, FILE **fp_pgp_out, FILE **fp_pgp_err,
149 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
164 cctx.
signas = c_pgp_sign_as;
166 cctx.
signas = c_pgp_default_key;
173 fd_pgp_in, fd_pgp_out, fd_pgp_err,
EnvList);
201 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
202 const char *fname,
bool need_passphrase)
205 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out, fd_pgp_err,
206 need_passphrase, fname, NULL, NULL, c_pgp_decode_command);
226 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
227 const char *fname,
const char *sig_fname)
230 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
231 fd_pgp_err,
false, fname, sig_fname, NULL, c_pgp_verify_command);
250 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *fname)
253 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
254 fd_pgp_err,
true, fname, NULL, NULL, c_pgp_decrypt_command);
273 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *fname)
276 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
277 fd_pgp_err,
true, fname, NULL, NULL, c_pgp_sign_command);
298 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
299 const char *fname,
const char *uids,
bool sign)
304 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
305 fd_pgp_err,
true, fname, NULL, uids, c_pgp_encrypt_sign_command);
310 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
311 fd_pgp_err,
false, fname, NULL, uids, c_pgp_encrypt_only_command);
333 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
340 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
341 fd_pgp_err, (flags &
SEC_SIGN), fname, NULL, uids,
342 (flags &
SEC_SIGN) ? c_pgp_encrypt_sign_command : c_pgp_encrypt_only_command);
347 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
348 fd_pgp_err,
true, fname, NULL, NULL, c_pgp_clear_sign_command);
367 cctx.
signas = c_pgp_sign_as;
369 cctx.
signas = c_pgp_default_key;
385 struct Buffer *personal = NULL;
389 if (!c_pgp_get_keys_command)
409 int fd_null = open(
"/dev/null", O_RDWR);
443 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *uids)
446 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
447 fd_pgp_err,
false, NULL, NULL, uids, c_pgp_export_command);
466 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *uids)
469 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
470 fd_pgp_err,
false, NULL, NULL, uids, c_pgp_verify_key_command);
490 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
491 enum PgpRing keyring,
struct ListHead *hints)
507 pid_t rc =
pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in,
508 fd_pgp_out, fd_pgp_err, 0, NULL, NULL,
buf_string(uids),
509 (keyring ==
PGP_SECRING) ? c_pgp_list_secring_command :
510 c_pgp_list_pubring_command);
529 { -1, -1, NULL, NULL },
size_t mutt_addr_write(struct Buffer *buf, struct Address *addr, bool display)
Write a single Address to a buffer.
bool mutt_addr_to_local(struct Address *a)
Convert an Address from Punycode.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
@ ED_PGP_CMD
Pgp Command ED_PGC_ ExpandoDataPgpCmd.
int expando_render(const struct Expando *exp, const struct ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando + data into a string.
void buf_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
char ** EnvList
Private copy of the environment variables.
void pgp_class_invoke_getkeys(struct Address *addr)
Run a command to download a PGP key - Implements CryptModuleSpecs::pgp_invoke_getkeys() -.
void pgp_class_invoke_import(const char *fname)
Import a key from a message into the user's public key ring - Implements CryptModuleSpecs::pgp_invoke...
void pgp_command_r(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: key IDs - Implements ExpandoRenderData::get_string() -.
void pgp_command_s(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: Filename of signature - Implements ExpandoRenderData::get_string() -.
void pgp_command_a(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: $pgp_sign_as or $pgp_default_key - Implements ExpandoRenderData::get_string() -.
void pgp_command_p(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: PGPPASSFD=0 if passphrase is needed - Implements ExpandoRenderData::get_string() -.
void pgp_command_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: Filename of message - Implements ExpandoRenderData::get_string() -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
Convenience wrapper for the gui headers.
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
pid_t filter_create_fd(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err, int fdin, int fdout, int fderr, char **envlist)
Run a command on a pipe (optionally connect stdin/stdout)
Convenience wrapper for the library headers.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
#define SEC_ENCRYPT
Email is encrypted.
#define SEC_SIGN
Email is signed.
PGP sign, encrypt, check routines.
@ ED_PGC_KEY_IDS
PgpCommandContext.ids.
@ ED_PGC_FILE_SIGNATURE
PgpCommandContext.sig_fname.
@ ED_PGC_NEED_PASS
PgpCommandContext.need_passphrase.
@ ED_PGC_SIGN_AS
PgpCommandContext.signas.
@ ED_PGC_FILE_MESSAGE
PgpCommandContext.fname.
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.
pid_t pgp_invoke_encrypt(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 *fname, const char *uids, bool sign)
Use PGP to encrypt a file.
const struct ExpandoRenderData PgpCommandRenderData[]
Callbacks for PGP Command Expandos.
pid_t pgp_invoke_decode(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 *fname, bool need_passphrase)
Use PGP to decode a message.
pid_t pgp_invoke_traditional(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 *fname, const char *uids, SecurityFlags flags)
Use PGP to create in inline-signed message.
static pid_t pgp_invoke(FILE **fp_pgp_in, FILE **fp_pgp_out, FILE **fp_pgp_err, int fd_pgp_in, int fd_pgp_out, int fd_pgp_err, bool need_passphrase, const char *fname, const char *sig_fname, const char *ids, const struct Expando *exp)
Run a PGP command.
pid_t pgp_invoke_sign(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 *fname)
Use PGP to sign a file.
pid_t pgp_invoke_verify(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 *fname, const char *sig_fname)
Use PGP to verify a message.
pid_t pgp_invoke_export(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 export a key from the user's keyring.
static void mutt_pgp_command(struct Buffer *buf, struct PgpCommandContext *cctx, const struct Expando *exp)
Prepare a PGP Command.
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.
pid_t pgp_invoke_decrypt(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 *fname)
Use PGP to decrypt a file.
Wrapper around calls to external PGP program.
PGP key management routines.
@ PGP_SECRING
Secret keys.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Prototypes for many functions.
int mutt_system(const char *cmd)
Run an external command.
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_NEXT(elm, field)
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
struct Buffer * personal
Real name of address.
String manipulation buffer.
size_t dsize
Length of data.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.