From 1885eb9675edd8dac4b8b0acec08a0ca33abe10e 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 e4c7e3568a..deb9f09962 100644 --- a/include/rpm/rpmkeyring.h +++ b/include/rpm/rpmkeyring.h @@ -156,6 +156,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 fdff9c255a..bb2ac34323 100644 --- a/rpmio/rpmkeyring.cc +++ b/rpmio/rpmkeyring.cc @@ -293,6 +293,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)