NeoMutt  2023-03-22-27-g3cb248
Teaching an old dog new tricks
DOXYGEN
crypt_gpgme.h
Go to the documentation of this file.
1
24#ifndef MUTT_NCRYPT_CRYPT_GPGME_H
25#define MUTT_NCRYPT_CRYPT_GPGME_H
26
27#include <gpgme.h>
28#include <stdbool.h>
29#include <stdio.h>
30#include "lib.h"
31
32struct AddressList;
33struct Body;
34struct Email;
35struct Message;
36struct State;
37
38/* We work based on user IDs, getting from a user ID to the key is
39 * check and does not need any memory (GPGME uses reference counting). */
44{
46 gpgme_key_t kobj;
47 int idx;
48 const char *uid;
50 gpgme_validity_t validity;
51};
52
57{
69};
70
75{
79};
80
81void pgp_gpgme_set_sender (const char *sender);
82
83int pgp_gpgme_application_handler (struct Body *m, struct State *state);
84bool pgp_gpgme_check_traditional (FILE *fp, struct Body *b, bool just_one);
85int pgp_gpgme_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur);
86int pgp_gpgme_encrypted_handler (struct Body *a, struct State *state);
87struct Body * pgp_gpgme_encrypt_message (struct Body *a, char *keylist, bool sign, const struct AddressList *from);
88char * pgp_gpgme_find_keys (const struct AddressList *addrlist, bool oppenc_mode);
89void pgp_gpgme_invoke_import (const char *fname);
92struct Body * pgp_gpgme_sign_message (struct Body *a, const struct AddressList *from);
93int pgp_gpgme_verify_one (struct Body *sigbdy, struct State *state, const char *tempfile);
94
95int smime_gpgme_application_handler(struct Body *a, struct State *state);
96struct Body * smime_gpgme_build_smime_entity (struct Body *a, char *keylist);
97int smime_gpgme_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur);
98char * smime_gpgme_find_keys (const struct AddressList *addrlist, bool oppenc_mode);
99void smime_gpgme_init (void);
101struct Body * smime_gpgme_sign_message (struct Body *a, const struct AddressList *from);
102int smime_gpgme_verify_one (struct Body *sigbdy, struct State *state, const char *tempfile);
103int smime_gpgme_verify_sender (struct Email *e, struct Message *msg);
104
105gpgme_ctx_t create_gpgme_context (bool for_smime);
106struct CryptKeyInfo *crypt_copy_key (struct CryptKeyInfo *key);
107const char * crypt_fpr_or_lkeyid (struct CryptKeyInfo *k);
108bool crypt_id_is_strong (struct CryptKeyInfo *key);
109int crypt_id_is_valid (struct CryptKeyInfo *key);
110const char * crypt_keyid (struct CryptKeyInfo *k);
111int digit (const char *s);
112unsigned int key_check_cap (gpgme_key_t key, enum KeyCap cap);
113
114#endif /* MUTT_NCRYPT_CRYPT_GPGME_H */
struct CryptKeyInfo * crypt_copy_key(struct CryptKeyInfo *key)
Return a copy of KEY.
Definition: crypt_gpgme.c:229
int crypt_id_is_valid(struct CryptKeyInfo *key)
Is key ID valid.
Definition: crypt_gpgme.c:305
gpgme_ctx_t create_gpgme_context(bool for_smime)
Create a new GPGME context.
Definition: crypt_gpgme.c:357
bool crypt_id_is_strong(struct CryptKeyInfo *key)
Is the key strong.
Definition: crypt_gpgme.c:270
const char * crypt_fpr_or_lkeyid(struct CryptKeyInfo *k)
Find the fingerprint of a key.
Definition: crypt_gpgme.c:209
KeyInfo
PGP Key info.
Definition: crypt_gpgme.h:57
@ KIP_FINGERPRINT
PGP Key field: Fingerprint.
Definition: crypt_gpgme.h:64
@ KIP_SERIAL_NO
PGP Key field: Serial number.
Definition: crypt_gpgme.h:65
@ KIP_SUBKEY
PGP Key field: Subkey.
Definition: crypt_gpgme.h:67
@ KIP_AKA
PGP Key field: aka (Also Known As)
Definition: crypt_gpgme.h:59
@ KIP_VALID_FROM
PGP Key field: Valid From date.
Definition: crypt_gpgme.h:60
@ KIP_MAX
Definition: crypt_gpgme.h:68
@ KIP_KEY_TYPE
PGP Key field: Key Type.
Definition: crypt_gpgme.h:62
@ KIP_NAME
PGP Key field: Name.
Definition: crypt_gpgme.h:58
@ KIP_ISSUED_BY
PGP Key field: Issued By.
Definition: crypt_gpgme.h:66
@ KIP_KEY_USAGE
PGP Key field: Key Usage.
Definition: crypt_gpgme.h:63
@ KIP_VALID_TO
PGP Key field: Valid To date.
Definition: crypt_gpgme.h:61
int digit(const char *s)
unsigned int key_check_cap(gpgme_key_t key, enum KeyCap cap)
Check the capabilities of a key.
Definition: crypt_gpgme.c:2851
const char * crypt_keyid(struct CryptKeyInfo *k)
Find the ID for the key.
Definition: crypt_gpgme.c:133
KeyCap
PGP/SMIME Key Capabilities.
Definition: crypt_gpgme.h:75
@ KEY_CAP_CAN_CERTIFY
Key can be used to certify.
Definition: crypt_gpgme.h:78
@ KEY_CAP_CAN_ENCRYPT
Key can be used for encryption.
Definition: crypt_gpgme.h:76
@ KEY_CAP_CAN_SIGN
Key can be used for signing.
Definition: crypt_gpgme.h:77
int pgp_gpgme_application_handler(struct Body *m, struct State *state)
Implements CryptModuleSpecs::application_handler() -.
Definition: crypt_gpgme.c:2427
int smime_gpgme_application_handler(struct Body *a, struct State *state)
Implements CryptModuleSpecs::application_handler() -.
Definition: crypt_gpgme.c:2756
int pgp_gpgme_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Implements CryptModuleSpecs::decrypt_mime() -.
Definition: crypt_gpgme.c:1851
int smime_gpgme_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Implements CryptModuleSpecs::decrypt_mime() -.
Definition: crypt_gpgme.c:1948
int pgp_gpgme_encrypted_handler(struct Body *a, struct State *state)
Implements CryptModuleSpecs::encrypted_handler() -.
Definition: crypt_gpgme.c:2663
char * smime_gpgme_find_keys(const struct AddressList *addrlist, bool oppenc_mode)
Implements CryptModuleSpecs::find_keys() -.
Definition: crypt_gpgme.c:3551
char * pgp_gpgme_find_keys(const struct AddressList *addrlist, bool oppenc_mode)
Implements CryptModuleSpecs::find_keys() -.
Definition: crypt_gpgme.c:3543
void smime_gpgme_init(void)
Implements CryptModuleSpecs::init() -.
Definition: crypt_gpgme.c:3759
bool pgp_gpgme_check_traditional(FILE *fp, struct Body *b, bool just_one)
Implements CryptModuleSpecs::pgp_check_traditional() -.
Definition: crypt_gpgme.c:2234
struct Body * pgp_gpgme_encrypt_message(struct Body *a, char *keylist, bool sign, const struct AddressList *from)
Implements CryptModuleSpecs::pgp_encrypt_message() -.
Definition: crypt_gpgme.c:1034
void pgp_gpgme_invoke_import(const char *fname)
Implements CryptModuleSpecs::pgp_invoke_import() -.
Definition: crypt_gpgme.c:2261
struct Body * pgp_gpgme_make_key_attachment(void)
Implements CryptModuleSpecs::pgp_make_key_attachment() -.
Definition: crypt_gpgme.c:3650
SecurityFlags pgp_gpgme_send_menu(struct Email *e)
Implements CryptModuleSpecs::send_menu() -.
Definition: crypt_gpgme.c:3932
SecurityFlags smime_gpgme_send_menu(struct Email *e)
Implements CryptModuleSpecs::send_menu() -.
Definition: crypt_gpgme.c:3940
void pgp_gpgme_set_sender(const char *sender)
Implements CryptModuleSpecs::set_sender() -.
Definition: crypt_gpgme.c:4037
struct Body * smime_gpgme_sign_message(struct Body *a, const struct AddressList *from)
Implements CryptModuleSpecs::sign_message() -.
Definition: crypt_gpgme.c:1026
struct Body * pgp_gpgme_sign_message(struct Body *a, const struct AddressList *from)
Implements CryptModuleSpecs::sign_message() -.
Definition: crypt_gpgme.c:1018
struct Body * smime_gpgme_build_smime_entity(struct Body *a, char *keylist)
Implements CryptModuleSpecs::smime_build_smime_entity() -.
Definition: crypt_gpgme.c:1080
int smime_gpgme_verify_sender(struct Email *e, struct Message *msg)
Implements CryptModuleSpecs::smime_verify_sender() -.
Definition: crypt_gpgme.c:4029
int smime_gpgme_verify_one(struct Body *sigbdy, struct State *state, const char *tempfile)
Implements CryptModuleSpecs::verify_one() -.
Definition: crypt_gpgme.c:1673
int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *state, const char *tempfile)
Implements CryptModuleSpecs::verify_one() -.
Definition: crypt_gpgme.c:1665
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
Definition: lib.h:76
uint16_t KeyFlags
Flags describing PGP/SMIME keys, e.g. KEYFLAG_CANSIGN.
Definition: lib.h:125
Key value store.
The body of an email.
Definition: body.h:36
A stored PGP key.
Definition: crypt_gpgme.h:44
gpgme_validity_t validity
uid validity (cached for convenience)
Definition: crypt_gpgme.h:50
KeyFlags flags
global and per uid flags (for convenience)
Definition: crypt_gpgme.h:49
int idx
and the user ID at this index
Definition: crypt_gpgme.h:47
struct CryptKeyInfo * next
Linked list.
Definition: crypt_gpgme.h:45
const char * uid
and for convenience point to this user ID
Definition: crypt_gpgme.h:48
gpgme_key_t kobj
Definition: crypt_gpgme.h:46
The envelope/body of an email.
Definition: email.h:37
A local copy of an email.
Definition: mxapi.h:43
Keep track when processing files.
Definition: state.h:47