From 050256d316160893fca69fd39cf3ee4678afb83b Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Mon, 7 Oct 2024 15:30:51 +0200 Subject: [PATCH] Add rpmPubkeyKeyIDAsHex --- include/rpm/rpmkeyring.h | 7 +++++++ rpmio/rpmkeyring.cc | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/include/rpm/rpmkeyring.h b/include/rpm/rpmkeyring.h index 26fe5b8e83..3e1f67eaab 100644 --- a/include/rpm/rpmkeyring.h +++ b/include/rpm/rpmkeyring.h @@ -154,6 +154,13 @@ int rpmPubkeyFingerprint(rpmPubkey key, uint8_t **fp, size_t *fplen); */ char * rpmPubkeyFingerprintAsHex(rpmPubkey key); +/** \ingroup rpmkeyring + * Return key ID of key as hex string + * @param key Pubkey + * @ return string or NULL on failure + */ +char * rpmPubkeyKeyIDAsHex(rpmPubkey key); + /** \ingroup rpmkeyring * Return pgp params of key * @param key Pubkey diff --git a/rpmio/rpmkeyring.cc b/rpmio/rpmkeyring.cc index 6520a80c13..118b260730 100644 --- a/rpmio/rpmkeyring.cc +++ b/rpmio/rpmkeyring.cc @@ -324,6 +324,12 @@ char * rpmPubkeyFingerprintAsHex(rpmPubkey key) return result; } +char * rpmPubkeyKeyIDAsHex(rpmPubkey key) +{ + return rpmhex((const uint8_t*)(key->keyid.c_str()), key->keyid.length()); +} + + rpmPubkey rpmPubkeyFree(rpmPubkey key) { if (key == NULL)