3782{
3783 gpgme_ctx_t ctx = NULL;
3784 gpgme_key_t export_keys[2] = { 0 };
3785 gpgme_data_t keydata = NULL;
3786 struct Body *att = NULL;
3787 char buf[1024] = { 0 };
3788
3790
3793 if (!key)
3794 goto bail;
3795 export_keys[0] = key->
kobj;
3796 export_keys[1] = NULL;
3797
3799 gpgme_set_armor(ctx, 1);
3801 gpgme_error_t err = gpgme_op_export_keys(ctx, export_keys, 0, keydata);
3802 if (err != GPG_ERR_NO_ERROR)
3803 {
3804 mutt_error(
_(
"Error exporting key: %s"), gpgme_strerror(err));
3805 goto bail;
3806 }
3807
3809 if (!tempf)
3810 goto bail;
3811
3813
3819
3820
3821
3822 snprintf(buf,
sizeof(buf),
_(
"PGP Key 0x%s"),
crypt_keyid(key));
3825
3827
3828bail:
3830 gpgme_data_release(keydata);
3831 gpgme_release(ctx);
3832
3833 return att;
3834}
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.
@ KEYFLAG_NONE
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.
gpgme_key_t kobj
GPGME key object.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.