-char *crypt_smime_findkeys (address_t * to, address_t * cc, address_t * bcc)
-{
- return find_keys (to, cc, bcc, APPLICATION_SMIME);
+ *keylist = NULL;
+
+ if (msg->security & ENCRYPT) {
+ if (msg->security & APPLICATION_PGP) {
+ set_option(OPTPGPCHECKTRUST);
+ *keylist = find_keys(msg->env->to, msg->env->cc, msg->env->bcc,
+ APPLICATION_PGP);
+ unset_option(OPTPGPCHECKTRUST);
+ if (!*keylist)
+ return -1;
+ }
+
+ if (msg->security & APPLICATION_SMIME) {
+ *keylist = find_keys(msg->env->to, msg->env->cc, msg->env->bcc,
+ APPLICATION_SMIME);
+ if (!*keylist)
+ return -1;
+ }
+ }
+
+ return (0);