- listctx = create_gpgme_context (for_smime);
- err = gpgme_op_keylist_start (listctx, signid, 1);
- if (!err)
- err = gpgme_op_keylist_next (listctx, &key);
- if (err) {
- gpgme_release (listctx);
- mutt_error (_("secret key `%s' not found: %s\n"),
- signid, gpgme_strerror (err));
- return -1;
- }
- err = gpgme_op_keylist_next (listctx, &key2);
- if (!err) {
- gpgme_key_unref(key);
- gpgme_key_unref(key2);
- gpgme_release (listctx);
- mutt_error (_("ambiguous specification of secret key `%s'\n"), signid);
- return -1;
- }
- gpgme_op_keylist_end (listctx);
- gpgme_release (listctx);
+ err = gpgme_get_key(ctx, signid, &key, 1);
+ if (err) {
+ mutt_error(_("error getting secret key `%s': %s\n"), signid,
+ gpgme_strerror(err));
+ return -1;
+ }