- if (fetch_key(keyid, &publickey)) {
- if (publickey != NULL) {
- key_index(publickey, verbose, fingerprint,
- true);
- free_publickey(publickey);
- found = true;
- }
+ count = dbctx->fetch_key_id(dbctx, keyid, &publickey,
+ false);
+ } else if (isfp) {
+ count = dbctx->fetch_key_fp(dbctx, fingerprint, &publickey,
+ false);
+ } else {
+ count = dbctx->fetch_key_text(dbctx, search, &publickey);
+ }
+ if (publickey != NULL) {
+ if (mrhkp) {
+ printf("info:1:%d\n", count);
+ mrkey_index(publickey);
+ } else {
+ key_index(dbctx, publickey, verbose, dispfp,
+ skshash, true);
+ }
+ free_publickey(publickey);
+ } else if (count == 0) {
+ if (mrhkp) {
+ puts("info:1:0");
+ } else {
+ puts("Key not found.");
+ }
+ } else {
+ if (mrhkp) {
+ puts("info:1:0");
+ } else {
+ printf("Found %d keys, but maximum number to return"
+ " is %d.\n",
+ count,
+ config.maxkeys);
+ puts("Try again with a more specific search.");