3725{
3726 gpgme_ctx_t ctx = NULL;
3727 gpgme_key_t export_keys[2] = { 0 };
3728 gpgme_data_t keydata = NULL;
3729 struct Body *att = NULL;
3730 char buf[1024] = { 0 };
3731
3733
3736 if (!key)
3737 goto bail;
3738 export_keys[0] = key->
kobj;
3739 export_keys[1] = NULL;
3740
3742 gpgme_set_armor(ctx, 1);
3744 gpgme_error_t err = gpgme_op_export_keys(ctx, export_keys, 0, keydata);
3745 if (err != GPG_ERR_NO_ERROR)
3746 {
3747 mutt_error(
_(
"Error exporting key: %s"), gpgme_strerror(err));
3748 goto bail;
3749 }
3750
3752 if (!tempf)
3753 goto bail;
3754
3756
3762
3763
3764
3765 snprintf(buf,
sizeof(buf),
_(
"PGP Key 0x%s"),
crypt_keyid(key));
3768
3770
3771bail:
3773 gpgme_data_release(keydata);
3774 gpgme_release(ctx);
3775
3776 return att;
3777}
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.