NeoMutt  2020-08-07-1-gab41a1
Teaching an old dog new tricks
DOXYGEN
pgpinvoke.h File Reference

Wrapper around calls to external PGP program. More...

#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include "ncrypt/lib.h"
#include "pgpkey.h"
+ Include dependency graph for pgpinvoke.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void pgp_class_invoke_import (const char *fname)
 Implements CryptModuleSpecs::pgp_invoke_import() More...
 
void pgp_class_invoke_getkeys (struct Address *addr)
 Implements CryptModuleSpecs::pgp_invoke_getkeys() More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Wrapper around calls to external PGP program.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file pgpinvoke.h.

Function Documentation

◆ pgp_class_invoke_import()

void pgp_class_invoke_import ( const char *  fname)

Implements CryptModuleSpecs::pgp_invoke_import()

Definition at line 392 of file pgpinvoke.c.

393 {
394  char cmd[STR_COMMAND];
395  struct PgpCommandContext cctx = { 0 };
396 
397  struct Buffer *buf_fname = mutt_buffer_pool_get();
398 
399  mutt_buffer_quote_filename(buf_fname, fname, true);
400  cctx.fname = mutt_b2s(buf_fname);
401  if (C_PgpSignAs)
402  cctx.signas = C_PgpSignAs;
403  else
404  cctx.signas = C_PgpDefaultKey;
405 
406  mutt_pgp_command(cmd, sizeof(cmd), &cctx, C_PgpImportCommand);
407  if (mutt_system(cmd) != 0)
408  mutt_debug(LL_DEBUG1, "Error running \"%s\"", cmd);
409 
410  mutt_buffer_pool_release(&buf_fname);
411 }
void mutt_buffer_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell&#39;s quoting rules.
Definition: file.c:836
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
String manipulation buffer.
Definition: buffer.h:33
const char * signas
a
Definition: pgpinvoke.c:62
const char * fname
f
Definition: pgpinvoke.c:60
char * C_PgpSignAs
Config: Use this alternative key for signing messages.
Definition: config.c:52
char * C_PgpDefaultKey
Config: Default key to use for PGP operations.
Definition: config.c:51
#define mutt_b2s(buf)
Definition: buffer.h:41
static void mutt_pgp_command(char *buf, size_t buflen, struct PgpCommandContext *cctx, const char *fmt)
Prepare a PGP Command.
Definition: pgpinvoke.c:171
#define STR_COMMAND
Enough space for a long command line.
Definition: string2.h:35
Log at debug level 1.
Definition: logging.h:40
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
Data for a PGP command.
Definition: pgpinvoke.c:57
char * C_PgpImportCommand
Config: (pgp) External command to import a key into the user&#39;s keyring.
Definition: config.c:83
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_class_invoke_getkeys()

void pgp_class_invoke_getkeys ( struct Address addr)

Implements CryptModuleSpecs::pgp_invoke_getkeys()

Definition at line 416 of file pgpinvoke.c.

417 {
418  char tmp[1024];
419  char cmd[STR_COMMAND];
420 
421  char *personal = NULL;
422 
423  struct PgpCommandContext cctx = { 0 };
424 
425  if (!C_PgpGetkeysCommand)
426  return;
427 
428  struct Buffer *buf = mutt_buffer_pool_get();
429  personal = addr->personal;
430  addr->personal = NULL;
431 
432  *tmp = '\0';
433  mutt_addr_to_local(addr);
434  mutt_addr_write(tmp, sizeof(tmp), addr, false);
435  mutt_buffer_quote_filename(buf, tmp, true);
436 
437  addr->personal = personal;
438 
439  cctx.ids = mutt_b2s(buf);
440 
441  mutt_pgp_command(cmd, sizeof(cmd), &cctx, C_PgpGetkeysCommand);
442 
443  int fd_null = open("/dev/null", O_RDWR);
444 
445  if (!isendwin())
446  mutt_message(_("Fetching PGP key..."));
447 
448  if (mutt_system(cmd) != 0)
449  mutt_debug(LL_DEBUG1, "Error running \"%s\"", cmd);
450 
451  if (!isendwin())
453 
454  if (fd_null >= 0)
455  close(fd_null);
456 
458 }
void mutt_buffer_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell&#39;s quoting rules.
Definition: file.c:836
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
#define mutt_message(...)
Definition: logging.h:83
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
String manipulation buffer.
Definition: buffer.h:33
#define _(a)
Definition: message.h:28
char * C_PgpGetkeysCommand
Config: (pgp) External command to download a key for an email address.
Definition: config.c:82
bool mutt_addr_to_local(struct Address *a)
Convert an Address from Punycode.
Definition: address.c:1349
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool display)
Write a single Address to a buffer.
Definition: address.c:1025
#define mutt_b2s(buf)
Definition: buffer.h:41
static void mutt_pgp_command(char *buf, size_t buflen, struct PgpCommandContext *cctx, const char *fmt)
Prepare a PGP Command.
Definition: pgpinvoke.c:171
#define STR_COMMAND
Enough space for a long command line.
Definition: string2.h:35
char * personal
Real name of address.
Definition: address.h:36
Log at debug level 1.
Definition: logging.h:40
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
const char * ids
r
Definition: pgpinvoke.c:63
Data for a PGP command.
Definition: pgpinvoke.c:57
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_decode()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]fnameFilename to pass to the command
[in]need_passphraseIs a passphrase needed?
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 246 of file pgpinvoke.c.

249 {
250  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out, fd_pgp_err,
251  need_passphrase, fname, NULL, NULL, C_PgpDecodeCommand);
252 }
char * C_PgpDecodeCommand
Config: (pgp) External command to decode a PGP attachment.
Definition: config.c:77
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_decrypt()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]fnameFilename to pass to the command
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 293 of file pgpinvoke.c.

295 {
296  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
297  fd_pgp_err, true, fname, NULL, NULL, C_PgpDecryptCommand);
298 }
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
char * C_PgpDecryptCommand
Config: (pgp) External command to decrypt a PGP message.
Definition: config.c:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_encrypt()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]fnameFilename to pass to the command
[in]uidsList of IDs/fingerprints, space separated
[in]signIf true, also sign the file
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 339 of file pgpinvoke.c.

342 {
343  if (sign)
344  {
345  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
346  fd_pgp_err, true, fname, NULL, uids, C_PgpEncryptSignCommand);
347  }
348  else
349  {
350  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
351  fd_pgp_err, false, fname, NULL, uids, C_PgpEncryptOnlyCommand);
352  }
353 }
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
char * C_PgpEncryptSignCommand
Config: (pgp) External command to encrypt and sign a message.
Definition: config.c:80
char * C_PgpEncryptOnlyCommand
Config: (pgp) External command to encrypt, but not sign a message.
Definition: config.c:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_export()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]uidsList of IDs/fingerprints, space separated
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 475 of file pgpinvoke.c.

477 {
478  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
479  fd_pgp_err, false, NULL, NULL, uids, C_PgpExportCommand);
480 }
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
char * C_PgpExportCommand
Config: (pgp) External command to export a public key from the user&#39;s keyring.
Definition: config.c:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_list_keys()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]keyringKeyring type, e.g. PGP_SECRING
[in]hintsMatch keys to these strings
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 520 of file pgpinvoke.c.

523 {
524  struct Buffer *uids = mutt_buffer_pool_get();
525  struct Buffer *quoted = mutt_buffer_pool_get();
526 
527  struct ListNode *np = NULL;
528  STAILQ_FOREACH(np, hints, entries)
529  {
530  mutt_buffer_quote_filename(quoted, (char *) np->data, true);
531  mutt_buffer_addstr(uids, mutt_b2s(quoted));
532  if (STAILQ_NEXT(np, entries))
533  mutt_buffer_addch(uids, ' ');
534  }
535 
536  pid_t rc = pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in,
537  fd_pgp_out, fd_pgp_err, 0, NULL, NULL, mutt_b2s(uids),
538  (keyring == PGP_SECRING) ? C_PgpListSecringCommand :
540 
542  mutt_buffer_pool_release(&quoted);
543  return rc;
544 }
void mutt_buffer_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell&#39;s quoting rules.
Definition: file.c:836
Secret keys.
Definition: pgpkey.h:40
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
String manipulation buffer.
Definition: buffer.h:33
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
#define mutt_b2s(buf)
Definition: buffer.h:41
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:240
#define STAILQ_NEXT(elm, field)
Definition: queue.h:397
char * C_PgpListPubringCommand
Config: (pgp) External command to list the public keys in a user&#39;s keyring.
Definition: config.c:84
char * data
String.
Definition: list.h:36
A List node for strings.
Definition: list.h:34
char * C_PgpListSecringCommand
Config: (pgp) External command to list the private keys in a user&#39;s keyring.
Definition: config.c:85
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_sign()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]fnameFilename to pass to the command
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 315 of file pgpinvoke.c.

317 {
318  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
319  fd_pgp_err, true, fname, NULL, NULL, C_PgpSignCommand);
320 }
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
char * C_PgpSignCommand
Config: (pgp) External command to create a detached PGP signature.
Definition: config.c:86
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_traditional()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]fnameFilename to pass to the command
[in]uidsList of IDs/fingerprints, space separated
[in]flagsFlags, see SecurityFlags
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 372 of file pgpinvoke.c.

375 {
376  if (flags & SEC_ENCRYPT)
377  {
378  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
379  fd_pgp_err, (flags & SEC_SIGN), fname, NULL, uids,
380  (flags & SEC_SIGN) ? C_PgpEncryptSignCommand : C_PgpEncryptOnlyCommand);
381  }
382  else
383  {
384  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
385  fd_pgp_err, true, fname, NULL, NULL, C_PgpClearsignCommand);
386  }
387 }
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:85
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
char * C_PgpEncryptSignCommand
Config: (pgp) External command to encrypt and sign a message.
Definition: config.c:80
char * C_PgpEncryptOnlyCommand
Config: (pgp) External command to encrypt, but not sign a message.
Definition: config.c:79
char * C_PgpClearsignCommand
Config: (pgp) External command to inline-sign a message.
Definition: config.c:76
#define SEC_SIGN
Email is signed.
Definition: lib.h:86
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_verify()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]fnameFilename to pass to the command
[in]sig_fnameSignature filename to pass to the command
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 270 of file pgpinvoke.c.

273 {
274  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
275  fd_pgp_err, false, fname, sig_fname, NULL, C_PgpVerifyCommand);
276 }
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
char * C_PgpVerifyCommand
Config: (pgp) External command to verify PGP signatures.
Definition: config.c:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_invoke_verify_key()

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.

Parameters
[out]fp_pgp_instdin for the command, or NULL (OPTIONAL)
[out]fp_pgp_outstdout for the command, or NULL (OPTIONAL)
[out]fp_pgp_errstderr for the command, or NULL (OPTIONAL)
[in]fd_pgp_instdin for the command, or -1 (OPTIONAL)
[in]fd_pgp_outstdout for the command, or -1 (OPTIONAL)
[in]fd_pgp_errstderr for the command, or -1 (OPTIONAL)
[in]uidsList of IDs/fingerprints, space separated
Return values
numPID of the created process
-1Error creating pipes or forking
Note
fp_pgp_in has priority over fd_pgp_in. Likewise fp_pgp_out and fp_pgp_err.

Definition at line 497 of file pgpinvoke.c.

499 {
500  return pgp_invoke(fp_pgp_in, fp_pgp_out, fp_pgp_err, fd_pgp_in, fd_pgp_out,
501  fd_pgp_err, false, NULL, NULL, uids, C_PgpVerifyKeyCommand);
502 }
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 char *format)
Run a PGP command.
Definition: pgpinvoke.c:198
char * C_PgpVerifyKeyCommand
Config: (pgp) External command to verify key information.
Definition: config.c:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function: