#include "keyid.h"
#include "keyindex.h"
#include "keystructs.h"
+#include "log.h"
int list_sigs(struct openpgp_packet_list *sigs, bool html)
{
subkeys->packet->data[7];
break;
default:
- fprintf(stderr, "Unknown key type: %d\n",
+ logthing(LOGTHING_ERROR,
+ "Unknown key type: %d",
subkeys->packet->data[0]);
}
return 0;
}
+void display_fingerprint(struct openpgp_publickey *key)
+{
+ int i = 0;
+ size_t length = 0;
+ unsigned char fp[20];
+
+ get_fingerprint(key->publickey, fp, &length);
+ printf(" Key fingerprint =");
+ for (i = 0; i < length; i++) {
+ if ((length == 16) ||
+ (i % 2 == 0)) {
+ printf(" ");
+ }
+ printf("%02X", fp[i]);
+ if ((i * 2) == length) {
+ printf(" ");
+ }
+ }
+ printf("\n");
+
+ return;
+}
+
/**
* key_index - List a set of OpenPGP keys.
* @keys: The keys to display.
keys->publickey->data[7];
break;
default:
- fprintf(stderr, "Unknown key type: %d\n",
+ logthing(LOGTHING_ERROR, "Unknown key type: %d",
keys->publickey->data[0]);
}
(int) curuid->packet->length,
curuid->packet->data);
printf("%s\n", (html) ? txt2html(buf) : buf);
+ if (fingerprint) {
+ display_fingerprint(keys);
+ }
if (verbose) {
list_sigs(curuid->sigs, html);
}
curuid = curuid->next;
} else {
putchar('\n');
+ if (fingerprint) {
+ display_fingerprint(keys);
+ }
}
list_uids(curuid, verbose, html);