NeoMutt  2024-04-25-34-g585158
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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
85{
86 size_t num;
87 struct CryptKeyInfo *key;
88};
89
90void pgp_gpgme_set_sender (const char *sender);
91
92int pgp_gpgme_application_handler (struct Body *b, struct State *state);
93bool pgp_gpgme_check_traditional (FILE *fp, struct Body *b, bool just_one);
94int pgp_gpgme_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec);
95int pgp_gpgme_encrypted_handler (struct Body *b, struct State *state);
96struct Body * pgp_gpgme_encrypt_message (struct Body *b, char *keylist, bool sign, const struct AddressList *from);
97char * pgp_gpgme_find_keys (const struct AddressList *addrlist, bool oppenc_mode);
98void pgp_gpgme_invoke_import (const char *fname);
101struct Body * pgp_gpgme_sign_message (struct Body *b, const struct AddressList *from);
102int pgp_gpgme_verify_one (struct Body *b, struct State *state, const char *tempfile);
103
104int smime_gpgme_application_handler(struct Body *b, struct State *state);
105struct Body * smime_gpgme_build_smime_entity (struct Body *b, char *keylist);
106int smime_gpgme_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec);
107char * smime_gpgme_find_keys (const struct AddressList *addrlist, bool oppenc_mode);
108void smime_gpgme_init (void);
110struct Body * smime_gpgme_sign_message (struct Body *b, const struct AddressList *from);
111int smime_gpgme_verify_one (struct Body *b, struct State *state, const char *tempfile);
112int smime_gpgme_verify_sender (struct Email *e, struct Message *msg);
113
114gpgme_ctx_t create_gpgme_context (bool for_smime);
115struct CryptKeyInfo *crypt_copy_key (struct CryptKeyInfo *key);
116const char * crypt_fpr_or_lkeyid (struct CryptKeyInfo *k);
117bool crypt_id_is_strong (struct CryptKeyInfo *key);
118int crypt_id_is_valid (struct CryptKeyInfo *key);
119const char * crypt_keyid (struct CryptKeyInfo *k);
120int digit (const char *s);
121unsigned int key_check_cap (gpgme_key_t key, enum KeyCap cap);
122
123#endif /* MUTT_NCRYPT_CRYPT_GPGME_H */
struct CryptKeyInfo * crypt_copy_key(struct CryptKeyInfo *key)
Return a copy of KEY.
Definition: crypt_gpgme.c:234
int crypt_id_is_valid(struct CryptKeyInfo *key)
Is key ID valid.
Definition: crypt_gpgme.c:310
gpgme_ctx_t create_gpgme_context(bool for_smime)
Create a new GPGME context.
Definition: crypt_gpgme.c:361
bool crypt_id_is_strong(struct CryptKeyInfo *key)
Is the key strong.
Definition: crypt_gpgme.c:275
const char * crypt_fpr_or_lkeyid(struct CryptKeyInfo *k)
Find the fingerprint of a key.
Definition: crypt_gpgme.c:214
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:2904
const char * crypt_keyid(struct CryptKeyInfo *k)
Find the ID for the key.
Definition: crypt_gpgme.c:138
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 *b, struct State *state)
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::applicat...
Definition: crypt_gpgme.c:2431
int smime_gpgme_application_handler(struct Body *b, struct State *state)
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::applicat...
Definition: crypt_gpgme.c:2812
int smime_gpgme_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Decrypt an encrypted MIME part - Implements CryptModuleSpecs::decrypt_mime() -.
Definition: crypt_gpgme.c:1954
int pgp_gpgme_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Decrypt an encrypted MIME part - Implements CryptModuleSpecs::decrypt_mime() -.
Definition: crypt_gpgme.c:1857
int pgp_gpgme_encrypted_handler(struct Body *b, struct State *state)
Manage a PGP or S/MIME encrypted MIME part - Implements CryptModuleSpecs::encrypted_handler() -.
Definition: crypt_gpgme.c:2722
char * smime_gpgme_find_keys(const struct AddressList *addrlist, bool oppenc_mode)
Find the keyids of the recipients of a message - Implements CryptModuleSpecs::find_keys() -.
Definition: crypt_gpgme.c:3623
char * pgp_gpgme_find_keys(const struct AddressList *addrlist, bool oppenc_mode)
Find the keyids of the recipients of a message - Implements CryptModuleSpecs::find_keys() -.
Definition: crypt_gpgme.c:3615
void smime_gpgme_init(void)
Initialise the crypto module - Implements CryptModuleSpecs::init() -.
Definition: crypt_gpgme.c:3830
bool pgp_gpgme_check_traditional(FILE *fp, struct Body *b, bool just_one)
Look for inline (non-MIME) PGP content - Implements CryptModuleSpecs::pgp_check_traditional() -.
Definition: crypt_gpgme.c:2239
struct Body * pgp_gpgme_encrypt_message(struct Body *b, char *keylist, bool sign, const struct AddressList *from)
PGP encrypt an email - Implements CryptModuleSpecs::pgp_encrypt_message() -.
Definition: crypt_gpgme.c:1043
void pgp_gpgme_invoke_import(const char *fname)
Import a key from a message into the user's public key ring - Implements CryptModuleSpecs::pgp_invoke...
Definition: crypt_gpgme.c:2266
struct Body * pgp_gpgme_make_key_attachment(void)
Generate a public key attachment - Implements CryptModuleSpecs::pgp_make_key_attachment() -.
Definition: crypt_gpgme.c:3722
SecurityFlags pgp_gpgme_send_menu(struct Email *e)
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -.
Definition: crypt_gpgme.c:4003
SecurityFlags smime_gpgme_send_menu(struct Email *e)
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -.
Definition: crypt_gpgme.c:4011
void pgp_gpgme_set_sender(const char *sender)
Set the sender of the email - Implements CryptModuleSpecs::set_sender() -.
Definition: crypt_gpgme.c:4108
struct Body * smime_gpgme_sign_message(struct Body *b, const struct AddressList *from)
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -.
Definition: crypt_gpgme.c:1035
struct Body * pgp_gpgme_sign_message(struct Body *b, const struct AddressList *from)
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -.
Definition: crypt_gpgme.c:1027
struct Body * smime_gpgme_build_smime_entity(struct Body *b, char *keylist)
Encrypt the email body to all recipients - Implements CryptModuleSpecs::smime_build_smime_entity() -.
Definition: crypt_gpgme.c:1089
int smime_gpgme_verify_sender(struct Email *e, struct Message *msg)
Does the sender match the certificate? - Implements CryptModuleSpecs::smime_verify_sender() -.
Definition: crypt_gpgme.c:4100
int pgp_gpgme_verify_one(struct Body *b, struct State *state, const char *tempfile)
Check a signed MIME part against a signature - Implements CryptModuleSpecs::verify_one() -.
Definition: crypt_gpgme.c:1672
int smime_gpgme_verify_one(struct Body *b, struct State *state, const char *tempfile)
Check a signed MIME part against a signature - Implements CryptModuleSpecs::verify_one() -.
Definition: crypt_gpgme.c:1680
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
An entry in the Select-Key menu.
Definition: crypt_gpgme.h:85
struct CryptKeyInfo * key
Key.
Definition: crypt_gpgme.h:87
size_t num
Index number.
Definition: crypt_gpgme.h:86
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:39
A local copy of an email.
Definition: message.h:34
Keep track when processing files.
Definition: state.h:48