NeoMutt  2025-09-05-43-g177ed6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Crypto API

The Crypto API. More...

+ Collaboration diagram for Crypto API:

Topics

 init()
 Initialise the crypto module.
 
 cleanup()
 Clean up the crypt module.
 
 void_passphrase()
 Forget the cached passphrase.
 
 valid_passphrase()
 Ensure we have a valid passphrase.
 
 decrypt_mime()
 Decrypt an encrypted MIME part.
 
 application_handler()
 Manage the MIME type "application/pgp" or "application/smime".
 
 encrypted_handler()
 Manage a PGP or S/MIME encrypted MIME part.
 
 find_keys()
 Find the keyids of the recipients of a message.
 
 sign_message()
 Cryptographically sign the Body of a message.
 
 verify_one()
 Check a signed MIME part against a signature.
 
 send_menu()
 Ask the user whether to sign and/or encrypt the email.
 
 set_sender()
 Set the sender of the email.
 
 pgp_encrypt_message()
 PGP encrypt an email.
 
 pgp_make_key_attachment()
 Generate a public key attachment.
 
 pgp_check_traditional()
 Look for inline (non-MIME) PGP content.
 
 pgp_traditional_encryptsign()
 Create an inline PGP encrypted, signed email.
 
 pgp_invoke_getkeys()
 Run a command to download a PGP key.
 
 pgp_invoke_import()
 Import a key from a message into the user's public key ring.
 
 pgp_extract_key_from_attachment()
 Extract PGP key from an attachment.
 
 smime_getkeys()
 Get the S/MIME keys required to encrypt this email.
 
 smime_verify_sender()
 Does the sender match the certificate?
 
 smime_build_smime_entity()
 Encrypt the email body to all recipients.
 
 smime_invoke_import()
 Add a certificate and update index file (externally)
 

Variables

const struct CryptModuleSpecs CryptModPgpClassic
 CLI PGP - Implements CryptModuleSpecs -.
 
const struct CryptModuleSpecs CryptModPgpGpgme
 GPGME PGP - Implements CryptModuleSpecs -.
 
const struct CryptModuleSpecs CryptModSmimeClassic
 CLI SMIME - Implements CryptModuleSpecs -.
 
const struct CryptModuleSpecs CryptModSmimeGpgme
 GPGME SMIME - Implements CryptModuleSpecs -.
 

Detailed Description

The Crypto API.

A structure to describe a crypto module.

Variable Documentation

◆ CryptModPgpClassic

const struct CryptModuleSpecs CryptModPgpClassic

CLI PGP - Implements CryptModuleSpecs -.

Definition at line 42 of file crypt_mod_pgp_classic.c.

42 {
43 // clang-format off
45
46 NULL, /* init */
47 NULL, /* cleanup */
57 NULL, /* set_sender */
58
66
67 NULL, /* smime_getkeys */
68 NULL, /* smime_verify_sender */
69 NULL, /* smime_build_smime_entity */
70 NULL, /* smime_invoke_import */
71 // clang-format on
72};
int pgp_class_application_handler(struct Body *b, struct State *state)
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::applicat...
Definition pgp.c:472
int pgp_class_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 pgp.c:1162
int pgp_class_encrypted_handler(struct Body *b, struct State *state)
Manage a PGP or S/MIME encrypted MIME part - Implements CryptModuleSpecs::encrypted_handler() -.
Definition pgp.c:1247
char * pgp_class_find_keys(const struct AddressList *addrlist, bool oppenc_mode)
Find the keyids of the recipients of a message - Implements CryptModuleSpecs::find_keys() -.
Definition pgp.c:1463
bool pgp_class_check_traditional(FILE *fp, struct Body *b, bool just_one)
Look for inline (non-MIME) PGP content - Implements CryptModuleSpecs::pgp_check_traditional() -.
Definition pgp.c:869
struct Body * pgp_class_encrypt_message(struct Body *b, char *keylist, bool sign, const struct AddressList *from)
PGP encrypt an email - Implements CryptModuleSpecs::pgp_encrypt_message() -.
Definition pgp.c:1587
void pgp_class_extract_key_from_attachment(FILE *fp, struct Body *b)
Extract PGP key from an attachment - Implements CryptModuleSpecs::pgp_extract_key_from_attachment() -...
Definition pgp.c:1003
void pgp_class_invoke_getkeys(struct Address *addr)
Run a command to download a PGP key - Implements CryptModuleSpecs::pgp_invoke_getkeys() -.
Definition pgpinvoke.c:315
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...
Definition pgpinvoke.c:287
struct Body * pgp_class_make_key_attachment(void)
Generate a public key attachment - Implements CryptModuleSpecs::pgp_make_key_attachment() -.
Definition pgpkey.c:259
struct Body * pgp_class_traditional_encryptsign(struct Body *b, SecurityFlags flags, char *keylist)
Create an inline PGP encrypted, signed email - Implements CryptModuleSpecs::pgp_traditional_encryptsi...
Definition pgp.c:1721
SecurityFlags pgp_class_send_menu(struct Email *e)
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -.
Definition pgp.c:1893
struct Body * pgp_class_sign_message(struct Body *b, const struct AddressList *from)
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -.
Definition pgp.c:1332
bool pgp_class_valid_passphrase(void)
Ensure we have a valid passphrase - Implements CryptModuleSpecs::valid_passphrase() -.
Definition pgp.c:85
int pgp_class_verify_one(struct Body *b, struct State *state, const char *tempfile)
Check a signed MIME part against a signature - Implements CryptModuleSpecs::verify_one() -.
Definition pgp.c:898
void pgp_class_void_passphrase(void)
Forget the cached passphrase - Implements CryptModuleSpecs::void_passphrase() -.
Definition pgp.c:76
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition lib.h:96

◆ CryptModPgpGpgme

const struct CryptModuleSpecs CryptModPgpGpgme

GPGME PGP - Implements CryptModuleSpecs -.

Definition at line 58 of file crypt_mod_pgp_gpgme.c.

58 {
59 // clang-format off
61
63 NULL, /* cleanup */
74
78 NULL, /* pgp_traditional_encryptsign */
79 NULL, /* pgp_invoke_getkeys */
81 NULL, /* pgp_extract_key_from_attachment */
82
83 NULL, /* smime_getkeys */
84 NULL, /* smime_verify_sender */
85 NULL, /* smime_build_smime_entity */
86 NULL, /* smime_invoke_import */
87 // clang-format on
88};
int pgp_gpgme_application_handler(struct Body *b, struct State *state)
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::applicat...
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() -.
int pgp_gpgme_encrypted_handler(struct Body *b, struct State *state)
Manage a PGP or S/MIME encrypted MIME part - Implements CryptModuleSpecs::encrypted_handler() -.
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() -.
void pgp_gpgme_init(void)
Initialise the crypto module - Implements CryptModuleSpecs::init() -.
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() -.
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() -.
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...
struct Body * pgp_gpgme_make_key_attachment(void)
Generate a public key attachment - Implements CryptModuleSpecs::pgp_make_key_attachment() -.
SecurityFlags pgp_gpgme_send_menu(struct Email *e)
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -.
void pgp_gpgme_set_sender(const char *sender)
Set the sender of the email - Implements CryptModuleSpecs::set_sender() -.
struct Body * pgp_gpgme_sign_message(struct Body *b, const struct AddressList *from)
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -.
static bool pgp_gpgme_valid_passphrase(void)
Ensure we have a valid passphrase - Implements CryptModuleSpecs::valid_passphrase() -.
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() -.
static void pgp_gpgme_void_passphrase(void)
Forget the cached passphrase - Implements CryptModuleSpecs::void_passphrase() -.

◆ CryptModSmimeClassic

const struct CryptModuleSpecs CryptModSmimeClassic

CLI SMIME - Implements CryptModuleSpecs -.

Definition at line 56 of file crypt_mod_smime_classic.c.

56 {
57 // clang-format off
59
66 NULL, /* encrypted_handler */
71 NULL, /* set_sender */
72
73 NULL, /* pgp_encrypt_message */
74 NULL, /* pgp_make_key_attachment */
75 NULL, /* pgp_check_traditional */
76 NULL, /* pgp_traditional_encryptsign */
77 NULL, /* pgp_invoke_getkeys */
78 NULL, /* pgp_invoke_import */
79 NULL, /* pgp_extract_key_from_attachment */
80
85 // clang-format on
86};
int smime_class_application_handler(struct Body *b, struct State *state)
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::applicat...
Definition smime.c:1983
static void smime_class_cleanup(void)
Clean up smime - Implements CryptModuleSpecs::cleanup() -.
int smime_class_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 smime.c:1920
char * smime_class_find_keys(const struct AddressList *al, bool oppenc_mode)
Find the keyids of the recipients of a message - Implements CryptModuleSpecs::find_keys() -.
Definition smime.c:656
static void smime_class_init(void)
Initialise smime - Implements CryptModuleSpecs::init() -.
SecurityFlags smime_class_send_menu(struct Email *e)
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -.
Definition smime.c:2002
struct Body * smime_class_sign_message(struct Body *b, const struct AddressList *from)
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -.
Definition smime.c:1356
struct Body * smime_class_build_smime_entity(struct Body *b, char *certlist)
Encrypt the email body to all recipients - Implements CryptModuleSpecs::smime_build_smime_entity() -.
Definition smime.c:1191
void smime_class_getkeys(struct Envelope *env)
Get the S/MIME keys required to encrypt this email - Implements CryptModuleSpecs::smime_getkeys() -.
Definition smime.c:616
void smime_class_invoke_import(const char *infile, const char *mailbox)
Add a certificate and update index file (externally) - Implements CryptModuleSpecs::smime_invoke_impo...
Definition smime.c:989
int smime_class_verify_sender(struct Email *e, struct Message *msg)
Does the sender match the certificate?
Definition smime.c:1065
bool smime_class_valid_passphrase(void)
Ensure we have a valid passphrase - Implements CryptModuleSpecs::valid_passphrase() -.
Definition smime.c:157
int smime_class_verify_one(struct Body *b, struct State *state, const char *tempfile)
Check a signed MIME part against a signature - Implements CryptModuleSpecs::verify_one() -.
Definition smime.c:1568
void smime_class_void_passphrase(void)
Forget the cached passphrase - Implements CryptModuleSpecs::void_passphrase() -.
Definition smime.c:148
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition lib.h:97

◆ CryptModSmimeGpgme

const struct CryptModuleSpecs CryptModSmimeGpgme

GPGME SMIME - Implements CryptModuleSpecs -.

Definition at line 58 of file crypt_mod_smime_gpgme.c.

58 {
59 // clang-format off
61
63 NULL, /* cleanup */
68 NULL, /* encrypted_handler */
73 NULL, /* set_sender */
74
75 NULL, /* pgp_encrypt_message */
76 NULL, /* pgp_make_key_attachment */
77 NULL, /* pgp_check_traditional */
78 NULL, /* pgp_traditional_encryptsign */
79 NULL, /* pgp_invoke_getkeys */
80 NULL, /* pgp_invoke_import */
81 NULL, /* pgp_extract_key_from_attachment */
82
83 NULL, /* smime_getkeys */
86 NULL, /* smime_invoke_import */
87 // clang-format on
88};
int smime_gpgme_application_handler(struct Body *b, struct State *state)
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::applicat...
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() -.
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() -.
void smime_gpgme_init(void)
Initialise the crypto module - Implements CryptModuleSpecs::init() -.
SecurityFlags smime_gpgme_send_menu(struct Email *e)
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -.
struct Body * smime_gpgme_sign_message(struct Body *b, const struct AddressList *from)
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -.
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() -.
int smime_gpgme_verify_sender(struct Email *e, struct Message *msg)
Does the sender match the certificate?
static bool smime_gpgme_valid_passphrase(void)
Ensure we have a valid passphrase - Implements CryptModuleSpecs::valid_passphrase() -.
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() -.
static void smime_gpgme_void_passphrase(void)
Forget the cached passphrase - Implements CryptModuleSpecs::void_passphrase() -.