- snprintf (buff, sizeof (buff),
- _("%s Do you really want to use the key?"), _(warn_s));
-
- if (mutt_yesorno (buff, 0) != 1) {
- mutt_clear_error ();
- break;
+ if (option (OPTPGPCHECKTRUST) &&
+ ((cryptkey_table[menu->current]->flags & KEYFLAG_CANTUSE)
+ || !crypt_id_is_strong (cryptkey_table[menu->current]))) {
+ const char *warn_s;
+ char buff[LONG_STRING];
+
+ if (cryptkey_table[menu->current]->flags & KEYFLAG_CANTUSE)
+ s = N_("ID is expired/disabled/revoked.");
+ else {
+ gpgme_validity_t val = GPGME_VALIDITY_UNKNOWN;
+ gpgme_user_id_t uid = NULL;
+ int j = 0;
+
+ warn_s = "??";
+
+ uid = cryptkey_table[menu->current]->kobj->uids;
+ for (j = 0; (j < cryptkey_table[menu->current]->idx) && uid;
+ j++, uid = uid->next);
+ if (uid)
+ val = uid->validity;
+
+ switch (val) {
+ case GPGME_VALIDITY_UNKNOWN:
+ case GPGME_VALIDITY_UNDEFINED:
+ warn_s = N_("ID has undefined validity.");
+ break;
+ case GPGME_VALIDITY_NEVER:
+ warn_s = N_("ID is not valid.");
+ break;
+ case GPGME_VALIDITY_MARGINAL:
+ warn_s = N_("ID is only marginally valid.");
+ break;
+ case GPGME_VALIDITY_FULL:
+ case GPGME_VALIDITY_ULTIMATE:
+ break;
+ }
+
+ snprintf (buff, sizeof (buff),
+ _("%s Do you really want to use the key?"), _(warn_s));
+
+ if (mutt_yesorno (buff, 0) != 1) {
+ mutt_clear_error ();
+ break;
+ }
+ *forced_valid = 1;
+ }