return length;
}
-int list_sigs(struct openpgp_packet_list *sigs, bool html)
+int list_sigs(struct onak_dbctx *dbctx,
+ struct openpgp_packet_list *sigs, bool html)
{
char *uid = NULL;
uint64_t sigid = 0;
while (sigs != NULL) {
sigid = sig_keyid(sigs->packet);
- uid = config.dbbackend->keyid2uid(sigid);
+ uid = dbctx->keyid2uid(dbctx, sigid);
if (sigs->packet->data[0] == 4 &&
sigs->packet->data[1] == 0x30) {
/* It's a Type 4 sig revocation */
return 0;
}
-int list_uids(uint64_t keyid, struct openpgp_signedpacket_list *uids,
+int list_uids(struct onak_dbctx *dbctx,
+ uint64_t keyid, struct openpgp_signedpacket_list *uids,
bool verbose, bool html)
{
char buf[1024];
}
}
if (verbose) {
- list_sigs(uids->sigs, html);
+ list_sigs(dbctx, uids->sigs, html);
}
uids = uids->next;
}
return 0;
}
-int list_subkeys(struct openpgp_signedpacket_list *subkeys, bool verbose,
+int list_subkeys(struct onak_dbctx *dbctx,
+ struct openpgp_signedpacket_list *subkeys, bool verbose,
bool html)
{
struct tm *created = NULL;
}
if (verbose) {
- list_sigs(subkeys->sigs, html);
+ list_sigs(dbctx, subkeys->sigs, html);
}
subkeys = subkeys->next;
}
void display_fingerprint(struct openpgp_publickey *key)
{
int i = 0;
- size_t length = 0;
- unsigned char fp[20];
+ struct openpgp_fingerprint fingerprint;
- get_fingerprint(key->publickey, fp, &length);
+ get_fingerprint(key->publickey, &fingerprint);
printf(" Key fingerprint =");
- for (i = 0; i < length; i++) {
- if ((length == 16) ||
+ for (i = 0; i < fingerprint.length; i++) {
+ if ((fingerprint.length == 16) ||
(i % 2 == 0)) {
printf(" ");
}
- if (length == 20 && (i * 2) == length) {
+ if (fingerprint.length == 20 &&
+ (i * 2) == fingerprint.length) {
/* Extra space in the middle of a SHA1 fingerprint */
printf(" ");
}
- printf("%02X", fp[i]);
+ printf("%02X", fingerprint.fp[i]);
}
printf("\n");
* This function takes a list of OpenPGP public keys and displays an index
* of them. Useful for debugging or the keyserver Index function.
*/
-int key_index(struct openpgp_publickey *keys, bool verbose, bool fingerprint,
+int key_index(struct onak_dbctx *dbctx,
+ struct openpgp_publickey *keys, bool verbose, bool fingerprint,
bool skshash, bool html)
{
struct openpgp_signedpacket_list *curuid = NULL;
display_fingerprint(keys);
}
if (verbose) {
- list_sigs(curuid->sigs, html);
+ list_sigs(dbctx, curuid->sigs, html);
}
curuid = curuid->next;
} else {
}
}
- list_uids(keyid, curuid, verbose, html);
+ list_uids(dbctx, keyid, curuid, verbose, html);
if (verbose) {
- list_subkeys(keys->subkeys, verbose, html);
+ list_subkeys(dbctx, keys->subkeys, verbose, html);
}
keys = keys->next;
int type = 0;
int length = 0;
int i = 0;
- size_t fplength = 0;
- unsigned char fp[20];
int c;
uint64_t keyid;
+ struct openpgp_fingerprint fingerprint;
while (keys != NULL) {
created_time = (keys->publickey->data[1] << 24) +
type = keys->publickey->data[7];
break;
case 4:
- (void) get_fingerprint(keys->publickey, fp, &fplength);
+ (void) get_fingerprint(keys->publickey, &fingerprint);
- for (i = 0; i < fplength; i++) {
- printf("%02X", fp[i]);
+ for (i = 0; i < fingerprint.length; i++) {
+ printf("%02X", fingerprint.fp[i]);
}
type = keys->publickey->data[5];