51#ifdef CRYPT_BACKEND_CLASSIC_PGP
87static pid_t
pgp_invoke(FILE **fp_pgp_in, FILE **fp_pgp_out, FILE **fp_pgp_err,
88 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
89 bool need_passphrase,
const char *fname,
const char *sig_fname,
90 const char *ids,
const struct Expando *exp)
103 cctx.
signas = c_pgp_sign_as;
105 cctx.
signas = c_pgp_default_key;
112 fd_pgp_in, fd_pgp_out, fd_pgp_err,
EnvList);
134 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
135 const char *fname,
bool need_passphrase)
138 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out, fd_pgp_err,
139 need_passphrase, fname, NULL, NULL, c_pgp_decode_command);
159 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
160 const char *fname,
const char *sig_fname)
163 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
164 fd_pgp_err,
false, fname, sig_fname, NULL, c_pgp_verify_command);
183 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *fname)
186 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
187 fd_pgp_err,
true, fname, NULL, NULL, c_pgp_decrypt_command);
206 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *fname)
209 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
210 fd_pgp_err,
true, fname, NULL, NULL, c_pgp_sign_command);
231 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
232 const char *fname,
const char *uids,
bool sign)
237 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
238 fd_pgp_err,
true, fname, NULL, uids, c_pgp_encrypt_sign_command);
243 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
244 fd_pgp_err,
false, fname, NULL, uids, c_pgp_encrypt_only_command);
266 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
273 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
274 fd_pgp_err, (flags &
SEC_SIGN), fname, NULL, uids,
275 (flags &
SEC_SIGN) ? c_pgp_encrypt_sign_command : c_pgp_encrypt_only_command);
280 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
281 fd_pgp_err,
true, fname, NULL, NULL, c_pgp_clear_sign_command);
300 cctx.
signas = c_pgp_sign_as;
302 cctx.
signas = c_pgp_default_key;
318 struct Buffer *personal = NULL;
322 if (!c_pgp_get_keys_command)
342 int fd_null = open(
"/dev/null", O_RDWR);
376 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *uids)
379 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
380 fd_pgp_err,
false, NULL, NULL, uids, c_pgp_export_command);
399 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
const char *uids)
402 return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
403 fd_pgp_err,
false, NULL, NULL, uids, c_pgp_verify_key_command);
423 int fd_pgp_in,
int fd_pgp_out,
int fd_pgp_err,
424 enum PgpRing keyring,
struct ListHead *hints)
440 pid_t rc =
pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in,
441 fd_pgp_out, fd_pgp_err, 0, NULL, NULL,
buf_string(uids),
442 (keyring ==
PGP_SECRING) ? c_pgp_list_secring_command :
443 c_pgp_list_pubring_command);
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.
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.
int expando_render(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando + data into a string.
const struct ExpandoRenderCallback PgpCommandRenderCallbacks[]
Callbacks for PGP Command Expandos.
Ncrypt PGP Expando definitions.
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...
#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.
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.
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.
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.