#endif
#ifdef HAVE_SMIME
if (msg->security & APPLICATION_SMIME && msg->security & SIGN) {
- printw ("%s%s", _(" sign as: "), SmimeSignAs ? SmimeSignAs : _("<default>"));
+ printw ("%s%s", _(" sign as: "), SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
}
if (msg->security & APPLICATION_SMIME && (msg->security & ENCRYPT)) {
mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
case 3: /* (s)ign */
- if(!SmimeSignAs)
+ if(!SmimeDefaultKey)
mutt_message("Can\'t sign: No key specified. use sign(as).");
else
msg->security |= SMIMESIGN;
if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) {
p[mutt_strlen (p)-1] = '\0';
- mutt_str_replace (&SmimeSignAs, p);
+ mutt_str_replace (&SmimeDefaultKey, p);
msg->security |= SMIMESIGN;
** This flag controls wether you want to be asked to enter a label for a certificate
** about to be added to the database or not. It is set by default.
*/
+ { "smime_decrypt_use_default_key", DT_BOOL, R_NONE, OPTSDEFAULTDECRYPTKEY, 1 },
+ /*
+ ** .pp
+ ** If set (default) this tells mutt to use the default key for decryption. Otherwise,
+ ** if manage multiple certificate-key-pairs, mutt will try to use the mailbox-address
+ ** to determine the key to use. It will ask you to supply a key, if it can't find one.
+ */
#endif
#ifdef HAVE_PGP
{ "pgp_entry_format", DT_STR, R_NONE, UL &PgpEntryFormat, UL "%4n %t%f %4l/0x%k %-4a %2c %u" },
** X509 certificates, and for verification purposes (to check, wether the
** certifacate was issued for the sender's mailbox).
*/
- { "smime_sign_as", DT_STR, R_NONE, UL &SmimeSignAs, 0 },
+ { "smime_sign_as", DT_SYN, R_NONE, UL "smime_default_key", 0 },
+ { "smime_default_key", DT_STR, R_NONE, UL &SmimeDefaultKey, 0 },
/*
** .pp
** This is the default key-pair to use vor signing. This must be set to the
key = safe_calloc(1, mutt_strlen(fields[1])+2);
if (public) key_trust_level = *fields[4];
snprintf(key, mutt_strlen(fields[1])+1, "%s", fields[1]);
+
}
found = 1;
}
/*
This sets the '*ToUse' variables for an upcoming decryption, where
- the reuquired key is different from SmimeSignAs.
+ the reuquired key is different from SmimeDefaultKey.
*/
void _smime_getkeys (char *mailbox)
{
- char *k = smime_get_field_from_db (mailbox, NULL, 0, 1);
+ char *k = NULL;
char buf[STRING];
+ k = smime_get_field_from_db (mailbox, NULL, 0, 1);
+
if (!k)
{
snprintf(buf, sizeof(buf), _("Enter keyID for %s: "),
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
NONULL(SmimeCertificates), k);
- if (mutt_strcasecmp (k, SmimeSignAs))
+ if (mutt_strcasecmp (k, SmimeDefaultKey))
smime_void_passphrase ();
safe_free ((void **) &k);
if (*SmimeKeyToUse)
{
- if (!mutt_strcasecmp (SmimeSignAs,
+ if (!mutt_strcasecmp (SmimeDefaultKey,
SmimeKeyToUse + mutt_strlen (SmimeKeys)+1))
return;
}
snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
- NONULL (SmimeKeys), SmimeSignAs);
+ NONULL (SmimeKeys), SmimeDefaultKey);
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
- NONULL (SmimeCertificates), SmimeSignAs);
+ NONULL (SmimeCertificates), SmimeDefaultKey);
}
void smime_getkeys (ENVELOPE *env)
ADDRESS *t;
int found = 0;
+ if (option (OPTSDEFAULTDECRYPTKEY) && SmimeDefaultKey && *SmimeDefaultKey)
+ {
+ snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
+ NONULL (SmimeKeys), SmimeDefaultKey);
+
+ snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
+ NONULL(SmimeCertificates), SmimeDefaultKey);
+
+ return;
+ }
+
for (t = env->to; !found && t; t = t->next)
if (mutt_addr_is_user (t))
{
int err = 0;
int empty = 0;
pid_t thepid;
- char *intermediates = smime_get_field_from_db(NULL, SmimeSignAs, 1, 1);
+ char *intermediates = smime_get_field_from_db(NULL, SmimeDefaultKey, 1, 1);
if (!intermediates)
{
mutt_message(_("Warning: Intermediate certificate not found."));
- intermediates = SmimeSignAs; /* so openssl won't complain in any case */
+ intermediates = SmimeDefaultKey; /* so openssl won't complain in any case */
}
else
intermediates[mutt_strlen (intermediates)-1] = '\0';
snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
- NONULL(SmimeKeys), SmimeSignAs);
+ NONULL(SmimeKeys), SmimeDefaultKey);
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
- NONULL(SmimeCertificates), SmimeSignAs);
+ NONULL(SmimeCertificates), SmimeDefaultKey);
snprintf (SmimeIntermediateToUse, sizeof (SmimeIntermediateToUse), "%s/%s",
NONULL(SmimeCertificates), intermediates);