3812{
3813 gpgme_ctx_t ctx = NULL;
3814 gpgme_key_t export_keys[2] = { 0 };
3815 gpgme_data_t keydata = NULL;
3816 struct Body *att = NULL;
3817 char buf[1024] = { 0 };
3818
3820
3823 if (!key)
3824 goto bail;
3825 export_keys[0] = key->
kobj;
3826 export_keys[1] = NULL;
3827
3829 gpgme_set_armor(ctx, 1);
3831 gpgme_error_t err = gpgme_op_export_keys(ctx, export_keys, 0, keydata);
3832 if (err != GPG_ERR_NO_ERROR)
3833 {
3834 mutt_error(
_(
"Error exporting key: %s"), gpgme_strerror(err));
3835 goto bail;
3836 }
3837
3839 if (!tempf)
3840 goto bail;
3841
3843
3849
3850
3851
3852 snprintf(buf,
sizeof(buf),
_(
"PGP Key 0x%s"),
crypt_keyid(key));
3855
3857
3858bail:
3860 gpgme_data_release(keydata);
3861 gpgme_release(ctx);
3862
3863 return att;
3864}
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.