/*
** .pp
** This is an additional key used to encrypt messages when $$pgp_self_encrypt
- ** is \fIset\fP. It should be in keyid or fingerprint form (e.g. 0x00112233).
+ ** is \fIset\fP. It is also used to specify the key for $$postpone_encrypt.
+ ** It should be in keyid or fingerprint form (e.g. 0x00112233).
** (PGP only)
*/
{ "pgp_show_unusable", DT_BOOL, R_NONE, OPTPGPSHOWUNUSABLE, 1 },
/*
** .pp
** When \fIset\fP, postponed messages that are marked for encryption will be
- ** encrypted using the key in $$postpone_encrypt_as before saving.
+ ** self-encrypted. Mutt will first try to encrypt using the value specified
+ ** in $$pgp_self_encrypt_as or $$smime_self_encrypt_as. If those are not
+ ** set, it will try the deprecated $$postpone_encrypt_as.
** (Crypto only)
*/
{ "postpone_encrypt_as", DT_STR, R_NONE, UL &PostponeEncryptAs, 0 },
/*
** .pp
- ** This is the key used to encrypt postponed messages. It should be in
- ** keyid or fingerprint form (e.g. 0x00112233 for PGP or the
- ** hash-value that OpenSSL generates for S/MIME).
+ ** This is a deprecated fall-back variable for $$postpone_encrypt.
+ ** Please use $$pgp_self_encrypt_as or $$smime_self_encrypt_as.
** (Crypto only)
*/
#ifdef USE_SOCKET
/*
** .pp
** This is an additional certificate used to encrypt messages when
- ** $$smime_self_encrypt is \fIset\fP. It should be the
- ** hash-value that OpenSSL generates.
+ ** $$smime_self_encrypt is \fIset\fP. It is also used to specify the
+ ** certficate for $$postpone_encrypt. It should be the hash-value that
+ ** OpenSSL generates.
** (S/MIME only)
*/
{ "smime_sign_command", DT_STR, R_NONE, UL &SmimeSignCommand, 0 },
if (msg->content->next)
msg->content = mutt_make_multipart(msg->content);
- if (WithCrypto && option(OPTPOSTPONEENCRYPT) && PostponeEncryptAs &&
- (msg->security & ENCRYPT))
+ if (WithCrypto && option(OPTPOSTPONEENCRYPT) && (msg->security & ENCRYPT))
{
- int is_signed = msg->security & SIGN;
- if (is_signed)
- msg->security &= ~SIGN;
+ char *encrypt_as = NULL;
- pgpkeylist = safe_strdup(PostponeEncryptAs);
- if (mutt_protect(msg, pgpkeylist) == -1)
+ if ((WithCrypto & APPLICATION_PGP) && (msg->security & APPLICATION_PGP))
+ encrypt_as = PgpSelfEncryptAs;
+ else if ((WithCrypto & APPLICATION_SMIME) && (msg->security & APPLICATION_SMIME))
+ encrypt_as = SmimeSelfEncryptAs;
+ if (!(encrypt_as && *encrypt_as))
+ encrypt_as = PostponeEncryptAs;
+
+ if (encrypt_as && *encrypt_as)
{
+ int is_signed = msg->security & SIGN;
+ if (is_signed)
+ msg->security &= ~SIGN;
+
+ pgpkeylist = safe_strdup(encrypt_as);
+ if (mutt_protect(msg, pgpkeylist) == -1)
+ {
+ if (is_signed)
+ msg->security |= SIGN;
+ FREE(&pgpkeylist);
+ msg->content = mutt_remove_multipart(msg->content);
+ goto main_loop;
+ }
+
if (is_signed)
msg->security |= SIGN;
FREE(&pgpkeylist);
- msg->content = mutt_remove_multipart(msg->content);
- goto main_loop;
}
-
- if (is_signed)
- msg->security |= SIGN;
- FREE(&pgpkeylist);
}
/*