+ if (!(WithCrypto & APPLICATION_SMIME))
+ return msg->security;
+
+ switch (mutt_multi_choice
+ (_
+ ("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (c)lear? "),
+ _("eswabfc"))) {
+ case 1: /* (e)ncrypt */
+ msg->security |= ENCRYPT;
+ msg->security &= ~SIGN;
+ break;
+
+ case 3: /* encrypt (w)ith */
+ {
+ int choice = 0;
+ msg->security |= ENCRYPT;
+
+ do {
+ /* I use "dra" because "123" is recognized anyway */
+ switch (mutt_multi_choice (_("Choose algorithm family:"
+ " 1: DES, 2: RC2, 3: AES,"
+ " or (c)lear? "), _("drac"))) {
+ case 1:
+ switch (choice = mutt_multi_choice (_("1: DES, 2: Triple-DES "),
+ _("dt"))) {
+ case 1:
+ str_replace (&SmimeCryptAlg, "des");
+ break;
+ case 2:
+ str_replace (&SmimeCryptAlg, "des3");
+ break;
+ }
+ break;
+
+ case 2:
+ switch (choice = mutt_multi_choice (_("1: RC2-40, 2: RC2-64, 3: RC2-128 "),
+ _("468"))) {
+ case 1:
+ str_replace (&SmimeCryptAlg, "rc2-40");
+ break;
+ case 2:
+ str_replace (&SmimeCryptAlg, "rc2-64");
+ break;
+ case 3:
+ str_replace (&SmimeCryptAlg, "rc2-128");
+ break;
+ }
+ break;
+
+ case 3:
+ switch (choice = mutt_multi_choice (_("1: AES128, 2: AES192, 3: AES256 "),
+ _("895"))) {
+ case 1:
+ str_replace (&SmimeCryptAlg, "aes128");
+ break;
+ case 2:
+ str_replace (&SmimeCryptAlg, "aes192");
+ break;
+ case 3:
+ str_replace (&SmimeCryptAlg, "aes256");
+ break;
+ }
+ break;
+
+ case 4: /* (c)lear */
+ mem_free (&SmimeCryptAlg);
+ /* fallback */
+ case -1: /* Ctrl-G or Enter */
+ choice = 0;
+ break;
+ }
+ } while (choice == -1);
+ }
+ break;
+
+ case 2: /* (s)ign */
+
+ if (!SmimeDefaultKey)
+ mutt_message (_("Can't sign: No key specified. Use Sign As."));
+
+ else {
+ msg->security |= SIGN;
+ msg->security &= ~ENCRYPT;
+ }
+ break;
+
+ case 4: /* sign (a)s */
+
+ if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) {
+ str_replace (&SmimeDefaultKey, p);
+
+ msg->security |= SIGN;
+
+ /* probably need a different passphrase */
+ crypt_smime_void_passphrase ();
+ }
+#if 0
+ else
+ msg->security &= ~SIGN;
+#endif
+
+ *redraw = REDRAW_FULL;
+ break;
+
+ case 5: /* (b)oth */
+ msg->security |= (ENCRYPT | SIGN);
+ break;
+
+ case 6: /* (f)orget it */
+ case 7: /* (c)lear */
+ msg->security = 0;
+ break;
+ }
+
+ if (msg->security && msg->security != APPLICATION_SMIME)
+ msg->security |= APPLICATION_SMIME;
+ else
+ msg->security = 0;
+
+ return (msg->security);