NeoMutt  2022-04-29-323-g5fcc6c
Teaching an old dog new tricks
DOXYGEN
smime_getkeys()

Get the S/MIME keys required to encrypt this email. More...

+ Collaboration diagram for smime_getkeys():

Functions

void smime_class_getkeys (struct Envelope *env)
 Implements CryptModuleSpecs::smime_getkeys() -. More...
 

Detailed Description

Get the S/MIME keys required to encrypt this email.

Parameters
envEnvelope of the email

Function Documentation

◆ smime_class_getkeys()

void smime_class_getkeys ( struct Envelope env)

Implements CryptModuleSpecs::smime_getkeys() -.

Definition at line 792 of file smime.c.

793{
794 const bool c_smime_decrypt_use_default_key = cs_subset_bool(NeoMutt->sub, "smime_decrypt_use_default_key");
795 const char *const c_smime_default_key = cs_subset_string(NeoMutt->sub, "smime_default_key");
796 if (c_smime_decrypt_use_default_key && c_smime_default_key)
797 {
798 const char *const c_smime_keys = cs_subset_path(NeoMutt->sub, "smime_keys");
799 mutt_buffer_printf(&SmimeKeyToUse, "%s/%s", NONULL(c_smime_keys), c_smime_default_key);
800 const char *const c_smime_certificates = cs_subset_path(NeoMutt->sub, "smime_certificates");
801 mutt_buffer_printf(&SmimeCertToUse, "%s/%s", NONULL(c_smime_certificates),
802 c_smime_default_key);
803 return;
804 }
805
806 struct Address *a = NULL;
807 TAILQ_FOREACH(a, &env->to, entries)
808 {
809 if (mutt_addr_is_user(a))
810 {
811 getkeys(a->mailbox);
812 return;
813 }
814 }
815
816 TAILQ_FOREACH(a, &env->cc, entries)
817 {
818 if (mutt_addr_is_user(a))
819 {
820 getkeys(a->mailbox);
821 return;
822 }
823 }
824
825 struct Address *f = mutt_default_from(NeoMutt->sub);
826 getkeys(f->mailbox);
827 mutt_addr_free(&f);
828}
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
Definition: alias.c:574
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:168
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:317
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:194
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
struct Address * mutt_default_from(struct ConfigSubset *sub)
Get a default 'from' Address.
Definition: send.c:1459
static struct Buffer SmimeKeyToUse
Definition: smime.c:81
static struct Buffer SmimeCertToUse
Definition: smime.c:82
static void getkeys(char *mailbox)
Get the keys for a mailbox.
Definition: smime.c:757
#define NONULL(x)
Definition: string2.h:37
An email address.
Definition: address.h:36
char * mailbox
Mailbox and host address.
Definition: address.h:38
struct AddressList to
Email's 'To' list.
Definition: envelope.h:60
struct AddressList cc
Email's 'Cc' list.
Definition: envelope.h:61
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function: