Wrapper around calls to external PGP program. More...
#include "config.h"
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "pgpinvoke.h"
#include "lib.h"
#include "expando/lib.h"
#include "globals.h"
#include "mutt_logging.h"
#include "pgpkey.h"
#include "protos.h"
#include "pgp.h"
Go to the source code of this file.
Functions | |
void | pgp_command_a (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf) |
PGP Command: $pgp_sign_as or $pgp_default_key - Implements ExpandoRenderData::get_string() -. | |
void | pgp_command_f (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf) |
PGP Command: Filename of message - Implements ExpandoRenderData::get_string() -. | |
void | pgp_command_p (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf) |
PGP Command: PGPPASSFD=0 if passphrase is needed - Implements ExpandoRenderData::get_string() -. | |
void | pgp_command_r (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf) |
PGP Command: key IDs - Implements ExpandoRenderData::get_string() -. | |
void | pgp_command_s (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf) |
PGP Command: Filename of signature - Implements ExpandoRenderData::get_string() -. | |
static void | mutt_pgp_command (struct Buffer *buf, struct PgpCommandContext *cctx, const struct Expando *exp) |
Prepare a PGP Command. | |
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_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_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_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. | |
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_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_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. | |
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_import() -. | |
void | pgp_class_invoke_getkeys (struct Address *addr) |
Run a command to download a PGP key - Implements CryptModuleSpecs::pgp_invoke_getkeys() -. | |
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. | |
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_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. | |
Variables | |
const struct ExpandoRenderData | PgpCommandRenderData [] |
Callbacks for PGP Command Expandos. | |
Wrapper around calls to external PGP program.
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.c.
|
static |
Prepare a PGP Command.
Definition at line 122 of file pgpinvoke.c.
|
static |
Run a PGP command.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | need_passphrase | Is a passphrase needed? |
[in] | fname | Filename to pass to the command |
[in] | sig_fname | Signature filename to pass to the command |
[in] | ids | List of IDs/fingerprints, space separated |
[in] | exp | Expando format string |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 148 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | fname | Filename to pass to the command |
[in] | need_passphrase | Is a passphrase needed? |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 200 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | fname | Filename to pass to the command |
[in] | sig_fname | Signature filename to pass to the command |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 225 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | fname | Filename to pass to the command |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 249 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | fname | Filename to pass to the command |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 272 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | fname | Filename to pass to the command |
[in] | uids | List of IDs/fingerprints, space separated |
[in] | sign | If true, also sign the file |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 297 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | fname | Filename to pass to the command |
[in] | uids | List of IDs/fingerprints, space separated |
[in] | flags | Flags, see SecurityFlags |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 332 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | uids | List of IDs/fingerprints, space separated |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 442 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | uids | List of IDs/fingerprints, space separated |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 465 of file pgpinvoke.c.
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.
[out] | fp_pgp_in | stdin for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_out | stdout for the command, or NULL (OPTIONAL) |
[out] | fp_pgp_err | stderr for the command, or NULL (OPTIONAL) |
[in] | fd_pgp_in | stdin for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_out | stdout for the command, or -1 (OPTIONAL) |
[in] | fd_pgp_err | stderr for the command, or -1 (OPTIONAL) |
[in] | keyring | Keyring type, e.g. PGP_SECRING |
[in] | hints | Match keys to these strings |
num | PID of the created process |
-1 | Error creating pipes or forking |
fp_pgp_in
has priority over fd_pgp_in
. Likewise fp_pgp_out
and fp_pgp_err
. Definition at line 489 of file pgpinvoke.c.
const struct ExpandoRenderData PgpCommandRenderData |
Callbacks for PGP Command Expandos.
Definition at line 54 of file pgpinvoke.c.