3767{
3768 gpgme_ctx_t ctx = NULL;
3769 gpgme_key_t export_keys[2] = { 0 };
3770 gpgme_data_t keydata = NULL;
3771 struct Body *att = NULL;
3772 char buf[1024] = { 0 };
3773
3775
3778 if (!key)
3779 goto bail;
3780 export_keys[0] = key->
kobj;
3781 export_keys[1] = NULL;
3782
3784 gpgme_set_armor(ctx, 1);
3786 gpgme_error_t err = gpgme_op_export_keys(ctx, export_keys, 0, keydata);
3787 if (err != GPG_ERR_NO_ERROR)
3788 {
3789 mutt_error(
_(
"Error exporting key: %s"), gpgme_strerror(err));
3790 goto bail;
3791 }
3792
3794 if (!tempf)
3795 goto bail;
3796
3798
3804
3805
3806
3807 snprintf(buf,
sizeof(buf),
_(
"PGP Key 0x%s"),
crypt_keyid(key));
3810
3812
3813bail:
3815 gpgme_data_release(keydata);
3816 gpgme_release(ctx);
3817
3818 return att;
3819}
static gpgme_data_t create_gpgme_data(void)
Create a new GPGME data object.
gpgme_ctx_t create_gpgme_context(bool for_smime)
Create a new GPGME context.
static char * data_object_to_tempfile(gpgme_data_t data, FILE **fp_ret)
Copy a data object to a temporary file.
static struct CryptKeyInfo * crypt_ask_for_key(const char *tag, const char *whatfor, KeyFlags abilities, unsigned int app, bool *forced_valid)
Ask the user for a key.
const char * crypt_keyid(struct CryptKeyInfo *k)
Find the ID for the key.
static void crypt_key_free(struct CryptKeyInfo **keylist)
Release all the keys in a list.
struct Body * mutt_body_new(void)
Create a new Body.
long mutt_file_get_size(const char *path)
Get the size of a file.
bool OptPgpCheckTrust
(pseudo) used by dlg_pgp()
@ TYPE_APPLICATION
Type: 'application/*'.
char * mutt_str_dup(const char *str)
Copy a string, safely.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define KEYFLAG_NO_FLAGS
No flags are set.
void mutt_update_encoding(struct Body *b, struct ConfigSubset *sub)
Update the encoding type.
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
LOFF_T length
length (in bytes) of attachment
bool use_disp
Content-Disposition uses filename= ?
char * description
content-description
char * subtype
content-type subtype
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.